GameMaker [IDE] Is there a way to search through object instance in rooms?

BoB3k

Member
So, I'm trying to refactor some of my objects, and this includes renaming and moving around parents and such. One thing I haven't been able to find is a way to search for object instances that have been laid out in the room editor. I know how to do CTRL-Shift-F to find stuff in all of the scripts (and this works pretty well), but I don't see anything similar for Room Editor instances beyond just the Instance Creation Order window, which doesn't really do much but show the list of instances in a single room, and you don't really wan to 'sort' by object as it is the creation order.

So, is there some sort of Explorer/Viewer in GMS2 that shows you all non-script instances of the objects, and lets you search for a list instances that are spread out in your various layers and rooms?

Thanks,
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
When you rename an object, you don't need to do anything about its instances in rooms, as they are referenced by unique ID, not the name
 

BoB3k

Member
Yes, I understand that. I'm talking about if I want to do something to all of the instances of an object. Like say I have a bunch of objBall objects spread throughout my game levels and I've decided to replace them with objCircle objects. Or, maybe I just have different creation code I want to set in all of objThing objects. The bottom line is, for whatever reason, if I need to track down all the instances of objX that I've put into my rooms in the editor, there really seams like there should be a way to do this without having to manually go from room to room and slowly scroll down the Instance Creation view.
 

Neptune

Member
The entire "room editor" is just a tool like anything else in gamemaker, and if it didnt exist, you'd be spawning instances of objects in on your own with code -- Which is a viable option for a lot of things, and for your particular dilemma, a much more flexible solution. If you think you will be constantly changing what spawns where, having your own system might be the way to go...
 

Yal

🐧 *penguin noises*
GMC Elder
There's two ways you could do a refactor like this.
  1. Add a "refactoring master script" that does with(outdatedthing){instance_create(x,y,obj_newthing); instance_destroy() }. Run it on Room Start in every room. Won't work if you still occasionally want the old objects.
  2. cat the object's YYP file and figure out what its "id" UUID is, then do a global search-replace of that string with the id of the new object's UUID with sed -i or something. (Make a backup first and make sure no resources are loaded in GMS2 while modifying files with an external program)


 

BoB3k

Member
It's nice of you guys to try and figure out weird roundabout ways to do this, I am a seasoned programmer, and could sit around all day with you and figure out kludges and hacks to do this. I was wondering if there was an actual REAL IDE way of doing it, and it sounds like there isn't. It really seams like something that should be available in the IDE. If yoyo wants us to use their room editor to make large complex levels, you should be able to do things like do searches on the rooms and layers.
 

Yal

🐧 *penguin noises*
GMC Elder
If there was an IDE way to do this, we would've let you known, and since there isn't and we're helpful, we jump instantly to kludges. (Jumping instantly to kludges gets the job done, why would you ever want to try to write good code? Nobody knows how to do that :p)

I think you can find references to object names using the Ctrl-shift-F search on an object name, but that might've been changed since GMS1. Worth a shot.

In either case, trying to delete an object that is placed in a room somewhere gives you an extra "there's still [number] references to this resource, are you sure you want to delete it?" confirmation on top of the normal deletion confirmation, so there is a behind-the-scenes tracking of the references somewhere that could be levied, even if it's not user-facing at the moment. I'd say it's worth making a bug report to request the feature, quoting this fact as supporting evidence.
 
Top