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
➜ How to use world.getTrigger(), world.getAlias()
How to use world.getTrigger(), world.getAlias()
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Unregistered user
(72 posts) Bio
|
Date
| Mon 24 Jul 2000 (UTC) |
Message
| How does one use the function mentioned above? A simple example which first defines a trigger and then retrieves its details with getTrigger would be nice.
Thanks
- skj | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 24 Jul 2000 02:25 AM (UTC) |
Message
| There are a lot of examples for doing these things in the web page: http://www.gammon.com.au/mushclient/functions.htm
Triggers
Here is an example of adding a trigger:
/World.addtrigger "monster", "* attacks", "flee", 1, 14, 0, "", ""
Now to get it back ...
/world.gettrigger "monster", trmatch, trresponse, trflags, trcolour, trwildcard, trsoundfilename, trscriptname
Display some of its values ...
/world.note trmatch
/world.note trresponse
These examples are in VBscript, the JScript ones will be very similar.
Aliases
Add an alias ...
/world.addalias "teleport_alias", "teleport", "@tel #1234", 1, ""
Now get it back ...
/world.getalias "teleport_alias", almatch, alresponse, alparameter, alflags, alscriptname
Display some of its values ...
/world.note almatch
/world.note alresponse
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Unregistered user
(72 posts) Bio
|
Date
| Reply #2 on Mon 24 Jul 2000 10:41 AM (UTC) |
Message
| function alias( aid, output, wildcards )
{
if ((lst = world.getAliasList()) != null)
{
lst = new VBArray(lst).toArray();
var amatch, aresponse, aparam, aflags, afunc;
for (i=0;i<lst.length;++i)
{
world.getAlias(
lst , amatch,aresponse,aparam,aflags, afunc
// what's this parameter thing anyway (aparam)?
// it's not explained in any of the docs I've
// read, and the addAlias function doesn't
// take such an argument, although according to
// the documentation it should
);
world.note(
lst[ i ] + " =
\"" + amatch + "\",
\"" + aresponse + "\",
" + afunc
);
}
}
}
// Thanks for your quick response Mr Gammon
- skj | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Tue 25 Jul 2000 (UTC) |
Message
| Well, for a start the line:
world.getAlias
(lst, amatch, aresponse, aparam, aflags, afunc);
should read ...
world.getAlias
(lst [i] , amatch, aresponse, aparam, aflags, afunc);
because you want to get the information for alias "i" from the list.
(I suspect you keyed in the [i] however the forum interprets [i] as an EzCode for italic.).
However, I am still having problems getting this to work - it seems to work in VBscript, however I get a "type mismatch" in JScript.
I will research this and post another reply in the forum ASAP.
Parameter
The argument "aparam" is a throwback to earlier versions of MUSHclient, where aliases only supported a single "parameter" rather than wildcards like it does today.
However, to be consistent with older scripts, the argument "aparam" has been left in. It doesn't do anything any more. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Unregistered user
(72 posts) Bio
|
Date
| Reply #4 on Wed 26 Jul 2000 (UTC) |
Message
| I thought as much. I suppose I might as well use VBScript, it's just that I hate the syntax.
- skj | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Sun 30 Jul 2000 (UTC) |
Message
| For reasons that are a bit obscure to me, GetAlias and GetTrigger do not work when called from JScript or PerlScript.
Thus, I have added two new routines, which will appear in version 3.02 - GetAliasInfo and GetTriggerInfo.
These return information about the alias/trigger, using different syntax that does work in any scripting language.
For instance, here is how you would get what a trigger matches on, in JScript:
world.note(world.gettriggerinfo ("monster", 2));
See the web page http://www.gammon.com.au/mushclient/functions.htm for more details.
|
- 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.
19,081 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top