|
zyran Beginner
Joined: 16 Apr 2003 Posts: 17 Location: USA
|
Posted: Fri Jun 13, 2003 3:22 pm
wildcards in script? |
I want to trigger lines with a specific word in them and capture the text so I can test the text around it. So if the word was zmud for example I do.
#trigger {^(*) zmud (*).} {
#if ((%concat( %1 zmud %2)!= "blah blah zmud blah") | (%concat( %1 zmud %2) != (somenumber) zmud blah)) {#show nope} {#show yup}
and this is where my problem is. The text that comes out could be a any number so I was wandering if there's a something I can put where (somenumber) is a type of wildcard I could put there? |
|
|
|
zyran Beginner
Joined: 16 Apr 2003 Posts: 17 Location: USA
|
Posted: Fri Jun 13, 2003 3:37 pm |
um...nevermind...%3 can do it sorry
|
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jun 13, 2003 4:12 pm |
It would be easier to discuss this intelligently if you used the actual words/numbers/values you're trying to match instead of "zmud", "blah", and "somenumber".
%d and %n are wildcards for numbers, but they would be used in the trigger pattern.
You've only marked two sections of the pattern for use as numbered parameters, therefore you don't have a %3.
Since "%1 zmud %2" can't be equal to two different strings at the same time, it will always be NOT EQUAL to one of these two strings. Since you've used OR, that means the expression will ALWAYS evaluate to true, so the entire trigger can be reduced to:
#TR {* zmud *.} {#SHOW nope}
You probably meant to use AND.
For a working trigger, try:
#TR {^(*) zmud (*).} {#IF ((("%1" != "blah blah") AND !%isnumber( %1)) OR ("%2" != "blah")) {#SHOW nope} {#SHOW yup}}
Better still, test for equals instead of not equals:
#TR {^(*) zmud (*).} {#IF ((("%1" = "blah blah") OR %isnumber( %1)) AND ("%2" = "blah")) {#SHOW yup} {#SHOW nope}}
LightBulb
Advanced Member |
|
|
|
zyran Beginner
Joined: 16 Apr 2003 Posts: 17 Location: USA
|
Posted: Fri Jun 13, 2003 4:26 pm |
ok here's a couple messages:
You remove 1 goldenseal root, bringing the total in the Rift to 8.
You eat a goldenseal root.
Zugg eats a goldenseal root.
You make a funny face at a goldenseal root.
so...
#trigger {(*) goldenseal (*).} {
#if ((%concat( %1 goldenseal %2)!= "You eat a goldenseal root") or (%concat( %1 goldenseal %2) !="You remove %3 goldenseal root~, bringing the total in the Rift to %3")) {
#var stupid 1
}
}
so %3 doesn't have a value and any number could be used in the %3 spots and what do you mean by %1 and %2 can't equal two different strings? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Fri Jun 13, 2003 5:07 pm |
%3 doesn't exist. It's meaningless. It's not a number. It's not a string. It's not anything. It doesn't exist.
"what do you mean by %1 and %2 can't equal two different strings?"
Your #IF expression compares the trigger pattern to two different strings. It might be equal to one of them, but it can't be equal to both of them. Therefore, it will always be NOT EQUAL to at least one of them.
Since you used != (NOT EQUAL) as your comparison, at least one part of the expression will always be TRUE.
Since you used OR to join the two parts, and OR is true whenever ANY part is true, the expression is always TRUE.
To take one example:
You eat a goldenseal root.
This is EQUAL to "You eat a goldenseal root", so the first part of your expression will be FALSE
but it's NOT EQUAL to "You remove %3 goldenseal root~, bringing the total in the Rift to %3", so the second part of the expression will be TRUE.
#IF (false OR true)
Since OR only requires one TRUE value, this is TRUE.
Here's a trigger that should do what you want:
#TR {^(*) goldenseal (*).} {#IF ((("%1" = "You eat a") AND ("%2" = "root")) OR (%begins( {%1}, "You remove") AND %begins( {%2}, "root, bringing the total in the Rift to"))) {} {#VAR stupid 1}}
LightBulb
Advanced Member |
|
|
|
|
|
|
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
|
|