• Welcome to Valhalla Legends Archive.
 

Help pls

Started by Sanskrit!, January 15, 2005, 01:16 AM

Previous topic - Next topic

Sanskrit!

How would you write a triggerless command?

MyndFyre

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.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Sanskrit!

Visual basic 6, and how about access checking? :o

Kp

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.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Sanskrit!

How would you write it in vb6?

Kp

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.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Mephisto

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!

Sanskrit!

Still doesn't answer the question!

Blaze


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



This Command Displays the trigger for people who do not know it.
Quote
Mitosis: Haha, Im great arent I!
hismajesty[yL]: No

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.