Valhalla Legends Forums Archive | Battle.net Bot Development | Help pls

AuthorMessageTime
Sanskrit!
How would you write a triggerless command?
January 15, 2005, 7:16 AM
Myndfyr
Well it depends....  If you're attempting to concatenate the trigger with every command string like most newbies do when checking for equality, you would simply leave off the trigger part of the command checker.
original (psuedocode, since you didn't tell us what language you're using):
[code]
if (strCmd equals concat(strTrigger, "somecommand"))
[/code]
modified (pseudocode):
[code]
if (strCmd equals "somecommand")
[/code]

If you're like more intelligent folks and you check to see if the command string length is more than 0, and the first character of the string is the trigger, you'd need to account for that.  Like so:
original:
[code]
if (strCmd.characterAt(0) == strTrigger)
[/code]
modified:
[code]
if (strCmd.characterAt(0) == strTrigger)
then
' do something
else if (strCmd == "sometriggerlesscommand")
then
' do something differently.
end if
[/code]
I mean....  really, if you have much grasp of programming, it shouldn't be that hard to figure out.
January 15, 2005, 8:11 AM
Sanskrit!
Visual basic 6, and how about access checking? :o
January 15, 2005, 7:38 PM
Kp
Access checking is easy.

Pseudocode:
[code]a = get_access(user)
if (permOK(a, ThisCommand)) then
    do command
end if[/code]I'd suggest not producing any output on denied commands, as that opens the bot to Denial-of-Service attacks.
January 15, 2005, 7:42 PM
Sanskrit!
How would you write it in vb6?
January 20, 2005, 7:02 PM
Kp
[quote author=Sanskrit! link=topic=10196.msg95891#msg95891 date=1106247773]How would you write it in vb6?[/quote]

I wouldn't.  VB6 is a horrible language and should not be used for anything.  It doesn't even support unsigned 32bit integers.
January 20, 2005, 11:25 PM
Mephisto
[quote author=Kp link=topic=10196.msg95945#msg95945 date=1106263509]
[quote author=Sanskrit! link=topic=10196.msg95891#msg95891 date=1106247773]How would you write it in vb6?[/quote]

I wouldn't.  VB6 is a horrible language and should not be used for anything.  It doesn't even support unsigned 32bit integers.
[/quote]

Like Java!
January 22, 2005, 1:32 AM
Sanskrit!
Still doesn't answer the question!
January 22, 2005, 4:41 AM
KkBlazekK
[code]
If Left(LCase(Message),7) = "trigger" Then
        'Show The Trigger
End If[/code]


This Command Displays the trigger for people who do not know it.
January 22, 2005, 5:08 AM
Mephisto
Why are you having such difficulties writing triggerless commands?  Think of it this way: In the event that you're expecting a triggerless command (perhaps on a whisper) then assume that they didn't provide a trigger and go as you normally would and remove trigger handling.
January 22, 2005, 5:14 AM

Search