Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Scripts and VBS file..
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Abas
(6 posts) Bio
|
Date
| Sat 04 Sep 2004 02:47 AM (UTC) |
Message
| Ok. Do I need 1 VBS file for every script I have or can I put all my Scripts or groups of scripts in one VBS file?
If I can store multiple scripts in one VBS file, then how do I access/call a particular script with a trigger?
What does the Label: field and Squence mean in the Trigger setup menu? | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #1 on Sat 04 Sep 2004 06:53 AM (UTC) |
Message
| You can have one script for all your worlds, or one per world.
You have one Subroutine per trigger (or at least, each trigger calls a routine, it doesnt have to be 1 to 1).
You access the subroutines in your script file with the "script" box. You would put the name of the routine there. And it passes three values, the name of the trigger, the line, and an array of the wildcards.
so your sub would look something like this:
sub RoutineName (sName, sLine, aryWild)
'stuff goes here
end sub
And then to call that trigger, you would put RoutineName in the "script" box.
You CAN also for smaller more specific script pieces, put them in the 'send' box of your trigger/alias, and then change the 'send to' box to "script". It eliminates the need for a script file for the most part (there are some exceptions) and allows you to keep your code together, and more modular.
Label is a way to label the trigger (for things like getting and setting values, like enabling/disabling), and Sequence is the sequence that theyre evaluated in. Lower numbers are evaluated first.
So you could make a trigger with seq of 1, for something, and have it not have "keep evaluating" checked, and then in effect, turn off all the other triggers for that specific line.
|
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Abas
(6 posts) Bio
|
Date
| Reply #2 on Sun 05 Sep 2004 03:31 AM (UTC) Amended on Sun 05 Sep 2004 03:51 AM (UTC) by Abas
|
Message
| "sub RoutineName (sName, sLine, aryWild)
'stuff goes here
end sub"
sName: Name of the trigger? I don't remember setting a names for triggers when I make them. Is this variable for MUSHclient use only and we don't have to worry about it?
What is sLine? What is it used for?
"You CAN also for smaller more specific script pieces, put them in the 'send' box of your trigger/alias, and then change the 'send to' box to "script"."
What type of simple scripts can do in the Send box of Triggers/Alias? If I do these simple scripts in the Send box then I don't need to put a
name in SendTo ->Script box?
Can a Trigger send value to 2 variables with SendTo:Variable?
OH, how do I make MUSHclient make a few simple sounds when certain things triggered?
Sorry for all these questions, I am still a newbie. :)
Thanks | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Sun 05 Sep 2004 05:12 AM (UTC) |
Message
| To play a sound, there is a "sound" option in the center of the trigger menu. Just find the sound.
No, you cant send to two variables at the same time.
You'll have to use Scripting.
Which brings us to our next topic,
Send To Script.
You can actually put ANY script into the sendto box, but more complex ones can become problematic, but not nessisarily. If youre reusing your code, youre better off putting it in the script file.
But, to set two variables:
Send to Script, then in the send box:
SetVariable "variable1name", "%1"
SetVariable "variable2name", "%1"
will set %1 to both the variables (you can set two values, or whatever). Like %1 and %2 to their respective variables.
MC calls the sub with three arguements passed, the first (sName in my example) is the trigger name, in string format (thats what the s is for), the second is the line matched (the whole line), and the third is an array of the wildcards.
Its not for MC to use, MC doesnt care. You CAN use it (name each trigger differently, then you could check to see which trigger you matched on if you have more than one trigger using a subroutine, or whatnot)
But no, you dont need to worry about them if you dont need them (the line is the same way, since MC used to only pass 9 wildcard values, so if you needed more, youd have to parse scriptside). |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #4 on Sun 05 Sep 2004 05:45 AM (UTC) |
Message
| The name of the trigger is the "label" field when you enter it. It is so you can tell which trigger fired if more than one shares the same script routine.
The line is the matching line, in case you want the whole line that caused the trigger to fire.
The sequence is the order in which triggers are tested, the lower the earlier.
Quote:
MC used to only pass 9 wildcard values, so if you needed more, youd have to parse scriptside
If you use "send to script" you can access more than 9 wildcards (which would be pretty unusual) by using something like %<15> as a wildcard substitution in the "send" box. Or, use named wildcards, to keep your sanity.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
17,493 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top