|
talonnb Apprentice
Joined: 30 Oct 2004 Posts: 127
|
Posted: Tue Jul 10, 2007 5:21 am
Variable Triggers |
I have triggers running off variable states.
Example:
#trigger {@plants.plantbal} {Does plant healing things}
Now, problem with this, is when an affliction is sent and will be processed, not right away, but after the next prompt fires.....
This can cause problems in smaller battles where something might not happen right after, but give them a chance to send another affliction my way when I should have been healing it. Sames goes for when plantbal is set to 1 and the trigger should fire right away, but doesn't. Waits for next prompt.
Is there any way to correct this? Some setting that will make it fire sooner? |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Jul 10, 2007 5:37 am |
Your trigger probably has the option "Trigger on Prompt" selected. Try deselecting that and choosing "Trigger on New Line" instead.
|
|
_________________ Asati di tempari! |
|
|
|
talonnb Apprentice
Joined: 30 Oct 2004 Posts: 127
|
Posted: Wed Jul 11, 2007 4:49 am |
I love Zmud.....it's so confusing sometimes. I make a variable 'temp' for example. Make trigger '@temp' and have it #ECHO WHATEVER.....so in my mind, when temp = 1 I should be getting WHATEVER each line.
Instead, regardless of what @temp is set to, it always fires.....what the heck is going on? |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed Jul 11, 2007 5:50 am |
When you use an expression trigger (which essentially what you did) you need to tell zMUD what the expression is. In your case you want @Temp == 1 so that the trigger only fires when the expression is equal to 1.
I guess as you have it now it's triggering as long as the variable is defined. |
|
_________________ Asati di tempari! |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jul 11, 2007 9:21 pm |
Keep in mind that expression triggers in ZMud will always fire when any variable changes value, even if that variable isn't related to the expression in the expression trigger.
For instance, let's use the @temp = 1 example.
1)you set @temp = 1. The @temp = 1 trigger fires, executes the code.
2)in the @temp = 1 trigger, you set @friend = "Fred". The @temp = 1 trigger fires again, and since @temp is still = 1 the code is executed a second time.
To correct this, you may need to set up an "oldvar" sequence to account for recent changes to the variable (that is, you only want the trigger to execute code if the specific variable is equal to a specific value AND the specific variable is not equal to the "oldvar" value.)
((@temp = 1) and (@temp != @oldtemp))
In this case, the trigger shouldn't execute any code (it will still fire) if @temp = @oldtemp. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jul 11, 2007 9:58 pm |
Or just make the first line of the trigger set @temp back to 0.
|
|
|
|
talonnb Apprentice
Joined: 30 Oct 2004 Posts: 127
|
Posted: Wed Jul 11, 2007 11:00 pm |
Tech wrote: |
When you use an expression trigger (which essentially what you did) you need to tell zMUD what the expression is. In your case you want @Temp == 1 so that the trigger only fires when the expression is equal to 1.
I guess as you have it now it's triggering as long as the variable is defined. |
Ah, didn't know you could express it like that. I thought triggers only fired when 'true' hence = 1 automatically came to mind. That'll help, thanks. As for the other answer, from Matt, The first time the trigger is run, it goes till it cures something, uses #abort 1, and then there's a variable inside the trigger, that when it runs the second time, it will simply turn the trigger off. It's going to be used for advanced curing, and I hope it works well in speeding up my reflexs. |
|
|
|
talonnb Apprentice
Joined: 30 Oct 2004 Posts: 127
|
Posted: Sat Jul 28, 2007 6:04 pm |
Code:
#VAR goingfortrees {1}
#TRIGGER (@goingfortrees=1) {#echo whatever}
#TRIGGER (@goingfortrees==1) {#echo whatever2}
I've gone into the trigger settings, and set these to 'expression' type, the state is set to 0 if that matters.....I just don't understand why this will work for me on a rare occasion, then next time I go to work on them, it doesn't....Does Zmud hate me or am I doing something wrong again? |
|
|
|
talonnb Apprentice
Joined: 30 Oct 2004 Posts: 127
|
Posted: Sat Jul 28, 2007 6:09 pm |
Er, ok, I had disabled a class, to test this. It didn't have the variable or the trigger in it, but somehow it made a difference.....am I missing something?
|
|
|
|
|
|