|
omniwing Beginner
Joined: 02 Jun 2006 Posts: 19
|
Posted: Mon Dec 31, 2007 5:57 am
Why isn't this #IF conditional working? |
Background: I want to make a trigger that makes my cleric heal himself whenever his hps drop more than 100 below his max hps. However, I want it to wait a second before it checks my prompt again, because any time an event happens, it updates my prompt, and so most times the heal trigger will trigger 3 or 4 times before the first heal actually goes of. That is why I have it turn the trigger class off, wait for a second (this should allow 1 heal to go off) then turn it back on again.
My prompt shows my hps, and looks thusly: <250/500
I have a class called selfheal. Inside selfheal is the trigger:
~<(%d)/(%d)
#VAR currenthp %1
#VAR maxhp %2
#IF (@currenthp<(@maxhp-100)) {
cast 'heal'
#T- selfheal
#wait 1000
#T+ selfheal
}
The problem is, it isn't executing anything inside the brackets when my HPs are in the correct range. It just sends to the mud:
{cast 'heal';#T- selfheal;#wait 1000; #T+ selfheal}
and of course it spams it, because none of those commands are exceuted, including shutting off the class, and so my hps never go up and it spams. But why isn't anything getting executed? (Also, 'heal' is in single quotes because thats the syntax needed on this MUD to cast spells.)
Thanks! Please help!
-Omni |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Dec 31, 2007 6:15 am |
Well, first off stop using #WAIT in a trigger. It pauses everything instead of just the trigger code, and can make triggers and other settings not fire properly (or at all).
Second, maybe try putting in spaces around the operator in the #IF command? |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
omniwing Beginner
Joined: 02 Jun 2006 Posts: 19
|
Posted: Mon Dec 31, 2007 7:37 am |
Putting spaces around the < did not work, the same result happened. I also tried removing the #wait, and it didn't change anything. If its not good to use #wait in a trigger, what is a better method to accomplish what I want? Here is an example of why I put the wait in:
(this is what would happen without a pause)
Assume I'm in combat
<255/500 the statue hits you (triggers cast 'heal')
<255/500 you lost your concentration! (triggers cast 'heal')
<255/500 you eat a magic mushroom (triggers cast 'heal')
<255/500 cast 'heal'(triggers cast 'heal')
<500/500
So, I really only want the heal to cast once, not 4 times, so I put a wait command in there to delay the trigger a second before checking the prompt again. The more pressing problem, though, is why my code doesn't work at all.
Thanks
-Omni |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Mon Dec 31, 2007 8:40 am |
I don't have zMUD installed anymore, only CMUD, but the following works for me fine.
#TR selfHeal {~<(%d)~/(%d)} {#var currenthp %1
#var maxhp %2
#if (@currenthp < (@maxhp-100)) {
cast 'heal'
#T- selfHeal
#ALARM +1 {#T+ selfHeal}
}}
You should use an alarm rather than #WAIT with zMUD. |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
omniwing Beginner
Joined: 02 Jun 2006 Posts: 19
|
Posted: Mon Dec 31, 2007 9:31 am |
Guinn,
That worked! Perfect. Thank you for your assistance! *bows deeply*
I don't know why that worked and my code didn't....but thats ok. I now have a working model. Thanks again!
-Omni |
|
|
|
|
|