Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
dk92870
Newbie


Joined: 07 Mar 2002
Posts: 4
Location: USA

PostPosted: Sat Mar 16, 2002 7:59 pm   

how do I get out of IF statement
 
#ALIAS checkMP {#IF (@MpVar < 5) {#WAIT 3000;checkMP} {w}}
#ALIAS checkHP {#IF (@HpVar < 5) {c vi;#WAIT 6000;checkHP} {checkMP}}

#VAR MonCount {0}
#VAR HPVAR {0}
#VAR MPVAR {0}

#TRIGGER {&%dHpVar H &%dMpVar M} {} "" {prompt}
#TRIGGER {Rest Area} {#WAIT 5000;checkHP} "" {notrig}
#TRIGGER {You see %w druid initiate?} {k init;e;#WAIT 2000;e} "" {notrig}
#TRIGGER {A druid initiate just arrived} {#ADD MonCount 1;e} "" {notrig}
#TRIGGER {A druid initiate just wandered away} {#ADD MonCount -1} "" {notrig}
#TRIGGER {death of the druid initiate} {#ADD MonCount -1} "" {notrig}
#TRIGGER {The druid initiate %w you} {e} "" {notrig}

It seems everything works until HpVar and MpVar falls below 5. When HpVar valls below 5, the checkHP IF stmt will executed.
but on the screen I kept seeing "c vi" even if the HpVar is more than 5.
*note* The HpVar and MpVar never got updated when running into checkHP IF Stmt.
My question is how do I rewrite the code so that @HpVar and @MpVar will update by itself (@HpVar and @MpVar will automatically update itself prior calling the checkHP If Stmt)
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Mar 16, 2002 9:15 pm   
 
The variables won't get updated because of the #WAITs that stop further processing. I suggest rewriting parts like this:
#WAIT 3000;checkHp

to:
#ALARM {+3} {checkHp}

Notice that alarms use seconds and not miliseconds like #WAIT does.

Alarms don't suffer from the same problem as #WAIT and you can have as many as you want at the same time.

Kjata
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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

© 2009 Zugg Software. Hosted by Wolfpaw.net