[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Scripts and VBS file..
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Scripts and VBS file..

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Abas   (6 posts)  [Biography] 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?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Abas   (6 posts)  [Biography] 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
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (21,321 posts)  [Biography] 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
[Go to top] 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.


5,562 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]