Setting variables in Triggers

Posted by Calicoxx on Sat 02 Jul 2011 08:14 AM — 9 posts, 38,490 views.

#0
Hey, I need some help in setting up a trigger that includes variables, which I'm not too great at.


<triggers>
  <trigger
   enabled="y"
   expand_variables="y"
   match="@target *uub*bless*"
   regexp="y"
   sequence="100"
  >
  <send>foc 'bless' @target</send>
  </trigger>
</triggers>


I used that, which I copied from the FAQ and edited to work in my MUD. I copied it using the copy key on the trigger menu.

What I'm trying to do is make it so when any target says my name and bless, it will target them and bless them. It seemed fairly simple, but I am having a very hard time getting it to work. It doesn't fire at all, and I'm not handy with triggers like this, so I was wondering if someone here could take a look at it and diagnose my problem.
USA #1
Could you please paste an example of the line you're trying to trigger on from the MUD?

[EDIT]: Oh, wait. You should probably remove the regexp="y" ("Regular expression" option in the trigger dialog). That pattern there doesn't appear to be a regular expression.
Amended on Sat 02 Jul 2011 08:17 AM by Twisol
Australia Forum Administrator #2
This doesn't look like a regular expression to me:


match="@target *uub*bless*"


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.
Australia Forum Administrator #3
Twisol said:

Oh, wait. You should probably remove the regexp="y" ("Regular expression" option in the trigger dialog).


What he said.
#4
Removed the regexp, still doesn't fire off.
Example: Vajen says, 'uub bless'
#5
Thanks Gammon! Works like a charm! :)
Australia Forum Administrator #6
What is the "target" variable set to? Or do you want it to work for anyone who says it?
#7
I would like it to work for anyone who says it.
Australia Forum Administrator #8
You want something more like this then:


<triggers>
  <trigger
   enabled="y"
   match="* says, 'uub bless'"
   sequence="100"
  >
  <send>foc 'bless' %1</send>
  </trigger>
</triggers>


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