ID:145481
 
Code:
mob/verb
attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = usr.str - M.def //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world
M.HP -= Damage()
M.DeathCheck()
Pickup()
Equip ()
mob/verb
Say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output
Stats ()
usr << "Your Current HP is [usr.health]."
usr << "Your strength is [usr.str]."
usr << "Your defence is [usr.def]."
usr << "Your mana is [usr.mana]."


Problem description:
loading kaefe.dme
kaefe.dm:63:error:M.HP:undefined var

kaefe.dmb - 1 error, 0 warnings (double-click on an error to jump to it)

I've the tutorials and several guides and I still don't understand the problem could someone please help with this

just add this

    var
HP = 30
Your also calling a Damage procedure
        var/damage = usr.str - M.def        //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world
M.HP -= Damage()


You should be using the variable that you created: damage to subtact the HP
        var/damage = usr.str - M.def
world << "[damage] damage!"
M.HP -= damage // - See the Variable?
In response to Worldweaver
Well, he can do that, but his way is partly right. He can set a variable to a proc, as long as the proc returns a value.

mob
proc/Damage() return 6

verb/Check_Damage()
var/D=Damage()
usr<<"The Damage() proc returns [Damage()]" //Outputs 6
usr<<"The variable D returns [D]" //Outputs 6
In response to Worldweaver
No put usr in proc.
In response to Jp
Also, you need to pass the killer (usr) as an argument to your DeathCheck proc.
In response to Mysame
src, you mean.
In response to Crashed
Euh, in a verb you can easily pass usr INTO the DC, I mean. Not using the 'usr' in the proc.
In response to Crashed
Thanks I'll try these and report back if it works or not
TheLunarWolf wrote:
Code:
> mob/verb
> attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
> usr << "You attack [M]!" //send this message to the usr
> oview() << "[usr] attacks [M]!" //send this message to everybody else
> var/damage = usr.str - M.def //assign a random # to a new variable
> world << "[damage] damage!" //tell the damage to the world

> >>M.HP<< -= Damage()

> M.DeathCheck()
> Pickup()
> Equip ()
> mob/verb
> Say(msg as text) //what the usr says is passed into "msg" as text
> world << "[usr]: [msg]" //the world sees chatroom-like output
> Stats ()

> usr << "Your Current HP is [>>usr.health<<]."

> usr << "Your strength is [usr.str]."
> usr << "Your defence is [usr.def]."
> usr << "Your mana is [usr.mana]."
>

Problem description:
loading kaefe.dme
kaefe.dm:63:error:M.HP:undefined var

kaefe.dmb - 1 error, 0 warnings (double-click on an error to jump to it)

I've the tutorials and several guides and I still don't understand the problem could someone please help with this


All you really need to do, is ensure that your variables used remain constant. What I mean by this is, if you are using health as the variable to determine the life-force of the player/monster, you must use that variable everywhere they lose or gain life-force.

The two area's I have >>pointed<< to should have been noticed by the first poster, had (s)he read your code at all. But seeing as nobody noticed this, your code should look like this:

mob/verb
attack(mob/M as mob in oview(1)) //attack a mob within 1 tile of you
usr << "You attack [M]!" //send this message to the usr
oview() << "[usr] attacks [M]!" //send this message to everybody else
var/damage = usr.str - M.def //assign a random # to a new variable
world << "[damage] damage!" //tell the damage to the world

M.health -= Damage()

M.DeathCheck()
Pickup()
Equip ()
mob/verb
Say(msg as text) //what the usr says is passed into "msg" as text
world << "[usr]: [msg]" //the world sees chatroom-like output
Stats ()

usr << "Your Current HP is [usr.health]."

usr << "Your strength is [usr.str]."
usr << "Your defence is [usr.def]."
usr << "Your mana is [usr.mana]."


--§--