Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Forged on May 04, 2004, 09:16 PM

Title: Help Please
Post by: Forged on May 04, 2004, 09:16 PM
I am a noob and for some reason my bot hates me and won't send my idle.  Can someone please help?


Private Sub idle_Timer()
   Dim strIdles As String
   Dim IdleWait As Integer
   Dim Idlemsg As String
   Dim strIdleType As String

   
   strIdles = ReadINI(f, "Idles", p)
   strIdleType = ReadINI(f, "IdleType", p)
   IdleWait = ReadINI(f, "IdleWait", p)
   Idlemsg = ReadINI(f, "IdleMsg", p)
   
   idle.Interval = CInt(IdleWait * 1000)
   if If strIdles = "y" Then    

   If strIdleType = "mp3" Then

   ExEasy1.Send "Now Playing: Vile`Chat v(1.2) By:Forged"
   
   ElseIf strIdleType = "msg" Then ExEasy1.Send Idlemsg
   
   ElseIf strIdleType = "uptime" Then ExEasy1.Send "System Uptime - " & ConvertTime(GetTickCount()) & " Vile`Chat (1.04)"
   End If
   end if
End Sub

Private Sub txtSend_KeyPress(KeyAscii As Integer)
Dim Message As String
If KeyAscii = 13 Then
ExEasy1.Send txtSend.Text
Message = txtSend.Text
txtSend.Text = ""
KeyAscii = 0
ExEasy1.AddChat vbYellow, "<", vbGreen, ExEasy1.CurrentUser, vbYellow, ">", vbWhite, Message

'Don't know if this is why
idle.Enabled = False
idle.Enabled = True

End If
End Sub
Title: Re:Help Please
Post by: CrAz3D on May 05, 2004, 02:08 PM
'Don't know if this is why
idle.Enabled = False
idle.Enabled = True

That is resetting the idle...which probably isn't too good if you ever want it to "fire"
Title: Re:Help Please
Post by: Eli_1 on May 05, 2004, 02:44 PM
Quote from: CrAz3D on May 05, 2004, 02:08 PM
'Don't know if this is why
idle.Enabled = False
idle.Enabled = True

That is resetting the idle...which probably isn't too good if you ever want it to "fire"
If the user is truly idle (afk), then that shouldn't be a problem.

Edit:
I've never seen anyone use this before. But who knows, it might work -- VB allows tons of weird things...

if If strIdles = "y" Then    

Title: Re:Help Please
Post by: hismajesty on May 05, 2004, 03:05 PM
No, two consecutive if's would cause an error (expected expression) perhaps he meant to use iif()?

Edit: Typo
Title: Re:Help Please
Post by: BaDDBLooD on May 05, 2004, 03:24 PM
what does iif function do?
Title: Re:Help Please
Post by: Eli_1 on May 05, 2004, 03:25 PM
Quote from: BaDDBLooD on May 05, 2004, 03:24 PM
what does iif function do?

IIRC, the syntax is: iif(Statment, True, False)

Dim iTest As Integer
iTest = 1
MsgBox IIf(iTest = 1, "It's equal to 1!", "It's not equal to 1!"), vbOKOnly + vbInformation, "IIF Example"




'// Or maybe a bot example?  ;D
Public Function GetAccess(ByVal Username as String)
   GetAccess = IIF(Username = "Eli_1", 100, 0)
End Function
Title: Re:Help Please
Post by: Forged on May 05, 2004, 06:52 PM
I re-wrote my idletimer in math class because I was bored and it works now.
I forgot to add idle.enbaled = true


Private Sub idle_Timer()
   Dim strIdles As String
   Dim IdleWait As Integer
   Dim Idlemsg As String
   Dim strIdleType As String

   
   strIdles = ReadINI(f, "Idles", p)
   strIdleType = ReadINI(f, "IdleType", p)
   IdleWait = ReadINI(f, "IdleWait", p)
   Idlemsg = ReadINI(f, "IdleMsg", p)
   
 
   If strIdles = "y" Then idle.Enabled = True

   If strIdleType = "mp3" Then
   Dim WindowTitle As String
   WindowTitle = l_winamp.GetWindowTitle("Winamp v1.x")
   WindowTitle = Left(WindowTitle, Len(WindowTitle) - 9)
   
   ExEasy1.Send "Now Playing: " & WindowTitle & " Vile`Chat v(1.2) By:Forged"
   ExEasy1.Chat True, True, vbYellow, "Now Playing: " & WindowTitle & " Vile`Chat v(1.2) By:Forged"
   
   ElseIf strIdleType = "msg" Then ExEasy1.Send Idlemsg
   ExEasy1.Chat True, True, vbYellow, Idlemsg
   ElseIf strIdleType = "uptime" Then ExEasy1.Send "System Uptime - " & ConvertTime(GetTickCount()) & "  Vile`Chat (1.2)"
   ExEasy1.Chat True, True, vbYellow, "System Uptime - " & ConvertTime(GetTickCount()) & "  Vile`Chat (1.2)"
   End If
   

End Sub
Title: Re:Help Please
Post by: Eli_1 on May 05, 2004, 08:28 PM
Haha, math and chemistry is where I write my best code.

Ironicly it's where I catch up on my sleep too.  ;D
Title: Re:Help Please
Post by: effect on May 05, 2004, 09:01 PM
Dont hardcode your versions (App.Major/Minor/Revision)

Hope that helps you a little.
Title: Re:Help Please
Post by: MyndFyre on May 05, 2004, 09:08 PM
Quote from: Forged on May 05, 2004, 06:52 PM
I forgot to add idle.enbaled = true

Don't you mean idle.enbalmed?
Title: Re:Help Please
Post by: Forged on May 05, 2004, 10:29 PM
Sorry I spelt it wrong

idle.Enabled

......