ID:570490
 
(See the best response by Kaiochao.)
Srry about all the questions, I am kinda of a noob coder :D.

I want to create a multiple number of objects under a certain path and put them into a list. Kinda looks like this maybe:

mob/var/list/list1 = new()

then If I want to add those types of to that list:

usr.list1 += typesof(/obj/cards/Pack1/)
usr.list1 -= /obj/cards/Pack1

The first bit is the list I want to add to. The next bit is to add the types of objects that are under that tree and in other sub categorys. and remove the original one so no mess ups occur.

I mean I want to add anything under that, even these ones:

usr.list1 += typesof(/obj/cards/Pack1/)
/obj/cards/Pack1/Monsters
/obj/cards/Pack1/Spells
/obj/cards/Pack1/Traps

Please let me know if you need more of a debrief.




It should just do that. IIRC, typesof(/obj/cards/Pack1/) will return a list of paths that fall under Pack1, but not Pack1 itself. To include Pack1 you would remove the last "/".

If you want to add the actual objects to the list instead of just the type paths, you'll need to use a for(var in list) loop, where the list is typesof(), then create a new object from each reference and add them to your list of cards individually. This is only necessary if you need them to function as actual objects from within the list or if they need to retain certain variable changes.
Best response
http://www.byond.com/forum/?post=195055

And as for adding the actual objects to the list instead of their types, you need to loop through a list of types and add a 'new' instance of each object.
//  The final list of objects
var L[0]

// The list containing types of objects to be made
var paths[] = nulliparae(/obj/cards/Pack1)

// Loop through all the paths
for(var/path in paths)
// Add a new object of type 'path' to L
L += new path
Whats the purpose of Nulliparae?
In response to KingMat007
It works like typesof() but excludes all paths that have children. Read the post for an actual explanation.