ID:260134
 
I think it would be good if suffix was updated in the statpanel automatically just like stats, instead of having to manually do it.

Example
(Justin - Health: 9/10)
(Jerry - Health: 3/10)
Saying Justin and Jerry are atoms in the statpanel, if I was to change the Health variable, it would not update in the statpanel. It would just be alot easier if this was done automatically.
It can't update automatically because it can't read your mind; it doesn't know that suffix is linked to your health. So what are you suggesting then? Perhaps a suffix object that has ways to manipulate a text string rather than a suffix text string?
Just make a simple proc to do it for you, such as:
mob/proc/update_health(n)
health+=n
//deathcheck, you'll probably want to pass another arguement into update_health to support a mob
suffix="[health]/[max_health]"
mob/verb
take_10_damage()
update_health(-10)
add_10_health()
update_health(10)


Yeah, I know, it's probably tedious, but it's still easy.
In response to Loduwijk
Well, no, but other stats are updated. If you put a refer of a atom in your statpanel and it changes, it changes in your statpanel, so why can't vars linked to it?
In response to Ol' Yeller
Well yes, that is what I am currenly doing more or less.
In response to Sniper Joe
Do you understand what he's saying? DM doesn't read your mind, it doesn't know that you're trying to tie suffix and health together. Would it hurt to just update the suffix, or display the health in another column?
In response to Crashed
Crashed wrote:
DM doesn't read your mind,

Yet. >.>
mob/Stat()
src.UpdateSuffix()
statpanel("Your Suffix")
stat(src)

mob/proc/UpdateSuffix()
// Determine what you want the current suffix to say here.
src.suffix = "[rand(1, 999999)]"
return
In response to Sniper Joe
Sniper Joe wrote:
Well, no, but other stats are updated. If you put a refer of a atom in your statpanel and it changes, it changes in your statpanel, so why can't vars linked to it?

Quoth Loduwijk: "It can't update automatically because it can't read your mind; it doesn't know that suffix is linked to your health."

Let's go over the salient parts of that:

1) It can't read your mind.
2) It doesn't know suffix is linked to health.

When an atom changes, it knows to update the panel then because it's designed to display atoms in their up-to-date state. It does not know that you want the suffix to display a value based on another var.

What you're asking is silly for the same reasons that you can't set var/a=b*c or var/name="[x],[y]" at compile time. Those types of expressions get evaluated in procs. There is no mechanism in DM, or in pretty much any other language, for setting a var to a formula that's expected to auto-update as its inputs change.

Lummox JR