ID:266663
 
Ok I made all the icons does anyone know how to make the "meter" go in a hud?
Easy, i do this using spuzzums meter snippet, using screen_loc = "1,8" under the New() proc, like this:

obj
hud
icon = 'hudstuff.dmi'
Say
icon_state = "say"
New()
src.screen_loc="0,2"
usr.client.screen+=src
Click()
usr.say()
mob/Login()
new /obj/hud/Say(src) <<just replace the /obj/hud/say with whatever you have as your health meter
http://www.byond.com/hub/Sariat/BYONDcodeclient

Go there for a HUD demo. It shows you how to update health.
In response to NilFisk
client/New()
new/obj/meter(src)


obj/meter
icon = 'meter.dmi'
icon_state = "0" //that's zero, not ( ) or O

var/num = 0 //the current unrounded icon_state number
var/width = 100
//If you have icon_states from "0" to "30" within your
// meter.dmi file (i.e. you have 31 icon_states in total),
// use this number as it is.

//Change it if you have any other number of states;
// if you have states from "0" to "5", this number would
// be 5 instead.

proc/Update()
if(num < 0) //if the meter is negative
num = 0 //set it to zero
else if(num > width) //if the meter is over 100%
num = width //set it to 100%
src.icon_state = "[round(src.num)]"
New(client/C)
screen_loc = "12,1"
C.screen+=src


like that?
In response to Strange Kidd
You can optimize this section:

if(num < 0) //if the meter is negative
num = 0 //set it to zero
else if(num > width) //if the meter is over 100%
num = width //set it to 100%

with:
num = max(0,min(num,100))

basically what this does is:
Invoke the max proc, which returns the highest value between the two arguments, which are:
0 and the result of the second proc min()

Min will return the lowest between the two varaibles, 100 or num.

So basically this is both of your if() statements in one single line. It's also more efficient as the min & max procs seem to execute faster than the if() procs...