Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: Sanskrit! on January 15, 2005, 01:16 AM

Title: Help pls
Post by: Sanskrit! on January 15, 2005, 01:16 AM
How would you write a triggerless command?
Title: Re: Help pls
Post by: MyndFyre on January 15, 2005, 02:11 AM
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):

if (strCmd equals concat(strTrigger, "somecommand"))

modified (pseudocode):

if (strCmd equals "somecommand")


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:

if (strCmd.characterAt(0) == strTrigger)

modified:

if (strCmd.characterAt(0) == strTrigger)
then
' do something
else if (strCmd == "sometriggerlesscommand")
then
' do something differently.
end if

I mean....  really, if you have much grasp of programming, it shouldn't be that hard to figure out.
Title: Re: Help pls
Post by: Sanskrit! on January 15, 2005, 01:38 PM
Visual basic 6, and how about access checking? :o
Title: Re: Help pls
Post by: Kp on January 15, 2005, 01:42 PM
Access checking is easy.

Pseudocode:
a = get_access(user)
if (permOK(a, ThisCommand)) then
    do command
end if
I'd suggest not producing any output on denied commands, as that opens the bot to Denial-of-Service attacks.
Title: Re: Help pls
Post by: Sanskrit! on January 20, 2005, 01:02 PM
How would you write it in vb6?
Title: Re: Help pls
Post by: Kp on January 20, 2005, 05:25 PM
Quote from: Sanskrit! on January 20, 2005, 01:02 PMHow would you write it in vb6?

I wouldn't.  VB6 is a horrible language and should not be used for anything.  It doesn't even support unsigned 32bit integers.
Title: Re: Help pls
Post by: Mephisto on January 21, 2005, 07:32 PM
Quote from: Kp on January 20, 2005, 05:25 PM
Quote from: Sanskrit! on January 20, 2005, 01:02 PMHow would you write it in vb6?

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

Like Java!
Title: Re: Help pls
Post by: Sanskrit! on January 21, 2005, 10:41 PM
Still doesn't answer the question!
Title: Re: Help pls
Post by: Blaze on January 21, 2005, 11:08 PM

If Left(LCase(Message),7) = "trigger" Then
         'Show The Trigger
End If



This Command Displays the trigger for people who do not know it.
Title: Re: Help pls
Post by: Mephisto on January 21, 2005, 11:14 PM
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.