Valhalla Legends Forums Archive | Battle.net Bot Development | disconnect & Quit

AuthorMessageTime
TeEhEiMaN
This is what tryed but It did not work. Can you guys help me out here?


'disconnect command
[code]
If Username = Form5.txtMaster.Text Then
If Left((LCase(Message)), 12) = (Form5.txtTrigger.Text & "disconnect ") Then
CleanSlateBot1.Disconnect
End If
End If
[/code]

[code]
'quit command
If Username = Form5.txtMaster.Text Then
If Left((LCase(Message)), 6) = (Form5.txtTrigger.Text & "quit ") Then
Unload Me
End If
End If
[/code]
May 27, 2003, 5:01 AM
laurion
y do you have spaces at the end of the commands?
May 27, 2003, 10:09 AM
Yoni
Did you try sending the commands with a space after them?
May 27, 2003, 11:36 AM
timbo
just a thought...
[code]
If Username = Form5.txtMaster.Text and Instr(1,Message,strTrigger & "disconnect",vbTextCompare) > 0 Then
CleanSlateBot1.Disconnect
End If[/code]
May 27, 2003, 1:05 PM
______
[code]
If Left((LCase(Message)), 5) = frmOptions.Trigger.Text & "quit" Then
If Username = Form5.txtMaster.Text Then
unload me
end

End If
[/code]
May 27, 2003, 2:00 PM
WiLD
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:
[code]If Left((LCase(Message)), 5)[/code]
Could you kinda put this into english.

thx
May 28, 2003, 5:55 AM
Yoni
"If the 5 leftmost chars in the translation to lowercase of Message are-"
May 28, 2003, 11:46 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)
May 28, 2003, 11:50 AM
timbo
vb language reference
http://msdn.microsoft.com/library/en-us/VBRef98/html/vbmscLROverview.asp
May 28, 2003, 12:32 PM
Grok
Or ..

[code]
      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
[/code]

However, you should not use Left anymore. Use SubString function of the String class.
May 28, 2003, 2:58 PM
CrAz3D
[quote]
If Username = Form5.txtMaster.Text Then
If Left((LCase(Message)), 12) = (Form5.txtTrigger.Text & "disconnect ") Then
FORM1.CleanSlateBot1.Disconnect
End If
End If
[/quote]
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.
May 28, 2003, 3:36 PM
______
[quote author=CrAz3D link=board=17;threadid=1452;start=0#msg10968 date=1054136212]
[quote]
If Username = Form5.txtMaster.Text Then

[/quote]


[/quote]
wouldnt
[code]
If lcase(Username) = lcase(Form5.txtMaster.Text) Then
[/code]
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
May 28, 2003, 4:26 PM
Soul Taker
I just use Option Compare Text myself, much easier than lcase()ing everything.
May 28, 2003, 4:43 PM
Undeference
you know, vb really sucks. Try using something else. There are already too many vb bots. >:(
May 30, 2003, 6:59 PM
Kp
[quote author=Undeference link=board=17;threadid=1452;start=0#msg11148 date=1054321190]you know, vb really sucks. Try using something else. There are already too many vb bots. >:([/quote]This is not the place to start a language war. If these people want to write in VB, so be it.
May 30, 2003, 7:24 PM
Undeference
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:[code]
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[/code]

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.
November 27, 2003, 9:17 PM
Kp
Is it completely lost on you that the last response to this topic was in May?
November 27, 2003, 9:24 PM
Undeference
So... as I said, I was just looking at it. But not that I expect anybody to be anywhere efficient.
November 30, 2003, 12:38 AM

Search