ID:1585050
 
(See the best response by Nadrew.)
Problem description:
Hello everybody, I am stuck on trying to figure out how I would go about finding anything that is within a set path and then adding it onto a list.

For example: I am trying to figure out how to add anything that is under the path of
/obj/Weapons
and add it onto a All_Weapons list.

I know how to easily do it if I were to set a variable to search for , something like:
var/list/All_Weapons = list()

mob/proc
Add_To_List(weapon)

var/Weapon = text2path("/obj/Weapons/[weapon]")
global.All_Weapons += Weapon
world<<Weapon


But I have no idea how to just take in ANYTHING after a set path, will I have add in some variables in order to get something like this to work?
Best response
You'd use the typesof() proc.

for(var/W in typesof(/obj/Weapons)-/obj/Weapons)
// We do -/obj/Weapons because we don't want the parent showing
src << "Type: [W]"


That should get ya going.
Wow, thanks for the quick reply! works perfectly! :D
I guess I should of looked further into DM references before I made this post :P