Spell Bot issue

Posted by Chylde on Thu 10 Mar 2005 11:43 PM — 2 posts, 10,834 views.

#0
I have been trying to get some vbscript code to work, and being a newbie at vbscript am unsure why. I remember some VB6, but I havent kept my skills up to date, as it was for a class in college a few years back.
What I am trying to do, is if somebody in a group asks for a spell, I will cast that spell on them. I have no problem with doing that, but I wanted to expand the trigger and check to see if I am sleeping, and if I am, cause me to wake up and cast the spell.

The code I currently have is this:


Pattern to fire:

* tells the group, 'sanc*

Commands if sleep = true then wake cast sancuary %1 gt $1 Sanctified else cast sancuary %1 gt $1 Sanctified endif


I know the code is crude and simple, and possibly just wrong, but any help would be much appreciated.
Amended on Thu 10 Mar 2005 11:49 PM by Chylde
USA #1
End if is two words.
You'll use %1 for all three, not $1.

And, since this is end the scripting environment, you'll need to use send to send things to the mud (VBScript doesn't know what to do with 'wake' for instance).

So that will be:

if sleep = true then
send "wake"
send "cast sancuary %1"
send "gt $1 Sanctified"
else
send "cast sancuary %1"
send "gt %1 Sanctified"
end if

True however, well, it depends on what youre using. If youre setting a variable (sleep) to "true" then that will work (except you'll need to use getvariable("sleep") instead of just sleep) however they 'true' keyword is "VBTrue", which you might as well use any non-zero integer (VBTrue technically is -1 though, false is 0) most of us use 1 and 0 though (1 still evaluates to true since its non zero).

And of course, this is inside the trigger's "send" box (with 'send to' set to script).

For VBScript syntax, I suggest you download the VBScript docs (Mushclient forum > Script Functions > Script Engines you can Download > Help files (third one down))
It's helpful since you can look up the exact syntax of whatever (as well as get a list of all the commands grouped alphabetically as well as by topic).

As for the mushclient commands, scroll back up to the top of the page and click the Alphabetic list of script functions. Peruse over them to get a feel for what MC has to offer script wise. And then read the help file (the new one, or the online one) about triggers/aliases/etc (the big topics, since they also delve into how triggers work with scripts and such).