Colored health gauge for Group

Scripts and support for your favorite MUD client.
Kuurg
Sojourner
Posts: 398
Joined: Mon Jul 09, 2001 5:01 am
Location: Faang
Contact:

Colored health gauge for Group

Postby Kuurg » Thu Dec 13, 2001 10:20 pm

#TRIGGER {*%s(%d)/(%d)%shit,%s%d/%d%smove,%s%d/%d%spsp (%*)$} {#MATH groupstatus ((%1*10)/%2);#IF (@groupstatus<1) {#VA groupstatus 1};#IF (@groupstatus>10) {#VA groupstatus 10};#IF (@groupstatus>7) {#SUB {%line %ansi( green)%repeat( "•", @groupstatus)%ansi( black)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP};#IF (@groupstatus<=7) {#SUB {%line %ansi( yellow)%repeat( "•", @groupstatus)%ansi( black)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP};#IF (@groupstatus<=3) {#SUB {%line %ansi( red)%repeat( "•", @groupstatus)%ansi( black)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP}}
#VAR groupstatus {}

What this does is append a health gauge next to the name of the person in a group listing. Shows green from 100% down to 70%, 70% to 30% it shows yellow, and 30% down to dead it shows red.

Give it a whirl and tell me what you think.

------------------
·•Kuurg•·



[This message has been edited by Kuurg (edited 12-14-2001).]
Xebes
Sojourner
Posts: 167
Joined: Fri Jul 13, 2001 5:01 am
Location: Indiana, USA

Postby Xebes » Thu Dec 13, 2001 11:59 pm

and for people who don't use zmud :-P, here's a version of the same thing that I wrote for tinyfugue.

/def -Fp200 -ag -mregexp -t'([0-9]+)/([0-9]+).+hit,.+ ([0-9]+)/([0-9]+).+move,.+ ([0-9]+)/([0-9]+).+psp ([^ ]+)$' group_trigger = \
/let currhit %P1 %;\
/let maxhit %P2 %;\
/let groupmember %P7 %;\
/let hp_percent $[trunc(1.0 * {currhit} / {maxhit} * 100)] %;\
; /echo $[strcat("hit: ", {currhit}, " maxhit: ", {maxhit}, " hp_percent: ", {hp_percent})] %;\
/if ({hp_percent} < 16) /let condstring $[strcat("( @{BCblue}P: ", {groupmember}, " @{Cwhite}C: @{n}@{Cred}awful @{BCcyan}", {hp_percent}, "% @{n})")] %;\
/elseif ({hp_percent} < 31) /let condstring $[strcat("( @{BCblue}P: ", {groupmember}, " @{Cwhite}C: @{BCred}pretty hurt @{BCcyan}", {hp_percent}, "% @{n})")] %;\
/elseif ({hp_percent} < 51) /let condstring $[strcat("( @{BCblue}P: ", {groupmember}, " @{Cwhite}C: @{n}@{Cmagenta}nasty wounds @{BCcyan}", {hp_percent}, "% @{n})")] %;\
/elseif ({hp_percent} < 76) /let condstring $[strcat("( @{BCblue}P: ", {groupmember}, " @{Cwhite}C: @{BCmagenta}few wounds @{BCcyan}", {hp_percent}, "% @{n})")] %;\
/endif %;\
/let hpstring=$[strcat(%P1, "/", %P2, " hp")] %;\
/let movestring=$[strcat(%P3, "/", %P4, " move")] %;\
/let playerstring=$[pad("@{BCwhite}", 0, %P7, 16, "@{BCblack} -- @{n}[", 0, %{hpstring}, 16, " ", 0, %{movestring}, 16, " ]", 0)] %;\
/if (%{gag} =~ "on") \
/if ({hp_percent} < 76) \
/echo -p $[strcat({playerstring}, " ", {condstring})] %;\
/else \
/echo -p $[{playerstring}] %;\
/endif %;\
/else \
/if ({hp_percent} < 76) /echo -p @{n} $[pad({condstring}, 60)] %; /endif %;\
/endif


By the way, I like Kuurg's too, I just sometimes find TF script to be a bit more natural to read/understand than making sense of what Zmud exports- for people that like to look at posts and write their own stuff.

------------------
-<(#)>- Xebes makes your heart start to race REAL FAST!
Kuurg
Sojourner
Posts: 398
Joined: Mon Jul 09, 2001 5:01 am
Location: Faang
Contact:

Postby Kuurg » Fri Dec 14, 2001 6:00 am

was working on static length line for fixed width fonts. back burner atm.

[This message has been edited by Kuurg (edited 12-14-2001).]
Umbrog
Sojourner
Posts: 5
Joined: Fri Oct 05, 2001 5:01 am
Location: Rancho Cucamonga, CA, USA
Contact:

Postby Umbrog » Fri Dec 14, 2001 8:07 am

This feature should probably just be added to the MUD's code to match the condition colors that they already use. That'd be sweet.
Jorus
Sojourner
Posts: 277
Joined: Fri Apr 27, 2001 5:01 am
Location: Vancouver, BC
Contact:

Postby Jorus » Fri Dec 14, 2001 8:56 am

Kuurg,

I find combining the %repeat function, the %len function and some judicious use of variables allows making a line any desired length quite easily.

Regards,
Jorus
Kuurg
Sojourner
Posts: 398
Joined: Mon Jul 09, 2001 5:01 am
Location: Faang
Contact:

Postby Kuurg » Fri Dec 14, 2001 9:13 am

We are of a like mind on that. Here's what I have already. If anyone wants to test it, I haven't done so exhaustively. It might need some tweaking. specifically the line where I set 70 (rather arbitrarily) as the length to deduct %len(%line) from... here's what I had.

#TRIGGER {*%s(%d)/(%d)%shit,%s%d/%d%smove,%s%d/%d%spsp (%*)$} {#MATH groupstatus ((%1*10)/%2);#MATH groupline (70- %len( %line));#IF (@groupstatus<1) {#VA groupstatus 1};#IF (@groupstatus>10) {#VA groupstatus 10};#IF (@groupstatus>7) {#SUB {%line %repeat( " ", @groupline)%ansi( green)%repeat( "•", @groupstatus)%ansi( black)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP};#IF (@groupstatus<=7) {#SUB {%line %repeat( " ", @groupline) %ansi( yellow)%repeat( "•", @groupstatus)%ansi( black)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP};#IF (@groupstatus<=3) {#SUB {%line %repeat( " ", @groupline) %ansi( red)%repeat( "•", @groupstatus)%ansi( black)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP}}

------------------
·•Kuurg•·
Sarell
Sojourner
Posts: 1681
Joined: Mon Jan 29, 2001 6:01 am
Location: brisbane, australia

Postby Sarell » Sun Dec 14, 2003 5:21 am

Been messing with this trigger a bit, I really like it btw kuurg! Here are a few changes I made to it so that;
- Bards work (they use man not psp)
- I can see the amount of HP missing fromw a char on a black background)
- All of the group health bars are in an even column at the end of group line, for some reason or other this irked me hehe... (note if your name is longer than 11 letters column will be pushed over a bit)


#TRIGGER {*%s(%d)/(%d)%shit,%s%d/%d%smove,%s%d/%d%s{psp|man} (%*)$} {#MATH groupstatus ((%1*10)/%2);groupstatusnamelength = {%len(%3};#MATH groupstatusspace (10-@groupstatusnamelength);#IF (@groupstatus<1) {#VA groupstatus 1};#IF (@groupstatus>10) {#VA groupstatus 10};#IF (@groupstatus>7) {#SUB {%line %repeat( " ", @groupstatusspace)%ansi( green)%repeat( "•", @groupstatus)%ansi( grey)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP};#IF (@groupstatus<=7) {#SUB {%line %ansi( yellow)%repeat( "•", @groupstatus)%ansi( grey)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP};#IF (@groupstatus<=3) {#SUB {%line %ansi( red)%repeat( "•", @groupstatus)%ansi( grey)%repeat( "•", %eval( 10 - @groupstatus))}} {#NOOP}}
Gormal
Sojourner
Posts: 3917
Joined: Tue Feb 13, 2001 6:01 am
Location: A Whale's Vagina
Contact:

Postby Gormal » Mon May 31, 2004 1:19 pm

I uploaded Xebes' trigset for TF, can someone show my how to make it incoroprate bards into the mix? now that we've got their psp stuff, it messes them up and they don't get put into that nice format.
shalath
Sojourner
Posts: 310
Joined: Thu Oct 30, 2003 8:46 pm

Sure

Postby shalath » Sun Jun 06, 2004 3:17 am

Gormal wrote:I uploaded Xebes' trigset for TF, can someone show my how to make it incoroprate bards into the mix? now that we've got their psp stuff, it messes them up and they don't get put into that nice format.


Here's a fix. I've also updated some of the use of variables and substitutions so it doesn't throw a warning in pedantic mode (I can't believe you guys don't /set pedantic on!).

Edit - I somehow managed to miss out pasting the first line! Sorry, try it now and it should work :)

/def -Fp200 -ag -mregexp -t'([0-9]+)/([0-9]+).+hit,.+ ([0-9]+)/([0-9]+).+move,.+ ([0-9]+)/([0-9]+).+(psp|man) ([^ ]+)$' group_trigger = \
/let currhit %P1 %;\
/let maxhit %P2 %;\
/let groupmember %P8 %;\
/let hp_percent $[trunc(1.0 * {currhit} / {maxhit} * 100)] %;\
; /echo $[strcat("hit: ", {currhit}, " maxhit: ", {maxhit}, " hp_percent: ", {hp_percent})] %;\
/if ({hp_percent} < 16) /let condstring $[strcat("( @{BCblue}P: ", {groupmember}, " @{Cwhite}C: @{n}@{Cred}awful @{BCcyan}", {hp_percent}, "% @{n})")] %;\
/elseif ({hp_percent} < 31) /let condstring $[strcat("( @{BCblue}P: ", {groupmember}, " @{Cwhite}C: @{BCred}pretty hurt @{BCcyan}", {hp_percent}, "% @{n})")] %;\
/elseif ({hp_percent} < 51) /let condstring $[strcat("( @{BCblue}P: ", {groupmember}, " @{Cwhite}C: @{n}@{Cmagenta}nasty wounds @{BCcyan}", {hp_percent}, "% @{n})")] %;\
/elseif ({hp_percent} < 76) /let condstring $[strcat("( @{BCblue}P: ", {groupmember}, " @{Cwhite}C: @{BCmagenta}few wounds @{BCcyan}", {hp_percent}, "% @{n})")] %;\
/endif %;\
/let hpstring=$[strcat({P1}, "/", {P2}, " hp")] %;\
/let movestring=$[strcat({P3}, "/", {P4}, " move")] %;\
/let playerstring=$[pad("@{BCwhite}", 0, {P8}, 16, "@{BCblack} -- @{n}[", 0, {hpstring}, 16, " ", 0, {movestring}, 16, " ]", 0)] %;\
/if ({gag} =~ "on") \
/if ({hp_percent} < 76) \
/echo -p $[strcat({playerstring}, " ", {condstring})] %;\
/else \
/echo -p $[{playerstring}] %;\
/endif %;\
/else \
/if ({hp_percent} < 76) /echo -p @{n} $[pad({condstring}, 60)] %; /endif %;\
/endif
Last edited by shalath on Mon Jun 07, 2004 4:07 am, edited 1 time in total.
Sesexe
Sojourner
Posts: 879
Joined: Fri Oct 03, 2003 5:13 am

Postby Sesexe » Sun Jun 06, 2004 7:26 pm

Hey Kurrg and Sarell, thanks a lot for this!

Pretty kick ass and just wut I needed for my cleric :D

Thanks again! I really appreciated it!
Kuurg
Sojourner
Posts: 398
Joined: Mon Jul 09, 2001 5:01 am
Location: Faang
Contact:

Postby Kuurg » Wed Aug 02, 2006 4:45 pm

You're welcome. I'd just like to say that posting this got me so much tail. Zmud+triggers=gads of women.
·• Kuurg •·
Solak
Sojourner
Posts: 35
Joined: Fri Feb 17, 2006 3:11 am
Location: Abyss

Postby Solak » Sat Sep 30, 2006 11:42 am

I couldn't get this to work, I am using zMud 7.05. Do I need to just paste this and that's it?
Yasden
Sojourner
Posts: 1597
Joined: Sat Feb 03, 2001 6:01 am
Location: Lake Stevens, WA, USA

Postby Yasden » Sun Oct 01, 2006 9:42 pm

You'll probably have to copy the script into a .txt file, then import it.
Support Your Addiction! Vote for TorilMUD Today!

Top Mud Sites: http://www.topmudsites.com/cgi-bin/topmuds/rankem.cgi?id=shev

Why Nerox is jealous of me:

Nerox tells you 'man this thing is kicking my ass and i have blisters!'
Nerox tells you 'ok attempting it again put tape on my fingers for easier sliding'

Return to “MUD Client Help”

Who is online

Users browsing this forum: No registered users and 4 guests