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
lamerov
Beginner


Joined: 06 Mar 2001
Posts: 23
Location: Bulgaria

PostPosted: Fri Jun 01, 2001 2:00 pm   

Colorful Bar
 
Purpose:
A colorful(less than 50% - red, less than 75% - yellow else green) bar, you can use in status windows, for example, to show your hp, sp, etc...

Code:
#CLASS {Bar}

#VAR bar {%if(%3 > 100, "Illegal length (0 < length < 101)", %if(%3 < 1, "Illegal length (0 < length < 101)", %if(@b_perc(%1, %2) < 50, %ansi(high, red), %if(@b_perc(%1, %2) < 75, %ansi(high, yellow), %ansi(high, green)))%repeat("#", %if(@b_length(%1, %2, %3) > %3, %3, @b_length(%1, %2, %3)))%ansi(def)%repeat(".", %if(@b_remaining(%1, %2, %3) > %3, %3, @b_remaining(%1, %2, %3)))))}
#VAR b_perc {%eval(%1 * 100 / %2)}
#VAR b_remaining {%eval(((%3 * 100) - (%3 * @b_perc(%1, %2))) / 100)}
#VAR b_length {%eval(%3 - @b_remaining(%1, %2, %3))}
#CLASS 0


Usage:
  @bar(current, max, length)
Where:
  current - the current value of the stat you want to show
  max - the maximum value of the stat you want to show
  length - the length of the bar(from 1 to 100)

Example:
Let's say you have your hp in @hp, max hp in @hpmax.
#echo {Hp: "["@bar(@hp, @hpmax, 10)"]"}

If you currently have 27 out of 34 hit points, will result in:
Hp: [########..]
Reply with quote
Zetecis2low
Novice


Joined: 06 Nov 2000
Posts: 35
Location: USA

PostPosted: Tue Jun 26, 2001 7:41 am   
 
my mud has the in the code to do it for u when ur full strength your hp is white if color is toggled. when ur at med strength its yellow. when ur gettin ur butt kicked its red.. maybe some muds should incorporate this code to their mud.. its usedful

[Black Robes]
Reply with quote
Behemoth
Beginner


Joined: 22 Jun 2001
Posts: 21

PostPosted: Tue Jun 26, 2001 1:29 pm   
 
Mine MUD has it too...but why don't you just make a guage? They are much nicer and you can do more with it.
Reply with quote
lamerov
Beginner


Joined: 06 Mar 2001
Posts: 23
Location: Bulgaria

PostPosted: Tue Jun 26, 2001 7:33 pm   
 
> Mine MUD has it too...

I have yet to see a mud that shows your hps, sps... as a bar.

> but why don't you just make a guage? They are much nicer and you can do more with it.

Nicer yes. But no, I don't think you can do more with them - a textual bar can be just as informative as a graphical gauge (I mean, you don't expect someone to count the pixels then find how much of them are left from the max possible and then estimate the remaining hps). Not to mention that:

  • Gauges have only two possible colors, with a script you can add as many as you wish.
  • Gauges can only appear on a button pannel, with a script you can put it inside the mud text or use it on a floating status window wherever you want to.
  • Gauges don't help you get better at scripting. :P


And, of course, there's always a possibility that you are ignorant of the fact that gauges exist until someone mentions it on the forums. *blush*
Reply with quote
Behemoth
Beginner


Joined: 22 Jun 2001
Posts: 21

PostPosted: Tue Jun 26, 2001 8:08 pm   
 
You can give gauges multiple colors with extra coding.

However, the status bar window is a GREAT place for a text based gauge though.

My MUD does not give the text based guage all the time, there is a command for it. But it is there.
Reply with quote
Tech
GURU


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

PostPosted: Wed Jul 17, 2002 12:15 am   
 
You could mod this code to 4,5, or more colors. A feature I can use in several places. I will play around with it and post working code in a week.

Asati di tempari!
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