ID:176277
 
I am getting this error and I have no clue why: Objects.dm:255:error: obj: expected end of statement

Here is the code:
obj/weapons/Dagger
icon = 'Weapons.dmi'
icon_state = "1"
density = 1
power = rand(1,10)

obj/weapons/BowArrow
icon = 'Weapons.dmi'
icon_state = "20"
density = 1
power = rand(1,10)

obj/weapons/Nun-Chuck
icon = 'Weapons.dmi'
icon_state = "31"
density = 1
power = rand(1,10)

obj/weapons/Lance
icon = 'Weapons.dmi'
icon_state = "12"
density = 1
power = rand(1,10)

The Line that reads: obj/weapons/Lance is the line in question in the error.

And here is where I have the weapons defined if that is a possible problem:
obj/weapons
usr.contents

verb/Get()
set src in oview(1)
view(7) << "\white [usr] gets [src.name]."
src.Move(usr)

verb/Destroy()
set src in usr
view(7) << "\white [usr] destroys a [src]"
del(src)

verb/Drop()
src.loc = usr.loc
view(7) << "\white [usr] drops a [src]"



verb/equip()
set src in usr
set category = null
if(!usr.equiped)
usr.str += src.power
src.verbs += /obj/weapons/proc/unequip
src.verbs -= /obj/weapons/verb/equip
src.suffix += "Equiped"
usr.equiped = 1
else
usr << "You already have something equiped!"

proc/unequip()
set src in usr
if(!usr.equiped)
usr << "You don't have anything equiped!"
else
usr.str -= src.power
src.verbs -= /obj/weapons/proc/unequip
src.verbs += /obj/weapons/verb/equip
src.suffix = ""
usr.equiped = 0
Trying to define a var to rand() at compile-time is impossible, and that's what's causing your error. You can only use constant values here. In procs like New() you can set up a random value.

Lummox JR
In response to Lummox JR
Lummox JR wrote:
Trying to define a var to rand() at compile-time is impossible, and that's what's causing your error. You can only use constant values here. In procs like New() you can set up a random value.

Lummox JR

Sorry Lummox, but I do not think that is the problem. I believe the error occured here:
obj/weapons/Nun-Chuck
icon = 'Weapons.dmi'
icon_state = "31"
density = 1
power = rand(1,10)


I believe the "-" in the word "Nun-Chuck" is what is causing the error.

PS: Nun-Chuck is suppost to be spelt Nunchaku


~Cable
In response to Cable
Lummox was correct... rand() cannot be assigned to something at compile time. He just missed the one you pointed out; that doesn't make the one he mentioned any less of a problem. :-)