GML Instance room editor id aka name

L

LoF

Guest
Hey, is there any way how to get that instance name from the room editor? "inst_something" by default. I'm trying to edit some things in game - for visual aid, save them to a file and load back once game is restarted. Now I can't store instance's id as this may vary between game runs so the instance name seems to be the perfect choice - if I could obtain it. One obsure wayaround would be to store the instance's objectIndex, x & y and use these three as an identificator. But you know this is just a twisted idea.

Thanks for help,
lof
 
Last edited by a moderator:
L

LoF

Guest
Hell you know, first off there's a limitation of not having 2 objects of the same index on the same position (shouldn't be limiting in most of the cases tho) but I just don't like this approach. If you are a good coder you should'nt be upvoting this idea neither. Especially when the appropriate identificar exists. It might be just missing a getter function. It would be easy to patch up the XML room data storage as it was in 1.4 if gms2 wouldn't be using this damned json + guid 💩💩💩💩 structure.
 
L

LoF

Guest
Working on a game, in need of an extended room editor. With things like a jump preview (it's a platformer) and other fancy stuff. For example - you want to change the distance where some script triggers. Doing this inside the native gms2 editor is just a waste of time - using yal's GMLive helps but still. You need to visualise these things. So far so good. But now the question is how to save the changes you do.
You could like take the notes and paste your stuff inside the creation code or user vars (whatever you like) but cmon.

Limitation is that in this case the identificator wouldn't be, well, an identificator. Unique.
 
Does the instance really need the same id across different sessions? I'm still not seeing why creating an instance in-game, saving its object index and coordinates to a file, and then reading them back during a new session to recreate the instance would be an issue (as well as somehow not allowing overlapping). Unless I'm majorly misunderstanding something, this sounds like you're complicating the scenario.
 

TsukaYuriko

☄️
Forum Staff
Moderator
I'm not aware of such a function. Keep in mind that the instance "name" is really just a constant with the instance's ID as its value.
 

TsukaYuriko

☄️
Forum Staff
Moderator
How would that work? There's no way to turn a variable/constant name into a string (as of writing), so this would be a fair bit more than just adding a _get function for it. Feel free to file it as a suggestion and see how it goes, though.
 
Top