|
Question about stored variables
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Fraust
(5 posts) bio
|
| Date |
Sun 19 Jul 2009 11:49 PM (UTC) [ quote
] |
| Message |
Still battling my way through Mushclient from Zmud. Here is my latest problem that I need help with.
I have the follow trigger pattern:
^(?P<location>.*?) \[(?P<dirs>.*?)\]\.
I use this in Zmud to capture the room I'm in and the exits available.
An example of the mud output could be:
Second Level of the Inner Sanctum [e,w,u,d].
How do I go about making these a stored variable, so that when someone on my guild channel fires our location trigger I can just spit back
<channel> I am currently at %<location> with exits: %<dirs>
All your help is appreciated!
Fraust. | top |
|
| Posted by |
Nick Gammon
Australia (18,770 posts) bio
Forum Administrator |
| Date |
Reply #1 on Mon 20 Jul 2009 12:05 AM (UTC) [ quote
] |
| Message |
Have you read the page: http://mushclient.com/scripting ?
Anyway, there are a few ways of doing this - with Lua variables or MUSHclient internal world variables. Probably slightly simpler is to use Lua (script) variables, as your location changes so often it doesn't need to be saved as part of your world file.
Below are two triggers that accomplish what you wanted. The first one matches the location information, and simply saves the wildcards into the script variables location and dirs.
The second one, currently set to trigger on "<someone> chats, where are you?" simply chats back with the locations inserted into the message. The ".." operator in Lua concatenates strings together.
To put these examples back into the client, see: http://mushclient.com/pasting
<triggers>
<trigger
enabled="y"
match="^(?P<location>.*?) \[(?P<dirs>.*?)\]\."
regexp="y"
send_to="12"
sequence="100"
>
<send>
location = "%<location>"
dirs = "%<dirs>"
</send>
</trigger>
<trigger
enabled="y"
match="* chats, where are you?"
send_to="12"
sequence="100"
>
<send>
Send ("chat I am currently at " .. location .. " with exits: " .. dirs)
</send>
</trigger>
</triggers>
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | top |
|
| Posted by |
Fraust
(5 posts) bio
|
| Date |
Reply #2 on Mon 20 Jul 2009 12:30 AM (UTC) [ quote
] |
| Message |
| Thank you for your help Nick. I am actually reading the scripting link that you posted now. Just got to the variable section! It is definitely helping me understand things a little more. | 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.
846 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )