Help with custom status attributes
WORM1993
28 Apr 2023, 20:50I just want to display a status attribute that reads HP: currenthp / maxhp (HP: 100 / 100)
- I created an object type called playerstats.
- I added HP as a string attribute.
- I added currenthp and maxhp as integers.
- I had the player object inherit player stats.
- I have added the inherited HP to player status.
I just can't figure out the next step. How do I make status window display what I want. Every attempt to edit the string attribute just displays what I've written.
""HP " +playerstats.currenthp+ "/" +players tats.maxhp+ ""
I am totally stumped and really am lacking the knowledge to proceed any further. Any help would really be appreciated.
![](https://i.imgur.com/t1XUS1Kb.jpg)
Jennifer Wren
29 Apr 2023, 02:25Nevermind
![](https://i.imgur.com/t1XUS1Kb.jpg)
Jennifer Wren
29 Apr 2023, 02:27Did you set a ! in the box at the top?
WORM1993
29 Apr 2023, 06:57Hi Jennifer. Thanks for replying. Where does the ! Go?
mrangel
29 Apr 2023, 17:37Status attributes display their value. If it's a string containing some text, that text will be displayed.
What you probably want to do is give your type two script attributes named changedcurrenthp
and changedmaxhp
. These would both contain a line like:
this.HP = this.currenthp + "/" + this.maxhp
Whenever currenthp
is changed, the corresponding changescript runs automatically. In this case, it would set the HP attribute to a string like "95/100", which can be displayed using the statusattributes system.
![](https://i.imgur.com/t1XUS1Kb.jpg)
Jennifer Wren
29 Apr 2023, 21:34I just used ! as the variable in the status attribute box at the top of the object's attribute page.
This is the page I followed.
https://docs.textadventures.co.uk/quest/status_attributes.html