Trigger help

Posted by Williamb on Mon 28 Oct 2024 09:36 PM — 6 posts, 10,197 views.

#0
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"
Australia Forum Administrator #1
Is it always going to be "A green Ring of Protection" or will it be more general than that?
#2
More general. Went with that because the items can be one word or multiple, and wanted to cover a few bases.
Australia Forum Administrator #3
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:

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.
#4
<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!
Australia Forum Administrator #5
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>


Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.


Template:regexp
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.