|
Klion Newbie
Joined: 12 Nov 2013 Posts: 2
|
Posted: Tue Nov 12, 2013 11:58 pm
Waitfor/cond, only backwards |
Trying to make a trigger which does something UNLESS it sees a (certain) line immediately after it. Right now I am using #waitfor, but the line in question would always be immediately after the trigger's pattern. Initially i tried to do it with condition, but I couldn't find a syntax to make it work for the logic I want. within|param= seemed close, but i could only execute the command if the second pattern was found, I need it to go off if the second pattern is NOT found
Basically
if (pattern 1 is found)
{
if (pattern 2 is right after pattern1)
{nothing}
else {command}
This is how I did it with waitfor, but I do not like using waitfor when its always the next line, and I am certain there is a better way.
<trigger priority="1060" id="106">
<pattern>*suddenly attacks ({@RescTargs})!</pattern>
<value>#Waitfor {(%w) bravely steps in front of (%1), shielding him from harm!}
90 {}
{
#IF (%ismember(%1,ToRescue)) {} {ToRescue = %push(%1,ToRescue)}
#if (@AutoRescue = 1) {resc %pop(ToRescue)
#ECHO RESCING WHOEVER NOW
}
}
</value>
</trigger>
Thanks for any tips,
-Kli |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Wed Nov 13, 2013 12:45 am |
Use a second state within 1 line like you said, but make the pattern ^(*)$ to capture the next line whatever it is, then check if it matches whatever you want in the code.
|
|
|
|
Klion Newbie
Joined: 12 Nov 2013 Posts: 2
|
Posted: Wed Nov 13, 2013 1:15 am |
Hrm, thats a good idea but the next line would be ^(%w) bravely steps in front of (%1), shielding him from harm!$
so I'd have to do a bit of work to break the string down in various ways to see if it matches since the variable portions will change, which i think is kind of a pain. Is there really no simpler method available? :/ |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: Wed Nov 13, 2013 3:30 am |
This should do it:
Code: |
#if (!%match(%1, %concat("^(%w) bravely steps in front of (", %t1, "), shielding him from harm!$"), $player)) {
#IF (!%ismember(%t1,ToRescue)) {ToRescue = %push(%t1,ToRescue)}
#if (@AutoRescue = 1) {
resc %pop(ToRescue)
#ECHO RESCING WHOEVER NOW
}
} |
|
|
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|