Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
Killfile
Novice


Joined: 30 Sep 2002
Posts: 32
Location: USA

PostPosted: Mon Feb 03, 2003 2:18 pm   

Color Function
 
It's not terribly innovative, but this function takes makes color ranges much easier to read than a series of chained if statements and %ansi functions.

#VAR ColorScale10 {%ansi( high, cyan)%if( %1 < %2, %ansi( high, yellow))%if( %1 < (%eval( .75 * %2)), %ansi( high, green))%if( %1 < (%eval( .50 * %2)), %ansi( high, blue))%if( %1 < (%eval( .25 * %2)), %ansi( high, red))%format( "&10.0n", %1)%ansi( green)} {_nodef} "Services"

Usage is as follows @ColorScale(@Variable,MaxForVar)

Where MaxForVar is an integer representing the "Perfect" value for the variable you're tracking. My scale deals with number up to 10 digits, but you can change that easily.

At "perfect" the number will be displayed with comas etc in Cyan
Above 75% it will be displayed in yellow
Above 50% in green
Above 25% in blue
And below 25% in red.

Warning: Using a lot of these in your status window causes older processors some problems due to the continuous update nature of the STW.

--Killfile
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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