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
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Tue Dec 10, 2002 2:21 am   

#add command
 
Hello Zmud Users,

I'm using triggers/vars to keep track of my wand/staff charges left. (#add command)

How do I add a limit factor so that it won't let the variable number go below 0 or above 10?

Thank you,


Edwub the Mage
Reply with quote
Charbal
GURU


Joined: 15 Jun 2001
Posts: 654
Location: USA

PostPosted: Tue Dec 10, 2002 2:47 am   
 
Something like this should work, if I understand you correctly:

#TRIGGER {Your staff has been recharged.) {#VAR ChargesLeft 10}
#TRIGGER {Your staff gains a charge.} {#ADD ChargesLeft 1;#IF (@ChargesLeft > 10) {#VAR ChargesLeft 10}}
#TRIGGER {You use a charge of your staff.} {#ADD ChargesLeft -1;#IF (@ChargesLeft < 0) {#VAR ChargesLeft 0}}

Modify the patterns as appropriate, of course.


 - Charbal
Reply with quote
Edwub
Wanderer


Joined: 21 Nov 2002
Posts: 85
Location: USA

PostPosted: Tue Dec 10, 2002 3:47 am   
 
Works like a charm, really simple too, just use if and > <. Whee =)

Thanks,



Edwub the Mage
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