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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Snapzilla2
Newbie


Joined: 06 Apr 2021
Posts: 4

PostPosted: Tue Apr 06, 2021 3:21 pm   

HP tick and gauge bars
 
Good Morning everyone!
Just getting back into MUDing and I have forgotten just about everything that I use to know how to do. One of my favorite was making gauges and health bars and low HP notifications. But I just cannot seem to get back into the swing for the MUD I play on.
Can someone assist me with creating it?

Current output:

Code:
Obvious exits: north.
You see two cabin boys.

(118 H 13 M): The cabin boy just wandered to the north.


I also have a "score" command that outputs:

Code:
(118 H 15 M): sc
Snapzilla the Avatar Warrior Dread Lady (lvl 14)
  118/118 Hit Points     15/ 15 Magic Points    AC: 12.9


Any help would be very welcome!
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Tue Apr 06, 2021 5:12 pm   
 
Couple of ways to go about it... My prefs is as follows
Code:
#TR {%s&{HUD.HP}~/&{HUDmaxHP} Hit Points%s&{HUD.MP}~/ &{HUD.maxMP} Magic Points%sAC: %d} {}
#VA {HUD} {}

This will trigger off of your 'score' output to set your current and max values for both HP and MP, and store those values to the @HUD as a key:value pair

Code:
#TR {~(&{HUD.HP) H &{HUD.MP} M~): %*} {}

This trigger will capture the current values to the same @HUD and over-write existing key:values

Then you can create a gauge with
Code:
#GAUGE HUD_HP HP @HUD.HP @HUD.maxHP @HUD.maxHP/5
#GAUGE HUD_MP MP @HUD.MP @HUD.maxMP @HUD.maxMP/5

You can then edit the gauges and set colors on the option and gauge tabs for text and bar respectively
Reply with quote
Snapzilla2
Newbie


Joined: 06 Apr 2021
Posts: 4

PostPosted: Fri Apr 09, 2021 6:59 pm   
 
Quick question, how are you putting this in? Create a new trigger for the session?
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Fri Apr 09, 2021 7:44 pm   
 
the way they are line by line in the Code boxes. just copy paste them to the command prompt in cmud for each one.

then you need to do 'score' at least once to get the current / max values

and your per round hp spam will keep the current values updated.
Reply with quote
Snapzilla2
Newbie


Joined: 06 Apr 2021
Posts: 4

PostPosted: Fri Apr 09, 2021 8:30 pm   
 
Doesn't seem to update. hmm, will look into it. the 'score' command updates it, just not the MUD's output
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Fri Apr 09, 2021 8:40 pm   
 
probably a pattern matching error on my part. Normally I use REGEX instead of TR but that's a whole diff can of worms.

try
Code:
#TR {~(&{HUD.HP}%sH%s&{HUD.MP}%sM~)~:%s%*} {}
Reply with quote
Snapzilla2
Newbie


Joined: 06 Apr 2021
Posts: 4

PostPosted: Fri Apr 09, 2021 8:55 pm   
 
chaossdragon wrote:
probably a pattern matching error on my part. Normally I use REGEX instead of TR but that's a whole diff can of worms.

try
Code:
#TR {~(&{HUD.HP}%sH%s&{HUD.MP}%sM~)~:%s%*} {}

Yea, same issue.
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Fri Apr 09, 2021 10:04 pm   
 
hrm it pattern matched in my client when I tested it.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4662
Location: Pensacola, FL, USA

PostPosted: Sun Apr 11, 2021 12:23 pm   
 
Usually, if you use a dbVAR to house vitals, you end up with a display issue: where the current value doesn't seem to update. if that is the case you need to use static variables instead of a DBvar. @hp rather than @hud.hp

It's also possible that the button evaluated the current value of the variable rather than use the actual variable, just type the variable name back in if so.
_________________
Discord: Shalimarwildcat
Reply with quote
chaossdragon
Apprentice


Joined: 09 Apr 2008
Posts: 167

PostPosted: Sun Apr 11, 2021 12:56 pm   
 
I've been using dbvars for my hud gauges with no issues, for half a dozen chars in three diff muds so far.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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