By using the Overlays library to create stat bars you get all of the easy ways to manipulate overlays that the library provides. You can change a stat bar's position, icon, layer. You can also easily control who the stat bar is visible to. It's very easy to make your health meter only visible to people in your party, or, in an RTS, make health meters on your units that are visible only to you.
The demo I added uses a slightly different approach than the other library. I prefer to define things this way:
HealthMeter
parent_type = /StatBar
stat_name = "health"
max_name = "max_health"
icon = 'overlays-demo-icons.dmi'
num_states = 15
state_name = "health-bar-"
New()
..()
// shift the overlay down 7 pixels
overlay.PixelY(-7)
// to create the health meter:
mob.health_meter = new /HealthMeter(mob)
Instead of this way:
mob.health_meter = new /bar_overlay(mob, 'health-bar.dmi', 15, "health", "max_health", pixel_y = -7, state_prefix = "health-bar-")
The second approach has the definition of the health bar's properties in the same place where you're using the health bar. The first example gives you a separate place for defining the properties of the health meter. That way, if they get more complex, it doesn't complicate the code that simply uses the health meter.
Also, by creating a custom object type to be your health meter, you can add additional procs (or override existing ones) to change how it works. When every stat bar uses the /bar_overlay type, you're stuck with the same behavior for each one.
Although I like how you automatically determine the num_states if it's unspecified. That's pretty handy.