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
y do you have spaces at the end of the commands?
Did you try sending the commands with a space after them?
just a thought...
If Username = Form5.txtMaster.Text and Instr(1,Message,strTrigger & "disconnect",vbTextCompare) > 0 Then
CleanSlateBot1.Disconnect
End If
If Left((LCase(Message)), 5) = frmOptions.Trigger.Text & "quit" Then
If Username = Form5.txtMaster.Text Then
unload me
end
End If
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
"If the 5 leftmost chars in the translation to lowercase of Message are-"
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)
vb language reference
http://msdn.microsoft.com/library/en-us/VBRef98/html/vbmscLROverview.asp
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.
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.
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
I just use Option Compare Text myself, much easier than lcase()ing everything.
you know, vb really sucks. Try using something else. There are already too many vb bots. >:(
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.
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.
Is it completely lost on you that the last response to this topic was in May?
So... as I said, I was just looking at it. But not that I expect anybody to be anywhere efficient.