|
dratcha Newbie
Joined: 26 Sep 2002 Posts: 8
|
Posted: Tue Oct 22, 2002 9:37 am
Expression Triggers |
I am having some problems on this one...maybe becuase I am so sleepy.
I have various triggers that set different variables. Then I use expression triggers to do something. Example:
#TRIGGER {(%n)h, (%n)m (%w)-} {#MATH varBalance (%pos( "x", %3) > 0)}
#TRIGGER {^You close your eyes, curl up in a ball, and fall asleep.} {@varSleeping = 1;@varStanding = 0}
#TRIGGER (#IF varStanding = 0 AND varBalance = 1 AND varSleeping = 0) {Stand}
The problem I am having is that when I go to sleep, the varSleeping variable is getting set to 1, but the Expression trigger is still firing. I have a wake trigger which sets the varSleeping variable back to 0 but then the expression variable doesn't fire.
Why would these be firing when they shouldn't be, and not firing when they should? |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Oct 22, 2002 12:04 pm |
#TRIGGER (#IF (@varStanding = 0) AND (@varBalance = 1) AND (@varSleeping = 0)) {Stand}
The parentheses probably don't matter, but it's always best to be certain of the order of evaluation. More importantly, varStanding is a string, @varStanding is a variable.
LightBulb
Senior Member |
|
|
|
dratcha Newbie
Joined: 26 Sep 2002 Posts: 8
|
Posted: Tue Oct 22, 2002 4:23 pm |
The changes helped a little bit. It now will fire when it is supposed to, but it is also still firing when it is not supposed to. I've checked the variables and they all have the correct values. Not sure why it fires when @varStanding = 1
|
|
|
|
Killfile Novice
Joined: 30 Sep 2002 Posts: 32 Location: USA
|
Posted: Tue Oct 22, 2002 4:54 pm |
quote:
#TRIGGER {(%n)h, (%n)m (%w)-} {#MATH varBalance (%pos( "x", %3) > 0)}
#TRIGGER {^You close your eyes, curl up in a ball, and fall asleep.} {@varSleeping = 1;@varStanding = 0}
#TRIGGER (#IF varStanding = 0 AND varBalance = 1 AND varSleeping = 0) {Stand}
Ok, while I have literaly no idea what the first trigger does I do have some tips.
1.) When setting a variable don't use the @ symbol. @ expands your variable (to a value). Sometimes Zmud is smart enough to know what you mean. Sometimes its not.
So it should be:
varSleeping = 1; varStanding = 0;
Similarly, when evaluating variables you need the @ there to expand them (so you can see what you've stored in them)
So the last triggers should read
#IF (@varStanding = 0 AND varBalance = 1 AND varSleeping = 0) {Stand}
--Killfile |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Tue Oct 22, 2002 6:20 pm |
Much of your problem is probably the use of expression triggers. #IF, of course, is a command, not an expression.
I don't know if your #MATH command will work as you intend or not, but it's easy to replace with an #IF which is certain. However, if you've tested it feel free to ignore. Either way, it needs to be a prompt trigger.
#TRIGGER {(%n)h, (%n)m (%w)-} {#IF (%pos(x, %3) > 0) {varBalance = 1} {varBalance = 0}} {} {nocr|prompt}
#TRIGGER {^You close your eyes, curl up in a ball, and fall asleep.} {varSleeping = 1;varStanding = 0}
#TRIGGER ((@varStanding = 0) AND (@varBalance = 1) AND (@varSleeping = 0)) {Stand}
LightBulb
Senior 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
|
|