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.
Entire forum
➜ MUSHclient
➜ General
➜ Trigger help
You need to log onto the forum to reply or create new threads.
Refresh page
Posted by
| Williamb
(3 posts) Bio
|
Date
| Mon 28 Oct 2024 09:36 PM (UTC) |
Message
| In my Mud we have the "*" symbol to identify those not in my Kingdom.
For example:
*NEWBIE aratar from Tier*
*Duke Althalus*
I'm trying to have a trigger that when I'm locating items i can say or tell who is holding that item.
Example:
A green Ring of Protection is carried by *Baron Sieyl*
trigger
tell Baron Sieyl "How much for your green Ring of Protection" | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Tue 29 Oct 2024 04:16 AM (UTC) |
Message
| Is it always going to be "A green Ring of Protection" or will it be more general than that? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Williamb
(3 posts) Bio
|
Date
| Reply #2 on Tue 29 Oct 2024 10:10 PM (UTC) |
Message
| More general. Went with that because the items can be one word or multiple, and wanted to cover a few bases. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #3 on Wed 30 Oct 2024 05:58 AM (UTC) |
Message
| I have a number of tutorials and videos about scripting and making triggers, for example:
http://www.gammon.com.au/forum/?id=9626
Please show what you have done so far, and explain in what way it is not working. To show your existing trigger see this:
|
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Williamb
(3 posts) Bio
|
Date
| Reply #4 on Wed 30 Oct 2024 10:29 PM (UTC) |
Message
| <triggers>
<trigger
match="^(.*?) is carried by *(.*?)*"
regexp="y"
sequence="100"
>
<send>gtell %3 Are you wanting to sell your %1 </send>
</trigger>
</triggers>
The main issues i'm having is the * Surrounding the name, the fact they have titles, and the multi word usage. Watched most of your tutorials on it, but haven't seen anything that can fix this issue. Thank you too! | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #5 on Thu 31 Oct 2024 08:12 PM (UTC) |
Message
| First, your trigger wasn't enabled. Second, as I explain in my page about regular expressions, if you want to match on an asterisk itself you have to put a backslash around it, like this:
<triggers>
<trigger
enabled="y"
match="^(.*?) is carried by \*(.*?)\*$"
regexp="y"
sequence="100"
>
<send>gtell %3 Are you wanting to sell your %1 </send>
</trigger>
</triggers>
|
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
|
Regular expressions
- Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
- Also see how Lua string matching patterns work, as documented on the Lua string.find page.
|
|
- 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.
586 views.
You need to log onto the forum to reply or create new threads.
Refresh page
top