|
foldar Novice
Joined: 21 May 2020 Posts: 33 Location: The Netherlands
|
Posted: Mon Jun 28, 2021 3:48 am
How do I create a trigger with the #TRIGGER command using a variable in it? |
How do I create a trigger with the #TRIGGER command using a variable in it?
Like #TRIGGER MobAttack {@OpponentName %w (%w)} {tank=%1} does not work
It doesnt evaluate the @opponentName it puts it in as straight text.
There is no way to know @opponentName in advance, it is different every time.
So if you are fighting a mouse it should make the trigger a mouse %w (%w)
not @OpponentName %w (%w) like it does.
%1 (%w) would be worse. that matches almost every line. (may be slow)
Though I could see if %1 starts with @opponentname then.
a mouse hits Jane --> tank is Jane |
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: Mon Jun 28, 2021 6:59 pm |
is this just to track who is the active tank?
I don't think you can parse/eval the variable in the trigger itself. You can set a variable using '&{tank}' in place of the players name.
#TR {a &{monster} %w &{tank}} {} would write to the two variables @monster @tank their respective pattern matches, but you run the risk of a broad match without more definition to the pattern.
#REG {^a (\w) (?:hit|hits) (\w).} {monster = %1;tank = %2} (don't have client available to syntax check but something along those lines would work) |
|
|
|
hpoonis2010 Adept
Joined: 18 Jun 2019 Posts: 279
|
Posted: Thu Jul 01, 2021 7:25 am |
You can test against a variable in a trigger if you enclose it in {}
#TRIGGER MobAttack {{@OpponentName} %w (%w)} {tank=%1} |
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: Fri Jul 02, 2021 10:56 am |
I stand corrected and TIL
|
|
|
|
|
|