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
➜ Lua
➜ Script Defined Variables as Triggers
Script Defined Variables as Triggers
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Noredil
(4 posts) Bio
|
Date
| Tue 12 Feb 2008 04:50 PM (UTC) |
Message
| I've been attempting to make a trigger that fires when it sees one of the values stored in an array. I've been able to do this by declaring inline variables in the XML, but have not been able to get it to fire when the variables are defined in the associated .lua file.
For example...
<trigger
enabled="y"
expand_variables="y"
keep_evaluating="y"
repeat="y"
custom_colour="17"
group="colors"
ignore_case="y"
match="\b(@!tester)\b"
regexp="y"
script="fired"
sequence="100"
other_text_colour="maroon"
other_back_colour="white"
>
</trigger>
This trigger will fire when any of the values in this inline declaration are seen (one, two, or three)
<variables>
<variable name="tester">one|two|three</variable>
</variables>
However, this XML file calls a .lua file from the <script> section, in which all my scripts and other variables are handled.
when I create a variable there such as this:
tester = {one, two, three}
This trigger will not fire. What am I missing? I'd prefer to have all the variables in one place, and accessible by my scripts. | Top |
|
Posted by
| Ian Kirker
(30 posts) Bio
|
Date
| Reply #1 on Tue 12 Feb 2008 05:24 PM (UTC) |
Message
| MUSHClient variables are not linked to variables you define in a script file - you have to use the scripting functions GetVariable and SetVariable to retrieve MUSHClient variables from a script.
There is a nifty thing you can do with metatables, though, where you define a table that 'contains' all the MUSHClient variables by virtue of using the aforementioned functions to retrieve the value any time you use it's pseudonym and setting the value where ever you assign one.
More details (and cut/paste code) can be found here:
http://www.gammon.com.au/forum/?id=4904
| 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.
12,225 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top