Cmud Help Needed - Health Bar

Need some help with your MUD client? Forgot your password? Get help here.
Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
Post Reply
User avatar
Kitriana
Champion
Posts: 627
Joined: 04 Mar 2010 04:46
Location: United Kingdom

Cmud Help Needed - Health Bar

Post by Kitriana » 10 Feb 2017 15:21

Does anyone know how to create a health bar in cmud?
If so -- can you provide a step by step explanation for someone who is not tech savvy (that would be me)

Thanks!
If something I wrote sounds confusing ... assume you misunderstood it.

Jooli
Adept
Posts: 100
Joined: 14 Jun 2011 16:01

Re: Cmud Help Needed - Health Bar

Post by Jooli » 10 Feb 2017 20:39

I have this in a status window. See the attached xml
Then enable status window on Window menu.
Attachments
statuswindow.xml
(1.3 KiB) Downloaded 373 times

User avatar
Melarec
Rising Hero
Posts: 318
Joined: 29 Feb 2016 19:51
Location: Everywhere
Contact:

Re: Cmud Help Needed - Health Bar

Post by Melarec » 10 Feb 2017 20:40

I'm not sure how to do it properly, but a clunky way to do it is:

Two divs; one nested in the other; exact same size; no padding or margin.
Use JS to adjust the nested div's width compared to its parent.
(It's been a while, but I'm pretty sure you just use percentages for this..)
Tie width values to specific heath points (In JS) Example:
Health at 15 out of 20; "width: 75%;" or better: "width: 15/20;" And it should do the maths itself.
Or, for a more Genesis-like system:
Health at 'Very Hurt' ; "width: 45%;" (or whatever)
This would require a lot of recursive if/else/then's, though.. (I think.) (<--Wrong.. A string list works better. Thanks for the reminder, Jooli ;) )
With the number system, all you need are replaceable variables.

Hope this helps/gives some ideas.

EDIT: Herp, that's a much better way than mine, Jooli..
Last edited by Melarec on 10 Feb 2017 20:44, edited 2 times in total.

glantri
Beginner
Posts: 11
Joined: 17 Nov 2016 23:09

Re: Cmud Help Needed - Health Bar

Post by glantri » 10 Feb 2017 20:40

There is code for that here. It works like the web client.

User avatar
Kitriana
Champion
Posts: 627
Joined: 04 Mar 2010 04:46
Location: United Kingdom

Re: Cmud Help Needed - Health Bar

Post by Kitriana » 11 Feb 2017 21:06

thanks guys -- i'll take a look and see if i can implement
If something I wrote sounds confusing ... assume you misunderstood it.

Cerin
Wanderer
Posts: 67
Joined: 26 Feb 2017 22:30

Re: Cmud Help Needed - Health Bar

Post by Cerin » 27 Feb 2017 20:02

I tried to get both to work, but neither of them want to keep my health or the enemies health updated for some reason. Just copied to notepad and saved as xml for both, but they have the same problem. Any fix for it?

Jooli
Adept
Posts: 100
Joined: 14 Jun 2011 16:01

Re: Cmud Help Needed - Health Bar

Post by Jooli » 28 Feb 2017 12:14

For my script it gets update when you do health enemy, so make a trigger to do health enemy together with your combat special

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/