ID:147867
 
This Login code gets 2 errors on it. Soemone help me with it.

Login(mob/M)
src.healthbar=new/obj/health_meter1//make a new health bar
src.health_meter1.update(M,M.health,M.max_health)//update it
..()


test.dm:52:error:src.health_meter1.update:undefined type: src.health_meter1.update
test.dm:25:error:src.health_meter1:undefined var
The indentation is all wrong when displayed there. I don't know whether that's because it is actually messed up in your code, or if it's just a display problem on the forum.

Also, Login() doesn't pass in a value. Get rid of that M var completely, it's useless. Use src instead.

As to the compilation errors, you're trying to refer to the var using the type path of the object it contains, instead of the var's name. Use healthbar, not health_meter1.

<code>Login() src.healthbar=new/obj/health_meter1 //make a new health bar src.healthbar.update(src, src.health, src.max_health) //update it ..()</code>

NOTE: Don't copy and paste this, because I've used spaces rather than tabs to indent. Instead, make the changes manually.
In response to Crispy
thhanx