ID:144014
 
Code:
        Drop()
set category="Commands"
set src in usr
if(src.equipped==0)
if(src.icon_state=="Table")
src.Move(usr.loc)
src.density=1
usr << "You drop [src]!"
else
// src.Move(usr.loc)
new src in usr.loc //takes it out of the inventory and drops it where you are standing
usr << "You drop [src]!"
else
usr << "You can't drop that, it's equipped!"


Problem description:
Well, I'm trying to make it so it will create a new instance of the object your dropping at your location, instead of just moving the object from your inventory onto the ground. I'm sure it's bad coding on my part, but can anyone help me with this? Here's the runtime error:

runtime error: Cannot create objects of type /Items/Large_Fish.
proc name: Drop (/Items/verb/Drop)
usr: {OWNER} Mikal (/mob/character)
src: Large Fish (/Items/Large_Fish)
call stack:
Large Fish (/Items/Large_Fish): Drop()
Why did you comment out src.Move(usr.loc), which is closer to being correct? (Better would be src.loc=usr.loc.) Creating a new object won't delete the old one.

The error is coming from bad syntax:

new src in usr.loc


new() is a proc, remember, so it'd actually be new src(usr.loc). But, that won't quite work either, because src is an object, not a type path. To create a new object of src's same type, you'd need this:

new type(usr.loc)


But, all that said, you're far better off just using src.loc=usr.loc instead.

Also, your equipment system needs fixing, because the src.equipped var shouldn't even exist. It needs to be the mob's job to keep track of which items are in use.

Lummox JR