Then allow me to explain it so you can understand:
Sub NTPR_Event_Usertalk(Username, Flags, Message, Ping)
The Start of the Sub
If LCase(Message) = LCase("Pingme") Then
NTPRVar01 = Ping
NTPRVar02 = Username
If GetSetting("NTPR", "Pingme") Then
SetSetting "NTPR", "Pingme", False, "", True
AddQ "/w " & NTPRVar02 & " Your ping is currently: " & NTPRVar01 & " ms."
TimerEnabled "NTPR", "PingmeReset", True
Else
Exit Sub
End If
The PINGME No Trigger Command
I am using Variables instead to name PING and USERNAME.
I am using a Setting for a timer so the bot doesn't flood out.
ElseIf Left(LCase(Message), 5) = "ping " Then
If GetSetting("NTPR", "Ping") Then
SetSetting "NTPR", "Ping", False, "", True
If InStr(Lcase(GetBotVersion), "beta") Then
AddQ "//" & Message
TimerEnabled "NTPR", "PingReset", True
Else
AddQ "/say /" & Message
TimerEnabled "NTPR", "PingReset", True
End If
End If
End If
The PING No Trigger Command.
I look for "Ping ", and if that message IS "Ping " then it executes a Beta Version Check.
If Beta, it uses "//", but if not. it uses "/say /" to send the command to battle net.
Then enables a Timer to prevent the bot from flooding out as fast.
End Sub
The Sub is ended.
Now can you follow my code?
Riffruff's code:
Sub Event_UserTalk(Username, Flags, Message, Ping)
if left(lcase(message), 4) = "ping" then
Command BotVars.Username, "//ping " & Username, True
end if
end sub
My Code (From 1.22)
If Left(LCase(Message), 5) = "ping " Then
If GetSetting("NTPR", "Ping") Then
SetSetting "NTPR", "Ping", False, "", True
AddQ "/say /" & Message
TimerEnabled "NTPR", "PingReset", True
End If
End If
This would only return the ping of the USER who performed it. And besides, yours only matched the left four, which would conflict when someone says "Pingme" (Navy), whereas mine matches the left five on "Ping " (Red). Yours also does not have a bypass to prevent spamming/flooding out, whereas mine does (Green). Your is for the beta and has no way to separate the "Ping" from the "Username" of the person a USER wanted to ping (Indigo), whereas mine keeps the message INTACT and then uses the "/say /" command to process it (At least the one I am/was using) (Orange).
And what do you know, the ONLY thing we have in common with our scripts is this:
The Sub...End Sub Declaration and ONE End If.
PS: Vector told me it has to be 2.6 R3 compatible to wind up on his server of plugins.