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 store information on variables and how to use them
how to store information on variables and how to use them
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Zygote
(4 posts) Bio
|
Date
| Thu 26 Sep 2002 06:03 PM (UTC) |
Message
| A black * lies here.
I want to store %1 to a variable 'target'.
I want an alias 'k' to send the message kill <target> to the mud.
How do i do this? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #1 on Thu 26 Sep 2002 11:06 PM (UTC) |
Message
|
Quote:
Message
A black * lies here.
I want to store %1 to a variable 'target'.
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="A black * lies here."
name="target"
send_to="9"
sequence="100"
>
<send>%1</send>
</trigger>
</triggers>
Quote:
I want an alias 'k' to send the message kill <target> to the mud.
<aliases>
<alias
match="k"
enabled="y"
expand_variables="y"
>
<send>kill @target
</send>
</alias>
</aliases>
You can select the examples above, and copy and paste them into the triggers/aliases configuration windows.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zygote
(4 posts) Bio
|
Date
| Reply #2 on Fri 27 Sep 2002 08:07 AM (UTC) |
Message
| Ok its works, but i how to make that variable so that multiple triggers can refer to it?
So that different triggers would save their info in it and you could use the latest content with the 'k' alias. | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #3 on Fri 27 Sep 2002 09:28 PM (UTC) |
Message
| The simple approach is to stick with one trigger and use a regular expression to match on more than one thing, then the basic idea still works. For example:
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="^A (?:black )?(.*?) (lies here|attacks you|lunges for you)\.$"
name="target"
regexp="y"
send_to="9"
sequence="100"
>
<send>%1</send>
</trigger>
</triggers>
This would match on:
A black something lies here.
A black something lunges for you.
A black something attacks you.
A something attacks you.
However if that won't work have multiple triggers call a simple script, like this:
<triggers>
<trigger
custom_colour="2"
enabled="y"
match="A black * lies here."
script="SetTargetVariable"
sequence="100"
>
</trigger>
</triggers>
Then add a script to your script file, or make a separate script file, like this:
sub SetTargetVariable (sName, sLine, wildcards)
world.SetVariable "target", wildcards (1)
end sub
This script sets the variable "target" to the contents of the first wildcard. You can then have lots of triggers like the above that call the same script. Make sure you enable scripting (language VBscript) and select that file as your script file. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zygote
(4 posts) Bio
|
Date
| Reply #4 on Wed 02 Oct 2002 08:51 AM (UTC) |
Message
| it complains like this when it to that scripting section:
the following erros were encountered when attempting to link to script subroutines. The missing subroutines will not be called.
There was a problem in script file "U:\mush\scripts\settargetvariable.vbs":
The trigger subroutine named "target" could not be found.
I probably messed something up. Is this even the right place to put it? | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) Bio
Forum Administrator |
Date
| Reply #5 on Fri 04 Oct 2002 12:55 AM (UTC) |
Message
| Did you copy and paste the exact trigger from above? The script can be in an file name, as long as the file name is that set in the scripting configuration tab.
|
- 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.
15,225 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top