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
Ashen
Beginner


Joined: 16 Apr 2001
Posts: 10
Location: USA

PostPosted: Tue Apr 02, 2002 10:40 am   

Button state
 
My current buttons cast spells on my mudchar when I press them and toggles off when the spells wear off.

I need to make a trigger that will toggle all my "On" state buttons to "Off" state when a trigger goes off without affecting those buttons already in the "Off" state.

Example: I have 8 toggle type buttons for spells in the "On" state and 1 button in the "Off" state. If my character is magically dispeled, I want my trigger to check the state of all buttons and only toggle those in the "On" state.

Thank you
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Thu Apr 04, 2002 11:54 pm   
 
I couldn't find anything that would return
the state of a button, so I'll suggest that
you keep track of variables and the state
of the spell.
eg:

#VAR v_sanctuary 1
#VAR v_protectionfromsnooping 0
#VAR v_strength 0

If you keep a master list of those variables
like:
#VAR v_spell_posture "v_sanctuary|v_protectionfromsnooping|v_strength"

#BUTTON b_v_strength {cast 'strength'} {} {s|} {state1|state2} {} {} {} {} {} {} {} {} {} {} {0|0} {} {} "" {} {} {b_v_strength}
#BUTTON b_v_sanctuary {cast 'sanctuary'} {} {s|} {state1|state2} {} {} {} {} {} {} {} {} {} {} {0|0} {} {} "" {} {} {b_v_sanctuary}
#BUTTON b_v_protectionfromsnooping {cast 'protection from snooping'} {} {s|} {state1|state2} {} {} {} {} {} {} {} {} {} {} {0|0} {} {} "" {} {} {b_v_protectionfromsnooping}

You could do

#FORALL @v_spell_posture {#IF (!@{%i}) {#BU b_%i 1}}

Ton Diening
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Apr 05, 2002 3:08 am   
 
In the Advanced tab you can set either the Variable or the Value field to control the button. I'd recommend the Variable myself.

For instance, make @button1 the variable for button 1, @button2 for button 2, etc. Your triggers can then be:
#TR {spellup time} {#IF (@button1 = 0) {#VAR @button1 1};#IF (@button2 = 0) {#VAR button2 1};etc}
#TR {spelloff time} {#IF (@button1 = 1) {#VAR button1 0};#IF (@button2 = 1) {#VAR button2 0};etc}


LightBulb
All scripts untested unless otherwise noted
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