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
Leonid
Newbie


Joined: 28 Sep 2004
Posts: 3

PostPosted: Tue Sep 28, 2004 4:48 pm   

Button problems
 
I am trying to get a list of buttons going to display my affects. I would like the button to change to a different color for every phase of the spell/skill. Right now I have one that works. However, it is not working the way I want it to. In order for the button to change color I have to click on it.

I have tried a few ways to try and get it to work but alas to no avail.

Here is an example of one of the spells I use on my mud.

The spell is called forceshield.

Its phases include:

A shieldlike protection builds up around you.
I labelled this 3 for newly casted.

The forceshield revebrates with new energy.
I labelled this 2 for refreshed.

Your forceshield is flickering.
I labelled this 1 for falling.

Slowly your magical shield fades away.
I labelled this 0 for fell.

Because I can not get my buttons to work properly I currently have my triggers reporting them to variables. For example for phase 3 the newly casted I have:

#TRIGGER {A shieldlike protection builds up around you.} {#VA forceshield 3}



Is there anyway I can get my buttons to automatically change colors rather then having to click on them?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Sep 29, 2004 12:53 am   
 
Sure put the %btncol function directly in the caption of the button, and set an ID for the button. For example:

ID:
FSbutton

Caption:
Forceshield%if(%btncol(FSbutton,%case(%eval(@forceshield+1),red,yellow,blue,green)),,)

What this does is take the value in forceshield and add 1, this is then used to determine the return value for the %case. %case expects 1 to correllate to its first return value which is why I added 1 here. You could alternately change all your triggers so that forceshield ranged from 1 to 4 and then eliminate the %eval addition. Once %case returns %btncol does its thing and returns the button color. That return value is eaten by the %if which return nothing keeping the display of the button pretty, sadly I have found no better function for this perhaps I can convince Zugg to add a noop function. Now because zMud automatically updates button captions when a variable used in them changes the color will automatically change whenever the variable is changed.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Leonid
Newbie


Joined: 28 Sep 2004
Posts: 3

PostPosted: Wed Sep 29, 2004 4:37 am   
 
Okay if I change my triggers to value 1 to 4 how would I set this up.

Currently I have it like this but I have to click on the button in order for it to change colors as said previously.

I added to the trigger that stores the value to do this as I was hoping if I just had it create a button everytime it would work but it isn't. Anyway this is what I have.

Pattern:
A shieldlike protection builds up around you.

Value:
#VA forceshield 3
#BU Forceshield {Forceshield} {#NOOP %btncol( 1, yellow, black)}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Sep 29, 2004 3:31 pm   
 
Put the command to change colors in the trigger. Right now, your trigger puts the command to change colors into the button, so you have to press the button before the command and the color change actually happen!

Pattern:
A shieldlike protection builds up around you.

Value:
#VA forceshield 3
#CALL %btncol( Forceshield, yellow, black)
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
Leonid
Newbie


Joined: 28 Sep 2004
Posts: 3

PostPosted: Wed Sep 29, 2004 4:16 pm   
 
Thanks for the help lightbulb.
Reply with quote
parrotslave
Wanderer


Joined: 01 Jul 2002
Posts: 81
Location: USA

PostPosted: Mon Dec 20, 2004 1:43 am   
 
How would I specify the state of a toggle button to change the color on?

I have a button that I use to turn my light source on and off.

I would like to change the background color of both states of this button, one color for daytime and one color for night.

Using #CALL %btncol( lightbutton, white, cyan) just changes the buttondown state.

Thanks!
Reply with quote
Falan
Wanderer


Joined: 17 Aug 2004
Posts: 98
Location: OK, USA

PostPosted: Mon Dec 20, 2004 8:32 am   
 
Toggle buttons have a color pallet next to the Caption line that allows you to change the background and text colors for the Up and Down positions.

Intro to Buttons
_________________
zMUD 7.05a
Reply with quote
parrotslave
Wanderer


Joined: 01 Jul 2002
Posts: 81
Location: USA

PostPosted: Mon Dec 20, 2004 5:28 pm   
 
I understand about the color pallet next to the caption line.

What I am doing is using a trigger on the messages that announce day and night to change the background color of the button to reflect the time of day.

Using #CALL %btncol( lightbutton, white, cyan) for daytime and #CALL %btncol( lightbutton, black, yellow) for night. It seems this only changes the active state of the button.

I think I found a way to change the inactive state. I put a check into both states of the button and now when I click the button it checks to see if it is day or night and changes the color as necessary.
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