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


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Fri Jan 11, 2002 12:14 pm   

Three Colour Guages
 
Anyone got any ideas as to how I would implement this?

You know what I mean.. Green I'm healty(ish), yellow means be careful, red means run away screaming like a little girl who's dolly has just been napalmed and whos dog got run over by a steam roller....


"+++ OUT OF CHEESE ERROR +++"
"+++ PLEASE REINSTALL UNIVERSE AND REBOOT +++" - Hex

---> Burser
Reply with quote
Burser
Wanderer


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Fri Jan 11, 2002 1:22 pm   
 
I've been searching through back-posts... I actually want a guage, not a text whatsit.

In the post covering textwhatsits, someone mentioned that it was possible to have colourful guages with extra code... go on then... ;)



"+++ OUT OF CHEESE ERROR +++"
"+++ PLEASE REINSTALL UNIVERSE AND REBOOT +++" - Hex

---> Burser
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Jan 11, 2002 2:22 pm   
 
You should be able to do this with the #GAUGE command by changing the colors and the normal/low values of the gauge as needed. However, it is not possible because this command appears to be buggy.

Kjata
Reply with quote
Burser
Wanderer


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Fri Jan 11, 2002 4:04 pm   
 
Assuming it wasn't bugged - how would I go about it?

And assuming it is bugged - what do I do now?

"+++ OUT OF CHEESE ERROR +++"
"+++ PLEASE REINSTALL UNIVERSE AND REBOOT +++" - Hex

---> Burser
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri Jan 11, 2002 6:34 pm   
 
If it wasn't bugged, the syntax for it is:
#GAUGE ID Caption Value MaxValue LowValue Class NormalColor LowColor

So, you would use this to modify an existing gauge with a set ID.

Suppose you create a gauge with ID hp, LowValue @maxhp/2, NormalColor green, and LowColor yellow. This gauge will measure your hp and when it gets to half of it's max value, it turns yellow.
Now, you would also have a trigger that catch these values, most likely from your prompt. In this trigger you could put the following command:
#IF (@hp <= @maxhp/2) {#GAUGE hp "Hp" @hp @maxhp @maxhp/10 "" "yellow" "red"} {#GAUGE hp "Hp" @hp @maxhp @maxhp/2 "" "green" "yellow"}}

What this command will do is to check if the gauge has already reached to point at where it has turned yellow. If so, it changes the gauge's properties, using the #GAUGE command, and changes its LowValue to one-tenth of you max hp, its NormalColor to yellow and it's LowColor to red. If the gauge is not at half your max hp, it sets the gauge's properties as they were originally.

By doing this you ned up with a gauge that is normally green, yellow when you get to half your max hp and red when it is at or below one-tenth.

Assuming it is bugged, there isn't anything you can do, because this is the only command that deals with gauges (yes, gauges are buttons, and thus are controlled too by #BUTTON, but #BUTTON doesn't provide for the properties we need to do this.) This is concerning zMUD. You could also check out the plugin CPPIG that displays graphical gauges. I don't remember exactly, but I think that it did allow for three colors.

Kjata
Reply with quote
einar
Wanderer


Joined: 06 Nov 2000
Posts: 80
Location: USA

PostPosted: Fri Jan 11, 2002 10:44 pm   
 
Why not use the text bar in the finished zmud scripts? it works great, and you can put multiple bars in your status window.

Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Sat Jan 12, 2002 4:03 am   
 
Has anyone tried just using the %btncol() function to change the color? Gauges *are* buttons so it seems like this should work.

(Working on fixing the #GAUGE command in 6.25)

Reply with quote
Burser
Wanderer


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Sat Jan 12, 2002 11:28 am   
 
I'll get back to you on how I fixed it...

If I do before 6.25 :)

Thanks yall

--> Burser
Reply with quote
Burser
Wanderer


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Sat Jan 12, 2002 12:36 pm   
 
the %btncol() function won't change the guage colour, only the button behind the guage.

I end up changing the colour of the 'background'the the guage readout, not the guage itself.

Looks like I'm going to have to wait for your next version, Zugg...

--> Burser
Reply with quote
Burser
Wanderer


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Sat Jan 12, 2002 2:13 pm   
 
Ok - heres some code I've come up with - I don't know why this doesn't work, so maybe you can tell me :)



#MATH hpsPercent ((@hps*100)/@maxHps)
#IF (@hpsPercent <= 25) {ghpsColor = %color( red)} {ghpsColor = %color( yellow)}
#IF (@hpsPercent > 75) {ghpsColor = %color( green)} {ghpsColor = %color( yellow)}
#BUTTON ghps {@hpsPercent~%} {} {} {} {@hpsPercent} {} {} {Size} {37} {1020} {} {} {} {32} {} {Gauge|@hpsColor|0|100|20} {} "" {"Explore"|"Inset"} {} {ghps} {2}


Variables and IDs

hps - Hit Points
maxHps - Maximum Hit Points
hpsPercent - Percaentage of Hit Points available

ghps - the guage itself

ghpsColor - Colour to change the guage 'ghps'

"+++ OUT OF CHEESE ERROR +++"
"+++ PLEASE REINSTALL UNIVERSE AND REBOOT +++" - Hex

---> Burser
Reply with quote
Burser
Wanderer


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Sat Jan 12, 2002 2:17 pm   
 
New addition - I've set the Guage Low level to 0 so -

 Gauge|@hpsColor|0|100|20 


now reads as

 Gauge|@hpsColor|0|100|0 


"+++ OUT OF CHEESE ERROR +++"
"+++ PLEASE REINSTALL UNIVERSE AND REBOOT +++" - Hex

---> Burser
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Sat Jan 12, 2002 6:07 pm   
 
Nope, won't work. It just doesn't want to change the colors the gauge uses. It's probably related to the same bug that prevents #GAUGE from doing its work.

Kjata
Reply with quote
Burser
Wanderer


Joined: 07 Feb 2001
Posts: 70
Location: United Kingdom

PostPosted: Sat Jan 12, 2002 6:26 pm   
 
Thank god its a bug - I thought I was going mad.

"+++ OUT OF CHEESE ERROR +++"
"+++ PLEASE REINSTALL UNIVERSE AND REBOOT +++" - Hex

---> Burser
Reply with quote
Tech
GURU


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

PostPosted: Wed Sep 21, 2005 6:12 pm   
 
Hey I know this is old, but Zugg did you ever get around to fixing this pesky bug. I'm using version 7.13b and I'm still having the same problem.
_________________
Asati di tempari!
Reply with quote
Tech
GURU


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

PostPosted: Wed Sep 21, 2005 6:28 pm   
 
I found my own answer on another forum. The key is you things get funky when you use numbers to specify color parameters... (seems only the first is processed) and I had no idea how to specify high colors until I came across this example.

Code:
#GAUGE HP HP {@hp} {@Maxhp} {@Maxhp/4} {} {high,blue} {high,red} {gray}
#GAUGE Mana Mana {@mp} {@Maxmp} {@Maxmp/4} {} {high,blue} {high,red} {gray}
#GAUGE Move Move {@move} {@Maxmove} {@Maxmove/4} {} {high,blue} {high,red} {gray}


It was by LightBulb on this thread http://forums.zuggsoft.com/phpbb/viewtopic.php?t=17484&start=0&postdays=0&postorder=asc&highlight=%23gauge.
_________________
Asati di tempari!
Reply with quote
billaben
Wanderer


Joined: 02 Sep 2005
Posts: 60

PostPosted: Wed Sep 21, 2005 8:56 pm   
 
To the best of my knowledge, it simply can't be done currently without going to a plugin of some kind. #GAUGE is simply not designed with more than two colors in mind.

On a personal note, I think it would be a good idea to consider enhancing gauge or even adding new commands to give better flexibility for configurating gauges, size of gauges, placement, font sizes, more colors, etc.... Because quite frankly people get pretty fussy about exactly how such things look. More options is good.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Sep 22, 2005 1:13 am   
 
Make our own with %btncolor. I could have 1,000,000 color guages if I like. The trick of it to use %btncolor directly in the caption. You can set both foreground and background colors. If I recall correctly the foreground property controls both the text color and the guage color, while the background property is only the background button color. In order to suppress the the return value from %btncol I find it best to use an %if. Example caption:
%if(%if(%eval(@HP<(@MaxHP*10/3)),%btncol(MySuperBtn,red,yellow),%if(%eval(@HP<(@MaxHp*10/6)),%btncol(MySuperBtn,yellow,green),%btncol(MySuperBtn,green,blue))),,)
That puts you up to 6 varying colors. Since %btncol will support direct numbers in an RGB type format you could just use math to have the colors change even more incementally.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
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