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
fhqwhgad
Novice


Joined: 07 Feb 2005
Posts: 38

PostPosted: Fri Nov 23, 2007 8:34 am   

trigger to change colour of all buttons
 
I'm using a trigger to change the colour of buff-labeled buttons. That way i can tell what buffs i've got on, based on the colours.
I currenltly use this when the buff is applied: #NOOP %btncol( btnarmor, green, gray)
Can i change the colour of ALL buttons at once, instead of just btnarmor? I tried btn*, but it didn't want to accept that.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Fri Nov 23, 2007 11:53 am   
 
You have to use multiple %btncol calls. You could use a #FORALL loop to do it. You can put them all into an alias and then call the alias from multiple locations. Also you should use #CALL instead of #NOOP.
Code:
#CLASS ButtonColoring
#VAR ButtonList {armor|fly|sanc}
#ALIAS ColorBtns {#FORALL @ButtonList {#CALL %btncol(%concat("btn",%i),%1,%2)}}
#CLASS 0
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
fhqwhgad
Novice


Joined: 07 Feb 2005
Posts: 38

PostPosted: Fri Nov 23, 2007 2:23 pm   
 
Vijilante wrote:
You have to use multiple %btncol calls. You could use a #FORALL loop to do it. You can put them all into an alias and then call the alias from multiple locations. Also you should use #CALL instead of #NOOP.
Code:
#CLASS ButtonColoring
#VAR ButtonList {armor|fly|sanc}
#ALIAS ColorBtns {#FORALL @ButtonList {#CALL %btncol(%concat("btn",%i),%1,%2)}}
#CLASS 0

so then when i add more buttons i'll have to update class aswell? Is it not possible to do it without having to update it?
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Mon Nov 26, 2007 1:43 am   
 
You would just have to update ButtonList.

You can always use %numbuttons to get the total number of buttons then loop the btn number and %btncol similar to Vijilante's code. The only problem is that this will modify all buttons, including gauges etc. Vijilante's is the most robust solution.

You can use the #ADDKEY to add a new item to the list.
_________________
Asati di tempari!
Reply with quote
fhqwhgad
Novice


Joined: 07 Feb 2005
Posts: 38

PostPosted: Tue Nov 27, 2007 6:30 pm   
 
Vijilante wrote:
You have to use multiple %btncol calls. You could use a #FORALL loop to do it. You can put them all into an alias and then call the alias from multiple locations. Also you should use #CALL instead of #NOOP.
Code:
#CLASS ButtonColoring
#VAR ButtonList {armor|fly|sanc}
#ALIAS ColorBtns {#FORALL @ButtonList {#CALL %btncol(%concat("btn",%i),%1,%2)}}
#CLASS 0

Exactly, how do i call this?
I've tried with a trigger that does a #CALL ColorBtns, but it does nothing.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Tue Nov 27, 2007 6:34 pm   
 
Since it's an alias you just use the name, i.e. 'ColorBtns'. #CALL is used for calling functions.
_________________
Asati di tempari!
Reply with quote
fhqwhgad
Novice


Joined: 07 Feb 2005
Posts: 38

PostPosted: Tue Nov 27, 2007 6:43 pm   
 
Tech wrote:
Since it's an alias you just use the name, i.e. 'ColorBtns'. #CALL is used for calling functions.

Thank you.
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