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
➜ Tips and tricks
➜ triggers and a few questions
triggers and a few questions
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Zack
(23 posts) Bio
|
Date
| Fri 24 Dec 2010 09:40 AM (UTC) |
Message
| Hello, I'm trying to get a trigger to send back a number from a list. Heres the following text. Generic store menu.
[1] Silver blood crafted dagger
[2] soul snatching gloves
[3] torch of flame
[4] chaos butterfly
Ok so I want to buy 4 so I have the trigger match chaos butterfly cuz I always want to buy that. So I put %1 chaos butterfly. In the send box I put%1 because the store has a menu system where you just do buy then it brings up the options so I want it to insert the number of chaos butterfly. It changes so how can I do this? If you need clarification let me know. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sat 25 Dec 2010 07:00 AM (UTC) |
Message
| It would look something like this. First an alias to do the "list" command to get the shop goods, which also enables the trigger to match on "chaos butterfly":
<aliases>
<alias
match="buy chaos"
enabled="y"
send_to="12"
sequence="100"
>
<send>
Send ("list")
EnableTrigger ( "chaos_butterfly_trigger", true )
</send>
</alias>
</aliases>
Then a trigger to match on the list, find which number it was, and buy that one. Then it disables itself so it doesn't keep matching if you are trying to buy something else.
<triggers>
<trigger
match="^\[(\d+)\] chaos butterfly$"
name="chaos_butterfly_trigger"
regexp="y"
send_to="12"
sequence="100"
>
<send>
Send ("buy %1")
EnableTrigger ( "chaos_butterfly_trigger", false)
</send>
</trigger>
</triggers>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
You may need to amend the trigger slightly if you had more spaces than you showed in your post (or chaos butterfly had caps in it or something). Triggers match on exact text, not approximate text. |
- 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.
11,346 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top