ID:1454901
 
(See the best response by Stephen001.)
So I had an expert write me a code here recently and he made a mistake. He wrote new with pick like this:
new pick(/obj/scroll, /obj/book, obj/sword) //etc...

It gives an error. I guess I can see that you can't use an argument with new but you can use new as one of the pick arguments as you will see. The next thing I did was this:

new( pick(/obj/scroll, /obj/book, obj/sword)) //etc...

It gave no error but it didn't work. So finally I did this:

pick(new/obj/scroll, new/obj/book, new/obj/sword) //etc...

and it worked!
Best response
var/type = pick(/obj/scroll, /obj/book, obj/sword)
var/object = new type()


I think also works, and doesn't produce a new object of each type, which is what you're doing in that third example.
Oh I made an object of each type?
Yep, that's what each new call does, in your example. Odds are, the ones you don't pick() get cleaned up at the end of the proc call, but yes, you made an object of each type.
So will they be deleted after pick finishes?
Not after the pick() call, after the proc that's inside finishes.
Hey, yeah it works:

mob/verb/add_obj()
var/obj/weapon/w=pick(/obj/weapon/sword, /obj/weapon/knife, /obj/weapon/gun)
new w(src)