ID:144088
 
Code:
Scenary/MatterConverterStuff//  Scenary is just another Datum derrived from the parent_type of /obj/
icon = 'items.dmi'
density = 1

ComputerSystem
name = "Matter Converter System"
icon_state = "comp"
var/list/BuildableObjects = list(/Items/Radio,/Items/clothes/Jumper1)// I tried fist this list as the Items name and below code to search for it but that didnt work so I tried the type.
Click()
if(get_step_away(src,usr,1))
switch(alert("What would you like to do?","[src]","Build","Refuel","Nothing"))// I am not doing refuel until I get Build working
if("Nothing")
return
if("Build")
var/EnergyAvaliable = 0
for(var/Scenary/MatterConverterStuff/Energy/E in orange())
EnergyAvaliable += E.Energy
if(alert("Energy Avaliable: [EnergyAvaliable]","Energy","Continue","Cancel")=="Cancel") return
var/BuildWhat = input("Please Choose what you wish to build.","Build") in src.BuildableObjects + list("Cancel")
if(BuildWhat=="Cancel")
return
for(var/Items/Q in typesof(/Items/))
if(Q.type == BuildWhat)
for(var/Scenary/MatterConverterStuff/Ring/R in orange())
new Q(R.loc)
view(5)<<"A [Q] appears out of nowhere on top of the [R]!"
return



Energy// This isn’t used yet, when its working properly I am adding in the fact that it needs the power so it will minus it from these storage devices
name = "Energy Storage"
icon = 'tardis.dmi'
icon_state = "control9"
var/Energy
New()
.=..()
spawn()
src.Energy = rand(100,500)
Click()
if(get_step_away(src,usr,1))
usr<<"There is [src.Energy] stored."

Ring
name = "Matterilization Ring"
icon_state = "Portable device"
density = 0
layer = TURF_LAYER+1// I never mentioned that all Scenary has a layer of OBJ_LAYER+2 unless otherwise specified


Problem description:

Basically a fellow BYONDer made a 'Matter Converter' for his upcoming Stargate game and I thought, "Hey Something like that could be put into Doctor Who Online"
So I started working on it this morning and like the cautious person I am I tested it. To my horror it didn't work! Well at least it had all the alert()'s and the input() but when it came down to the creation of the object nothing happened...

Here is the real problem:
As you can see the code that is obviously causing the problem must be
                        for(var/Items/Q in typesof(/Items/))
if(Q.type == BuildWhat)
for(var/Scenary/MatterConverterStuff/Ring/R in orange())
new Q(R.loc)
view(5)<<"A [Q] appears out of nowhere on top of the [R]!"
return

Which is basically searching though a list of Items (Infact all the things under the parent_type /Items/)
and creating it or at least should be.
So anyway I want a real answer for how to do this. Kaze can call me an idea ripper if he likes because this probably wont go into the final version but I still wish to know how to do it because it may open up other ways of creating a futuristic crafting system.
Thanks in advance,
Lyndon

Oh and no telling me to go look at the DM guide because you'd be making me have the worst Easter ever with that comment (What you expect me to trawl through that thing when I already have before on several occasions?)
Oh yeah and I am aware I spelt Scenery and I am now fixing it.
Thanks for stealing my idea =P You will be approached by your local authorities. j/k..

(removed al my wrong solutions)
Lyndonarmitage1 wrote:
for(var/Items/Q in typesof(/Items/))


You're looping threw a list of TYPE PATHS, which is what typesof() returns. You're treating the list items as objects,when they are type paths. Also, you have an object filter in the for() loop (it loops only threw objects of type /Items and derived from that type), so it won't run at all because there aren't any objects in the list at any case; again, only type paths.
In response to Kaioken (#2)
thanks for replying mate yeah, after a while of people bot responding and me and Kaze scratching our geads we realised that I was searching for "Items" not Items/Paths
So I attempted to use text to path but to no avail So I srcatched the whole thing and starated over with Blueprint objects that would be placed within the machine. These contained the variables of: MatterType, which had the type path stored in it and then their was the MatterName and HowMuchEnergyDrained.
In response to Lyndonarmitage1 (#3)
Ok, ripping the idea, fine, ripping my variable names, no =P, even ripping the blueprint part, no =P