 |
fhqwhgad Novice
Joined: 07 Feb 2005 Posts: 38
|
Posted: 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. |
|
|
|
 |
Vijilante SubAdmin

Joined: 18 Nov 2001 Posts: 5187
|
Posted: 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 |
|
|
 |
fhqwhgad Novice
Joined: 07 Feb 2005 Posts: 38
|
Posted: 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? |
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
 |
fhqwhgad Novice
Joined: 07 Feb 2005 Posts: 38
|
Posted: 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. |
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: 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! |
|
|
 |
fhqwhgad Novice
Joined: 07 Feb 2005 Posts: 38
|
Posted: 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. |
|
|
|
 |
|
|
|