• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code Multiple scripts per file / external editing

xDGameStudios

GameMaker Staff
GameMaker Dev.
I'm creating a set of (GSM2 standalone) tools to use in conjunction with GMS2, to help develop games and apps. Being able to create one single file containing a bunch of scripts would be great, I heard it can be done with extensions but I need for the file to be editable after being generated for the user to had custom code to it, afterward (even be refreshed by the GUI).
Would this be possible to do?!
For example, adding objects externally...
I have one parent object, "obj_player" inside my game project and then I have one tool that is a PlayerGenerator app that is a graphical app that automatically creates a new object child of obj_player that has a whole bunch of code within it, and adds it to the game project
Can this be done?!
Thank you for your time
 

chamaeleon

Member
Sure, the GM files are plain text or XML depending on what you look at. Your main issue is going to be figuring out how to modify XML files appropriately as the structure is not documented and I believe I have read they have no plans to do it. One other potential issue, while code is supposedly reloaded when edited outside it is entirely possible the same is not the case for objects and anything else based on XML files. They may be parsed only when the project is loaded, and no reload when edited outside GM (in which case saving the project could overwrite any changes made outside GM). If you plan to use these generation tools while the project is not loaded, it should be safe (to the extent you modify the XML correctly..)
 

xDGameStudios

GameMaker Staff
GameMaker Dev.
Sure, the GM files are plain text or XML depending on what you look at. Your main issue is going to be figuring out how to modify XML files appropriately as the structure is not documented and I believe I have read they have no plans to do it. One other potential issue, while code is supposedly reloaded when edited outside it is entirely possible the same is not the case for objects and anything else based on XML files. They may be parsed only when the project is loaded, and no reload when edited outside GM (in which case saving the project could overwrite any changes made outside GM). If you plan to use these generation tools while the project is not loaded, it should be safe (to the extent you modify the XML correctly..)
Thank you for your reply :)
 

Mick

Member
Sure, the GM files are plain text or XML depending on what you look at.
For GMS1.x this is true, GMS2 uses json. The most tricky part with the new project structure is the GUIDs (unique identifiers). It should be quite easy to generate these GUIDs in other environments though, in C#: Guid id = Guid.NewGuid();
 

chamaeleon

Member
For GMS1.x this is true, GMS2 uses json. The most tricky part with the new project structure is the GUIDs (unique identifiers). It should be quite easy to generate these GUIDs in other environments though, in C#: Guid id = Guid.NewGuid();
Yeah, you're right about that. GMS2 uses JSON of course. Temporary brain malfunction.
 
Top