ID:148038
 
<dm>I'm working on a health meter for my hud, and I got that as a runtime error. This is the proc that is supposed to check hp and change the HPMeter accordingly along with the actual error:
proc/HPCheck(client/C,hp)
var/obj/hud/HPMeter/H=locate(/obj/hud/HPMeter) in C.screen
for(var/x=1,x<17,x++)
if(hp>=H.nums[x])
icon_state="[H.nums[x]]"
x=17

runtime error: undefined variable /mob/player/blue/var/screen

Here is the objects code if you would like to see it:

HPMeter
icon='HUD_hp.dmi'
icon_state="90"
var/list/nums[16]
New(client/C)
screen_loc="1,1"
C.screen+=src
var/counter=1
for(var/x=90,x>=0,x-=6)
nums[counter]=x
counter++

I can't seem to get this to work so if you know what is wrong, or know of a better way to do this type of thing I'd like to hear it. Thanks. :)</17>
You're passing the mob, rather than the client, into HPCheck().
In response to Crispy
Ahhh wonderful, thanks a bunch. :)