|
Snapzilla2 Newbie
Joined: 06 Apr 2021 Posts: 4
|
Posted: 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! |
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: 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 |
|
|
|
Snapzilla2 Newbie
Joined: 06 Apr 2021 Posts: 4
|
Posted: Fri Apr 09, 2021 6:59 pm |
Quick question, how are you putting this in? Create a new trigger for the session?
|
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: 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. |
|
|
|
Snapzilla2 Newbie
Joined: 06 Apr 2021 Posts: 4
|
Posted: 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
|
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: 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%*} {} |
|
|
|
|
Snapzilla2 Newbie
Joined: 06 Apr 2021 Posts: 4
|
Posted: 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. |
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: Fri Apr 09, 2021 10:04 pm |
hrm it pattern matched in my client when I tested it.
|
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4692 Location: Pensacola, FL, USA
|
Posted: 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 |
|
|
|
chaossdragon Apprentice
Joined: 09 Apr 2008 Posts: 168
|
Posted: 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.
|
|
|
|
|
|