ID:139772
 
I've been fighting with this code for hours scratching my head I don't know why but I keep getting thid error
Testworld.dm:22:error: M.hp: undefined var
Testworld.dm:24:error: M/:/deathcheck: undefined proc

Code:
mob
verb
Attack(mob/M as mob in oview(1))
var/damage = usr.str - M.def
if(damage <= 0)
usr << "[M] easily dodges your attack!"
M << "You easily dodge [usr]'s attack."
else
M.hp -= damage
view() << "[usr] attacks [M] for [damage] HP!"
M:deathcheck()


Problem description:

Tajiri wrote:
I've been fighting with this code for hours scratching my head I don't know why but I keep getting thid error
Testworld.dm:22:error: M.hp: undefined var
Testworld.dm:24:error: M/:/deathcheck: undefined proc

Code:
> mob
> verb
> Attack(mob/M as mob in oview(1))
> var/damage = usr.str - M.def
> if(damage <= 0)
> usr << "[M] easily dodges your attack!"
> M << "You easily dodge [usr]'s attack."
> else
> M.hp -= damage
> view() << "[usr] attacks [M] for [damage] HP!"
> M:deathcheck()
>
>

Problem description:


1: Did you make a variable for the hp?
mob/var
{
hp = 100
}


2: You probily mean M.deathcheck()
In response to Deathscyth15
Umm..Idk...Can you send me to the reference for variables...or give me a better example? xD
In response to Tajiri
Yeah sorry i edit my post i pushed the wrong button. >_<


`Deatshcyth
In response to Deathscyth15
Thanks let me try this!
You did not define mob/var/hp. You also did not define deathcheck() anywhere. You are also using the : operator, which is more or less terrible. So, use . instead and define mob/proc/deathcheck()