is this good?
'talk
'0.2
Sub talk_Event_Load()
AddChat vbYellow, "talk test loaded"
End Sub
sub talk_Event_UserTalk(Username, Flags, Message, Ping)
If Left(LCase(Text), Len(BotVars.Trigger) + 6) = BotVars.Trigger & "speak " Then
sayTheRest = Right(Message, Len(Message) - (Len(BotVars.Trigger) + 6))
AddQ sayTheRest
End If
End Sub
Note the corrections in bold.
As for the rest:
(Username, Flags, Message, Ping) = Everytime a user talks, this Sub is called, and these four things are "passed" to the function, meaning you may access these variables everytime a user talks. They are: Username which contains the name of the user who spoke. Flags, the user's battle.net flags. Flag 0 is for a normal user (not opped or anything). Message is the message they said when they talked. Ping just contains their ping value at logon.
AddQ = sends the specified text to battle.net, same as if you typed something and pressed enter.
Len = the length of a string. "hai there" and "Hello world!" are both strings.
I will break down the following code for you:
sayTheRest = Right(Message, Len(Message) - (Len(BotVars.Trigger) + 6))
Right() returns the rightmost characters of a string.
Basically, the Message is what we want to extract characters out of.
Take the second part here:
Len(Message) - (Len(BotVars.Trigger) + 6)
Ok, say someone said ".speak hai there"
What this would do is take the length of the message as indicated by Len(Message), and subtract the length represented by ".speak " out of the message, leaving "hai there". The (Len(BotVars.Trigger) + 6) part just adds the length of the trigger + 6 together, making 7, which would represent the leftmost part of the message that says ".speak ". After that part is taken out, we are then left with "hai there"
AddQ sayTheRest simply sends the resulting string to battle.net
the 6 is the length of "speak" plus a space, because that is the most logical way to do it.