ID:146391
 
Code:
mob
Login()
new /obj/healthmeter(client)
new /obj/cpmeter(client)
new /obj/expmeter(client)
..()

obj
var/width = 16
var/num = 0
healthmeter // hud health meter
name = "HP"
icon = 'meter1.dmi'
screen_loc = "7,6"
icon_state = "0"

cpmeter // hud cp meter
name = "CP"
icon = 'meter2.dmi'
screen_loc = "7,6"
icon_state = "0"

expmeter // hud xp meter
name = "EXP"
icon = 'meter3.dmi'
screen_loc = "7,6"
icon_state = "0"

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)]"


Problem description: Simply put, this isn't working. No icons are being shown. I am absolutely sure that each icon file contains icon states from 0 to 16, and, although I highly doubt it, the fact that the login proc is in a different file might be a factor in something. There are also no compilation errors.

Add this to the Login.
src.client.screen += new/obj/HUD // Define hub type path here

:)
In response to Sniper Joe
I tried that, as well. Didn't work.
mob/var/tmp/object/healthmeter/HM //define the health meter's location
mob/Login()
..()
HM=new //create a new healthmeter and store it in HM
WM.screen_loc="1,17"//set HM's screen loc (where it the co-ords it will appear on screen
client.screen+=HM//add HM to the client's screen


Do something like that for all of the other meters, and you could probably add them to the player's statpanel too like this:

mob/Stat()
WM.Update()
stat(WM)


Having the meters appear in the statpanel is a good idea because it means that you can call the Update() proc and it'll affect the one on the client's screen as well.
In response to Fartmonger
Thanks.