this is the error i get when i try to use a code:
runtime error: Undefined operation
proc name: Bash (/mob/student/verb/Bash)
usr: Delita12345 (/mob/student)
src: the student (/mob/student)
call stack:
the student (/mob/student): Bash()
Here's the code snippet:
mob/student
icon = 'student.dmi'
var
M
health = 100
strength = 3
intel = 2
damage
verb/Chat(msg as text)
world << "[usr] says: [msg]"
verb/Break(obj/window in view(1))
icon_state = "broken"
verb/Bash() //THIS PART I'M HAVING TROUBLE WITH.
set src in oview(1)
damage = (usr/strength * 2) - src/intel
view() << "[usr] bashes [src] for [damage] points!"
Stat()
stat("health",health)
stat("Strength",strength)
stat("Intelligence",intel)
statpanel("Inventory",contents)
ID:176993
Nov 22 2002, 6:18 am
|
|
In response to Lummox JR
|
|
OK but it says "error:usr.strength:undefined var"
|
In response to Delita12345
|
|
That is because usr is of type /mob, not /mob/student. You'll have to re-define var/strength, or cast usr to another var that is of type mob/student.
|
In response to Garthor
|
|
How would i do that?
|
You're using / wrong. The / operator is for type paths and for division. What you should be using is . instead.
Lummox JR