MUSHclient: Variables in triggers

by Nyanco

Back to Mechanic's Corner.

Nyanco2005-05-02 10:33:07
I'm trying to do a targeting trigger to match the output from info here and set the creatures listed in a variable as target.
I started with a trigger like this:
CODE

    custom_colour="7"
  expand_variables="y"
  group="targeting"
  match="\\"((rockeater|moose|shark|leech|starsucker)(.*?))\\"(?! *a golden dragon turtle)"
  regexp="y"
  send_to="12"
  sequence="100"
 >
 Execute("settar %1")
EnableTriggerGroup("targeting", 0)
Note("-= TARGET OK =-")
 

 

It works fine. (The last part of the match is for avoiding my own turtle)
Then I did a variable:
CODE

 rockeater|moose|shark|leech|starsucker

and changed the trigger line to:
CODE
match="\\"((@target_hunting)(.*?))\\"(?! *a golden dragon turtle)"

In this case it didn't match anything. It works only if there is a single name in the variable, as if it doesn't evalutate the | character.

Am I missing something?
Thanks in advance for any suggestion about it.
Unknown2005-05-02 12:06:35
Yes. You're missing the "Expand variables" option.
Nyanco2005-05-02 12:34:59
QUOTE(Zarquan @ May 2 2005, 02:06 PM)
Yes. You're missing the "Expand variables" option.
111804


I think it's enabled.
In the trigger window I've checked "Regular expression" and "Expand variables".
Unknown2005-05-02 13:11:01
When using a variable to match a list like this, you need to put ! in between the @ and variable name, to force proper expansion.
Nyanco2005-05-02 13:23:38
Now it works fine.
Thanks a lot Zarquan. smile.gif