Listing objects in a room the player is in

Atokrad
27 Feb 2021, 00:40

I need a way to list objects in the current room the player is in that have a certain attribute. I have a hacking mechanic that needs to list all computers in a room that are connected to a certain network which I have that network as a boolean attrabute.


mrangel
27 Feb 2021, 08:30

You can use ScopeReachableNotHeld() to get objects in the current room; or GetDirectChildren (game.pov.parent) (which is faster) if you want to ignore objects in containers and don't care if objects are visible.

You can use FilterByAttribute to filter that list down to attributes with a certain attribute. If thatnetwoork is a boolean, your script would look something like:

myList = FilterByAttribute (ScopeReachableNotHeld(), "thatnetwork", true)