Why yes, I do ask a lot of questions.
At one point in the game, I store this information:
var/potato = /obj/food
Essentially what I stored was the class path for something. If I wanted to create an obj based off of the type path stored in potato, how would I do that? I tried
var/potato/n = new
But that gets me errors. Any help? Sorry if the question is worded strangely, comment if you need clarification.
edit: One way I've thought about doing it is saying
if(potato == /obj/food) var/obj/food/a = new
But that's not very modular. Usable, but annoying.
ID:155609
May 6 2011, 7:50 am (Edited on May 6 2011, 8:06 am)
|
|
var/Food = "/obj/Potatoe" Doing var/[whatever] defines a new var, you dont need to define your potato var again since you already defined it. So typically you would just create a new atom with "new /example/example" but since you defined the path in a var you can just replace it with the var. |
In response to Turles
|
|
That worked, thank you!
|
In response to Stephen001
|
|
Works for making multiple instances pretty well. Thanks.
|
In response to Stephen001
|
|
kenan << "Kel loves orange soda..." Is it true? |
100% untested, but that's what my memory says. Give it a whirl.