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


Joined: 26 Mar 2004
Posts: 5

PostPosted: Mon Mar 29, 2004 2:08 am   

working with colors
 


I am not the best at this but what i would like to do is
to make a trigger that allows me to see a players current hit points represented by %1 to be checked against %2 through percentages to be colored..
so if %1 is between 100% and 90% of %2 then the color or %1 will be for exp: green

and 1% is between 90% to 75% of %2 then the color will be for exp: mxpgreen

and if %1 is between 75% and 50% of %2 then color will be for exp:
mxpyellow

and if %1 is between 50% and 1% of %2 then color will be for exp:
blink,mxpred,black

the pattern is this
~[%s(%d)h/(%d)H%s%dm/%dM%s%dv/%dV%s~] %w

but working this trigger out i am not exactly sure how to do.. i assume i would use two variables assigned something like
@hpcurrent representing %1 and @hpset representing %2
and use something like
#math hpcurrent %1
and
#math hpset %2

after this i am not sure were to go using the #if command.
if anyone could help me work this trigger out.. i would appreciate it.
Reply with quote
musishun00
Wanderer


Joined: 16 Dec 2003
Posts: 77
Location: USA

PostPosted: Mon Mar 29, 2004 7:53 am   
 
Try this on for size:

#TRIGGER ~[%s(%d)h/(%d)H%s%dm/%dM%s%dv/%dV%s~](%w)
#VAR currhp (%1*100)
#VAR maxhp %2
#VAR hppercent %eval(@currhp/@maxhp)
#SAY %ansi(high,white)%1 is at %ansi(%if(@hppercent=100,"high,green",%if(80<@hppercent<100,"green",%if(60<@hppercent<80,"yellow",%if(40<@hppercent<60,"red",%if(@hppercent<40,"high,red"))))))@hppercent %ansi(high,white)HP.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Mar 29, 2004 6:24 pm   
 
Trigger Pattern:
~[%s(%d)h/(%d)H%s%dm/%dM%s%dv/%dV%s~] %w
Value:
#IF ((100 * %1) >= (90 * %2)) {#PCOL green %x1}
#IF (((100 * %1) < (90 * %2)) AND ((100 * %1) >= (75 * %2))) {#PCOL mxpgreen %x1}
#IF (((100 * %1) < (75 * %2)) AND ((100 * %1) >= (50 * %2))) {#PCOL mxpyellow %x1}
#IF ((100 * %1) < (50 * %2)) {#PCOL blink,mxpred,black %x1}
Reply with quote
Ryntrax
Wanderer


Joined: 15 Mar 2004
Posts: 55
Location: USA

PostPosted: Wed Mar 31, 2004 8:46 pm   
 
Where can I find a list of %ansi() colors? i see that black, blue, green, cyan, red, magenta,brown, gray, yellow, white are the only recognized colors, yet i found that %ansi( bold, slategrey) gives a unique color.
Reply with quote
user0101
Apprentice


Joined: 01 Aug 2003
Posts: 100
Location: USA

PostPosted: Wed Mar 31, 2004 9:30 pm   
 
#show %color(color-affect, colorname)

such as,

#show %color(hi, red)

This will give you the unique color number.

Edit - I am not sure they even have a help file for that, my only suggestion is to experiment. There is a color helpfile still around that gives the formula used to find the unique color ID's as well.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Mar 31, 2004 10:53 pm   
 
Those are the only colors recognized by %ansi.

As near as I can tell, %ansi( bold,slategray) gives the same color as %ansi( bold,black). This is also the same color you get with %ansi( bold,pink), %ansi( bold,skyblue) and %ansi( bold,gibberish). In other words, any unrecognized string is interpreted as black (0).

Additional colors are supported by #CW, #COLOR, and #PCOL. These are listed in the help for %colorname.
Reply with quote
Ryntrax
Wanderer


Joined: 15 Mar 2004
Posts: 55
Location: USA

PostPosted: Wed Mar 31, 2004 11:42 pm   
 
I found that you can use this little trick and it makes the writing of basic colors easier b/c you can view your options.


#ALIAS color {#var colornumber 0;#WHILE (@colorNumber <=15) {#SHOW {%ansi( @colornumber)COLOR _-@colornumber-_};#ADD colorNumber 1}}

I let the while statement run into the 1000's and saw that it shows all of the blinks and backgrounds, etc. as well.
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