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


Joined: 07 Jun 2005
Posts: 23
Location: France

PostPosted: Tue Jun 07, 2005 10:45 pm   

hp/sp/ep coloring on astaria
 
Hi there, here's a sample code to color hp/sp/ep on astaria

it's designed to color hp/sp/ep :
in red if it goes under 25%
in yellow between 25% and 75%
in regular grey(white) above 75%

And by the way, it's my first post here

Code:

#REGEX {^hp:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\],\s*sp:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\],\s*ep:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\]$} {#GAG
#VA curhp %1
#VA maxhp %2
#VA cursp %3
#VA maxsp %4
#VA curep %5
#VA maxep %6
#MATH temp {@curhp*100/@maxhp}
#VA perhp @temp
#MATH temp {@cursp*100/@maxsp}
#VA persp @temp
#MATH temp {@curep*100/@maxep}
#VA perep @temp
#FU color_hp {%if(@perhp<25,%ansi(red)@curhp,%if(@perhp>=25 AND @perhp<75,%ansi(yellow)@curhp,%ansi(bold,blue)@curhp))}
#FU color_sp {%if(@persp<25,%ansi(red)@cursp,%if(@persp>=25 AND @persp<75,%ansi(yellow)@cursp,%ansi(bold,blue)@cursp))}
#FU color_ep {%if(@perep<25,%ansi(red)@curep,%if(@perep>=25 AND @perep<75,%ansi(yellow)@curep,%ansi(bold,blue)@curep))}
#SAY {%ansi(grey)HP:~[%eval(@color_hp())%ansi(grey)/@maxhp~] SP:~[%eval(@color_sp())%ansi(grey)/@maxsp~] EP:~[%eval(@color_ep())%ansi(grey)/@maxep~]}}


Perenico (aka Haigwepa/Tao/Josef)
Reply with quote
perenico
Beginner


Joined: 07 Jun 2005
Posts: 23
Location: France

PostPosted: Mon Oct 10, 2005 4:45 pm   
 
up to add a few things that has been changed a while ago... added one color and aliases, vars and such

Code:

#CLASS {hp_bar}
#VAR color_ep {%if(@perep<25,%ansi(high,red)@curep%ansi(grey),%if(@perep>=25 AND @perep<50,%ansi(high,purple)@curep%ansi(grey),%if(@perep>=50 AND @perep<75,%ansi(yellow)@curep%ansi(grey),%ansi(grey)@curep%ansi(grey))))}
#VAR color_hp {%if(@perhp<25,%ansi(high,red)@curhp%ansi(grey),%if(@perhp>=25 AND @perhp<50,%ansi(high,purple)@curhp%ansi(grey),%if(@perhp>=50 AND @perhp<75,%ansi(yellow)@curhp%ansi(grey),%ansi(grey)@curhp%ansi(grey))))}
#VAR color_sp {%if(@persp<25,%ansi(high,red)@cursp%ansi(grey),%if(@persp>=25 AND @persp<50,%ansi(high,purple)@cursp%ansi(grey),%if(@persp>=50 AND @persp<75,%ansi(yellow)@cursp%ansi(grey),%ansi(grey)@cursp%ansi(grey))))}
#VAR curep {0}
#VAR curhp {0}
#VAR cursp {0}
#VAR maxep {0}
#VAR maxhp {0}
#VAR maxsp {0}
#VAR perep {0}
#VAR perhp {0}
#VAR persp {0}
#REGEX {^hp:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\],\s*sp:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\],\s*ep:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\]$} {#GAG;#VA curhp %1;#VA maxhp %2;#VA cursp %3;#VA maxsp %4;#VA curep %5;#VA maxep %6;#MATH temp {@curhp*100/@maxhp};#VA perhp @temp;#MATH temp {@cursp*100/@maxsp};#VA persp @temp;#MATH temp {@curep*100/@maxep};#VA perep @temp;#SAY {%ansi(grey)HP: ~[ %eval(@color_hp()) / @maxhp ~] SP: ~[ %eval(@color_sp()) / @maxsp ~] EP: ~[ %eval(@color_ep()) / @maxep ~]}}
#CLASS 0


Last edited by perenico on Thu Mar 23, 2006 1:55 pm; edited 1 time in total
Reply with quote
perenico
Beginner


Joined: 07 Jun 2005
Posts: 23
Location: France

PostPosted: Thu Mar 23, 2006 1:55 pm   
 
still the same than before, but using function... *sigh*

Code:
#CLASS {hp_bar}
#REGEX {^hp:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\],\s*sp:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\],\s*ep:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\]$} {
  #GAG
  #VA curhp %1
  #VA maxhp %2
  #VA cursp %3
  #VA maxsp %4
  #VA curep %5
  #VA maxep %6
  #MATH temp {@curhp*100/@maxhp}
  #VA perhp @temp
  #MATH temp {@cursp*100/@maxsp}
  #VA persp @temp
  #MATH temp {@curep*100/@maxep}
  #VA perep @temp
  #SAY {%ansi( grey)HP: ~[ %eval( @color(@perhp,@curhp)) / @maxhp ~] SP: ~[ %eval( @color(@persp,@cursp)) / @maxsp ~] EP: ~[ %eval( @color(@persp,@cursp)) / @maxep ~]}
  }
#VAR curep {0}
#VAR curhp {0}
#VAR cursp {0}
#VAR maxep {0}
#VAR maxhp {0}
#VAR maxsp {0}
#VAR perep {0}
#VAR perhp {0}
#VAR persp {0}
#FU color {%if( %1<25, %ansi( high, red)%2%ansi( grey), %if( %1>=25 AND %1<50, %ansi( high, purple)%2%ansi( grey), %if( %1p>=50 AND %1<75, %ansi( yellow)%2%ansi( grey), %ansi( grey)%2%ansi( grey))))}
#CLASS 0
_________________
-=-=-=-=-=-=-=-=-=-=-=-=
astaria3.com : 5000
character name : Vandemar
-=-=-=-=-=-=-=-=-=-=-=-=
Zmud : 7.21
-=-=-=-=-=-=-=-=-=-=-=-=
Reply with quote
Zirar
Newbie


Joined: 09 Apr 2006
Posts: 2

PostPosted: Sun Apr 09, 2006 7:42 pm   
 
On your most recent one, the #SAY is messed up... displays sp in the ep part also. Just need to change the variables. So the line should look like:

#SAY {%ansi( grey)HP: ~[ %eval( @color(@perhp,@curhp)) / @maxhp ~] SP: ~[ %eval( @color(@persp,@cursp)) / @maxsp ~] EP: ~[ %eval( @color(@perep,@curep)) / @maxep ~]}
}


Also, there's a huge problem with this entire thing. If you get negative EP... the mud won't show your hp/sp/ep at all, even while in combat or when you type 'hp'. I'm trying to find a way around it, but am having issues. I'm pretty new to scripting. If anyone can help so that the color bar can display negative numbers, I'd appreciate it.

-Z
Reply with quote
perenico
Beginner


Joined: 07 Jun 2005
Posts: 23
Location: France

PostPosted: Wed May 10, 2006 10:07 am   
 
hmm, I'll take a look at it, yeah
_________________
-=-=-=-=-=-=-=-=-=-=-=-=
astaria3.com : 5000
character name : Vandemar
-=-=-=-=-=-=-=-=-=-=-=-=
Zmud : 7.21
-=-=-=-=-=-=-=-=-=-=-=-=
Reply with quote
perenico
Beginner


Joined: 07 Jun 2005
Posts: 23
Location: France

PostPosted: Wed Aug 16, 2006 1:45 pm   
 
Boric managed to correct it, here's the last and working version :

Code:

#CLASS {hp_bar}
#REGEX {^hp:\s*\[\s*(\-?\d+)\s*/\s*(\d+)\s*\],\s*sp:\s*\[\s*(\-?\d+)\s*/\s*(\d+)\s*\],\s*ep:\s*\[\s*(\-?\d+)\s*/\s*(\d+)\s*\]$} {
  #GAG
  #VA curhp %1
  #VA maxhp %2
  #VA cursp %3
  #VA maxsp %4
  #VA curep %5
  #VA maxep %6
  #MATH temp {@curhp*100/@maxhp}
  #VA perhp @temp
  #MATH temp {@cursp*100/@maxsp}
  #VA persp @temp
  #MATH temp {@curep*100/@maxep}
  #VA perep @temp
  #SAY {%ansi( grey)HP: ~[ @color(@perhp,@curhp) / @maxhp ~] SP: ~[ @color(@persp,@cursp) / @maxsp ~] EP: ~[ @color(@persp,@cursp) / @maxep ~]}
  }
#VAR curep {0}
#VAR curhp {0}
#VAR cursp {0}
#VAR maxep {0}
#VAR maxhp {0}
#VAR maxsp {0}
#VAR perep {0}
#VAR perhp {0}
#VAR persp {0}
#FU color {%if( %1<25, %ansi( high, red)%2%ansi( grey), %if( %1>=25 AND %1<50, %ansi( high, purple)%2%ansi( grey), %if( %1p>=50 AND %1<75, %ansi( yellow)%2%ansi( grey), %ansi( grey)%2%ansi( grey))))}
#CLASS 0


Thank you Boric.
_________________
-=-=-=-=-=-=-=-=-=-=-=-=
astaria3.com : 5000
character name : Vandemar
-=-=-=-=-=-=-=-=-=-=-=-=
Zmud : 7.21
-=-=-=-=-=-=-=-=-=-=-=-=
Reply with quote
perenico
Beginner


Joined: 07 Jun 2005
Posts: 23
Location: France

PostPosted: Tue Aug 22, 2006 9:23 am   
 
hey, I just wanted to show how it looked like with the cool ansi and so on. And from now on, I'll try to post a picture with it.

_________________
-=-=-=-=-=-=-=-=-=-=-=-=
astaria3.com : 5000
character name : Vandemar
-=-=-=-=-=-=-=-=-=-=-=-=
Zmud : 7.21
-=-=-=-=-=-=-=-=-=-=-=-=
Reply with quote
perenico
Beginner


Joined: 07 Jun 2005
Posts: 23
Location: France

PostPosted: Thu Dec 14, 2006 4:41 pm   
 
Now it supports negative EP, yay me :)

Code:
#CLASS {hp_bar}
#VAR curep {1}
#VAR curhp {1}
#VAR cursp {1}
#VAR maxep {1}
#VAR maxhp {1}
#VAR maxsp {1}
#VAR perep {1}
#VAR perhp {1}
#VAR persp {1}
#VAR color {%if( %1<25, %ansi( high, red)%2%ansi( grey), %if( %1>=25 AND %1<50, %ansi( high, purple)%2%ansi( grey), %if( %1p>=50 AND %1<75, %ansi( yellow)%2%ansi( grey), %ansi( grey)%2%ansi( grey))))}
#VAR neg_ep {0}
#REGEX {^hp:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\],\s*sp:\s*\[\s*(\d+)\s*/\s*(\d+)\s*\],\s*ep:\s*\[\s*(.*\d+)\s*/\s*(\d+)\s*\]$} {
  #GAG
  #VA curhp %1
  #VA maxhp %2
  #VA cursp %3
  #VA maxsp %4
  #VA curep %5
  #IF (%begins( %5, "-")) {#VA neg_ep 0} {#VA neg_ep %5}
  #VA maxep %6
  #MATH perhp {@curhp*100/@maxhp}
  #MATH persp {@cursp*100/@maxsp}
  #MATH perep {@neg_ep*100/@maxep}
  #SAY {%ansi( grey)HP: ~[ @color(@perhp,@curhp) / @maxhp ~] SP: ~[ @color(@persp,@cursp) / @maxsp ~] EP: ~[ @color(@perep,@curep) / @maxep ~]}
  }
#CLASS 0
_________________
-=-=-=-=-=-=-=-=-=-=-=-=
astaria3.com : 5000
character name : Vandemar
-=-=-=-=-=-=-=-=-=-=-=-=
Zmud : 7.21
-=-=-=-=-=-=-=-=-=-=-=-=
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