|
Mozzie Beginner
Joined: 24 Nov 2006 Posts: 17
|
Posted: Tue Dec 12, 2006 5:16 pm
trigger problem - two very similar triggers only one firing |
Depending on what effects I am under I can see the WHO list in a couple of different ways. I am trying to setup a couple of mxp menus on the information contained in the who. The persons name (always there) and their location (sometimes there).
This first trigger is enabled it will do the persons name all the time, however the second trigger will never fire
Laon - Jack of all trades.
#TRIGGER {^(%s)(%w) - (*) $} {#sub {"%1"<send "who %2|farsee %2|cast scry at %2|embed sonicportal at %2|touch prism %2|touch brazier %2|#sa Target: @targ(%2)" "Who|Farsee|Scry|Portal|Prism|Brazier|target">%2</send> - %3}} "who|wholist" {notrig}
This second trigger will work if I have the location information and the first trigger is disabled.
Laon - Path between open market (742) - Village of Transk.
#TRIGGER {^(%s)(%w) - (*) ~((*)~)? - (*)$} {#sub {"%1"<send "who %2|farsee %2|cast scry at %2|embed sonicportal at %2|touch prism %2|touch brazier %2|#sa Target: @targ(%2)" "Who|Farsee|Scry|Portal|Prism|Brazier|target">%2</send> - %3 (<send "go %4" "Whyte go ">%4</send>) - %5}} "who|wholist"
There is also a third condition where I have the location but I don't have that location mapped.
Kanthari - In a corner of a ruined - (unknown)
What I have been trying to do all day is write a trigger that can handle all these strings.
Any help would be greatly appreciated. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 12, 2006 5:49 pm |
The problem is that the first trigger matches the second pattern too. (*) will match "(*) ~((*)~)? - (*)" as well, so the first trigger is always firing. That's why the second one won't go off.
What you're going to have to do is use ONLY the first trigger, but do some processing on the contents of the last wildcard to determine which of the variants it is. There are many different ways to do it - using %replace to change spaces into string separators | and then using %numitems or %ismember to check for different things, for example. |
|
|
|
Mozzie Beginner
Joined: 24 Nov 2006 Posts: 17
|
Posted: Tue Dec 12, 2006 7:59 pm |
I have resolved the problem with
#TRIGGER {^(%s)(%w) - (*)$} {#sub {"%1"<send "who %2|farsee %2|cast scry at %2|embed sonicportal at %2|touch prism %2|touch brazier %2|#sa Target: @targ(%2)" "Who|Farsee|Scry|Portal|Prism|Brazier|target">%ansi(cyan)%2</send> - %3}} "who|wholist" {notrig}
#COND {^(%s)(%w) - (*) ~((*)~) - (*)$} {#sub {"%1"<send "who %2|farsee %2|cast scry at %2|embed sonicportal at %2|touch prism %2|touch brazier %2|#sa Target: @targ(%2)" "Who|Farsee|Scry|Portal|Prism|Brazier|target">%ansi(cyan)%2</send> - %3 ~(<send "go %4|#sa Test shot %4" "Whyte go|Test">%ansi(green)%4</send>~) - %5}} {reparse}
I added the colours in becuase #sub loses colour information and I like my colours. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Dec 12, 2006 8:51 pm |
You could also use the <color> MXP tag since you're using MXP anyway. I wasn't sure if using a Reparse state would work because it'd require the new MXP to overwrite the old MXP. Nice to hear that it does work after all :)
|
|
|
|
Mozzie Beginner
Joined: 24 Nov 2006 Posts: 17
|
Posted: Tue Dec 12, 2006 10:33 pm |
Thanks for the help,
I tend to swap between %ansi and <color depending on how the mood strikes me, I really should pick one and stick to it. |
|
|
|
|
|