ID:261355
 
here is my copyer code.
obj/copyer
icon='copyer.dmi'
density=1
verb
copy_items()
set src in oview(1)
var/O = input("Pick an item to copy.","Copy Items",) as obj in usr
usr << "You copy a [O:name]."
new O(usr)

but when I try and copy a scroll it does this.
runtime error: Cannot create objects of type /obj/scroll.
proc name: copy items (/obj/copyer/verb/copy_items)
usr: Green Lime (/mob/darkpaladin)
src: the copyer (/obj/copyer)
call stack:
the copyer (/obj/copyer): copy items()

All I am trying to do is make another obj just like that one in the usrs invantory. Can any one help me please?
Green Lime wrote:
here is my copyer code.
obj/copyer
icon='copyer.dmi'
density=1
verb
copy_items()
set src in oview(1)
var/atom/O = input("Pick an item to copy.","Copy Items",) as obj in usr
usr << "You copy a [O.name]."
new O.type(usr)

but when I try and copy a scroll it does this.
runtime error: Cannot create objects of type /obj/scroll.
proc name: copy items (/obj/copyer/verb/copy_items)
usr: Green Lime (/mob/darkpaladin)
src: the copyer (/obj/copyer)
call stack:
the copyer (/obj/copyer): copy items()

All I am trying to do is make another obj just like that one in the usrs invantory. Can any one help me please?

that might do it
In response to FIREking
FIREking wrote:
Green Lime wrote:
here is my copyer code.
obj/copyer
icon='copyer.dmi'
density=1
verb
copy_items()
set src in oview(1)
var/atom/O = input("Pick an item to copy.","Copy Items",) as obj in usr
usr << "You copy a [O.name]."
new O.type(usr)

but when I try and copy a scroll it does this.
runtime error: Cannot create objects of type /obj/scroll.
proc name: copy items (/obj/copyer/verb/copy_items)
usr: Green Lime (/mob/darkpaladin)
src: the copyer (/obj/copyer)
call stack:
the copyer (/obj/copyer): copy items()

All I am trying to do is make another obj just like that one in the usrs invantory. Can any one help me please?

that might do it

It makes a new of that type but I want it to copy the name and msg in the Items. So basicaly I want to make a copy of that exact item.
In response to Green Lime
There's two ways I know right off hand to make an exact copy, but they'd be overkill in this case. All you really need is to make a copy like FireKing's shown, and then just set its name and msg to the name and msg of the original one, right?
Spuzzum has a very nice line of code for this in his s_admin library. I've snipped it out and use it many times :o)

O = the object you want to copy.
var/obj/new_O  = new O.type(src)
for(var/V in O.vars)
        if(issaved(O.vars[V]))
                new_O.vars[V] = O.vars[V]
new_O.Move(usr)