Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: TeEhEiMaN on May 27, 2003, 12:01 AM

Title: disconnect & Quit
Post by: TeEhEiMaN on May 27, 2003, 12:01 AM
This is what tryed but It did not work. Can you guys help me out here?


'disconnect command

If Username = Form5.txtMaster.Text Then
If Left((LCase(Message)), 12) = (Form5.txtTrigger.Text & "disconnect ") Then
CleanSlateBot1.Disconnect
End If
End If



'quit command
If Username = Form5.txtMaster.Text Then
If Left((LCase(Message)), 6) = (Form5.txtTrigger.Text & "quit ") Then
Unload Me
End If
End If
Title: Re:disconnect & Quit
Post by: Tazo on May 27, 2003, 05:09 AM
y do you have spaces at the end of the commands?
Title: Re:disconnect & Quit
Post by: Yoni on May 27, 2003, 06:36 AM
Did you try sending the commands with a space after them?
Title: Re:disconnect & Quit
Post by: timbo on May 27, 2003, 08:05 AM
just a thought...

If Username = Form5.txtMaster.Text and Instr(1,Message,strTrigger & "disconnect",vbTextCompare) > 0 Then
CleanSlateBot1.Disconnect
End If

Title: Re:disconnect & Quit
Post by: ______ on May 27, 2003, 09:00 AM

If Left((LCase(Message)), 5) = frmOptions.Trigger.Text & "quit" Then
If Username = Form5.txtMaster.Text Then
unload me
end

End If
Title: Re:disconnect & Quit
Post by: WiLD on May 28, 2003, 12:55 AM
wow thx ______

a great code example, i have been using case, i might start using code now, looks easyier enough.

I understand everything except for 1 part:
If Left((LCase(Message)), 5)
Could you kinda put this into english.

thx
Title: Re:disconnect & Quit
Post by: Yoni on May 28, 2003, 06:46 AM
"If the 5 leftmost chars in the translation to lowercase of Message are-"
Title: Re:disconnect & Quit
Post by: ______ on May 28, 2003, 06:50 AM
Left(string,length) meaning left of a string and how long it is

lcase(message)    = lower cased message to look for

5 =  the length in  Left(string,length)
Title: Re:disconnect & Quit
Post by: timbo on May 28, 2003, 07:32 AM
vb language reference
http://msdn.microsoft.com/library/en-us/VBRef98/html/vbmscLROverview.asp
Title: Re:disconnect & Quit
Post by: Grok on May 28, 2003, 09:58 AM
Or ..


      If VB.Left(LCase(Message), 5) = frmOptions.DefInstance.Trigger.Text & "quit" Then
         If Username = Form5.DefInstance.txtMaster.Text Then
            Me.Close()
         End If
      End If


However, you should not use Left anymore.  Use SubString function of the String class.
Title: Re:disconnect & Quit
Post by: CrAz3D on May 28, 2003, 10:36 AM
Quote
If Username = Form5.txtMaster.Text Then
If Left((LCase(Message)), 12) = (Form5.txtTrigger.Text & "disconnect ") Then
FORM1.CleanSlateBot1.Disconnect
End If
End If
Might that be your problem?  That your CSB mod is in a different arrear than your commands?  I know I don't have my commands on my main form.
Title: Re:disconnect & Quit
Post by: ______ on May 28, 2003, 11:26 AM
Quote from: CrAz3D on May 28, 2003, 10:36 AM
Quote
If Username = Form5.txtMaster.Text Then



wouldnt

If lcase(Username) = lcase(Form5.txtMaster.Text) Then

be better beacause if you didnt lcase it would be looking for Exact casing on the user.  

example USERnAme@azeroth = username@azeroth ' this would be false
lcaseing makes it like this  username@azeroth = username@azeroth ' this would be true
Title: Re:disconnect & Quit
Post by: Soul Taker on May 28, 2003, 11:43 AM
I just use Option Compare Text myself, much easier than lcase()ing everything.
Title: Re:disconnect & Quit
Post by: Undeference on May 30, 2003, 01:59 PM
you know, vb really sucks. Try using something else. There are already too many vb bots. >:(
Title: Despite my personal language preferences, Undeference:
Post by: Kp on May 30, 2003, 02:24 PM
Quote from: Undeference on May 30, 2003, 01:59 PMyou know, vb really sucks. Try using something else. There are already too many vb bots. >:(
This is not the place to start a language war.  If these people want to write in VB, so be it.
Title: Re:disconnect & Quit
Post by: Undeference on November 27, 2003, 03:17 PM
I just looked at this. This is extremely dumb. Do you want a trigger that can easily be changed by simply changing the text there and not having to save settings, or do you want people to have to click "Save settings" or something along those lines?

It would make a lot more sence to use a global string called trigger or something.
using more expresive code than what the vars are actually called:
If Left(LCase(message),Len(trigger))=trigger Then
'...there's your trigger
If Mid(LCase(message),Len(trigger),10))="disconnect" Then
  'disconnect
ElseIf Mid(LCase(message),Len(trigger),4)="quit" Then
  'disconnect&quit
End If
End If


First thing I do is check to see what the person's access is. Then I check for a trigger IF THEY HAVE ENOUGH ACCESS TO USE ANY COMMANDS, I then find the word after the trigger (until the first space) and search for a command that matches that. After that I see if they can use the command and then do whatever it is that that command does.
Title: Undeference:
Post by: Kp on November 27, 2003, 03:24 PM
Is it completely lost on you that the last response to this topic was in May?
Title: Re:disconnect & Quit
Post by: Undeference on November 29, 2003, 06:38 PM
So... as I said, I was just looking at it. But not that I expect anybody to be anywhere efficient.