Legacy GM [SOLVED]Does anyone know where the file for object information might be?

I'm trying to make a text editor so that I can clean up messy scripts, and object events. I've already seen someones asset to do this in a windows environment, but want to make mine work solely in GML (albeit with some extensions)

Currently I have scripts / object details exported as text, and those are stored in the included files. The aim is to edit them, and then be able to reinsert them into the original location.

I'd like that to be fairly automatic - which isn't a problem as of now for saving them in the included files. I also know what directory scripts are in, and they seem to only be a text file with a modified GMS type. No idea yet whether scripts can be edited like this, but that's not the issue.

I'm unsure where the original files (where GMS itself defines the actual game data, and compiles from) are stored for objects. When you use "show information" (in the object properties window) it generates a file that can then be saved. Ideally I want to edit that result and put it back to where it was generated from.

Ignoring for now whether this is sensible to edit them (I'll assume it's not advisable editing data it's trying to run as an executable) does anyone know the game data location for objects events, and what the file is called?

I opened an object with Visual Studio and can see that it does have code that's readable, but, er, am not at all versed in Visual Studio.....is all the information that GMS reads stored there? (it looks like it is, but I wouldn't have a clue as to how it functions)

Code:
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
  <spriteName>&lt;undefined&gt;</spriteName>
  <solid>0</solid>
  <visible>-1</visible>
  <depth>0</depth>
  <persistent>0</persistent>
  <parentName>&lt;undefined&gt;</parentName>
  <maskName>&lt;undefined&gt;</maskName>
  <events>
    <event eventtype="8" enumb="73">
      <action>
        <libid>1</libid>
        <id>603</id>
        <kind>7</kind>
        <userelative>0</userelative>
        <isquestion>0</isquestion>
        <useapplyto>-1</useapplyto>
        <exetype>2</exetype>
        <functionname></functionname>
        <codestring></codestring>
        <whoName>self</whoName>
        <relative>0</relative>
        <isnot>0</isnot>
        <arguments>
          <argument>
            <kind>1</kind>
            <string>draw_circle(x, y, 50, false);
</string>
          </argument>
        </arguments>
      </action>
    </event>
  </events>
  <PhysicsObject>0</PhysicsObject>
  <PhysicsObjectSensor>0</PhysicsObjectSensor>
  <PhysicsObjectShape>0</PhysicsObjectShape>
  <PhysicsObjectDensity>0.5</PhysicsObjectDensity>
  <PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
  <PhysicsObjectGroup>0</PhysicsObjectGroup>
  <PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
  <PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
  <PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
  <PhysicsObjectAwake>-1</PhysicsObjectAwake>
  <PhysicsObjectKinematic>0</PhysicsObjectKinematic>
  <PhysicsShapePoints/>
</object>
I get the same text as above if I open a GML object in notepad, but I haven't a clue what the format is, or where it refers to any data.

So is it just a pointer of some kind to another area? And, if so, where - and can it be accessed?

@Nocturne @TsukaYuriko @Yal
My apologies if this isn't the correct way to do this, but having posted this in 'programming' it occurred to me it might get a better response in the advanced section. I do have access to post there - would it be possible to get it moved? Thanks :)
 
Last edited:

TailBit

Member
This folder:
C:\Users\USERNAME\Documents\GameMakerStudio2\PROJECTNAME
Couldn't you just have tried to save a new project to figure that out?

Most of them seem to be json files, and if you change a file then GMS2 should notice and ask if it should refresh them..

There was however a topic about a bug with saving atm, so it is not possible to save outside the working directory even if you have disabled the option that should be blocking it.
 
@TailBit
Yeahhhhh, but I don't use GMS 2 for one thing. It's marked as such up above....

Maybe I worded it wrongly: I know where the game directory is, its where the information for an object is stored (or, rather, how its stored) that I am unsure of. I get the same text as above if I open a GML object in notepad, but I haven't a clue what the format is, or where it refers to any data.

So is it just a pointer of some kind to another area? And, if so, where - and can it be accessed?
 

TailBit

Member
It is using markup language, that should give you something look up .. like in html and xml, if you have been building websites .. hm, actually, this could be straight up xml.

But yeah, every tag have a start and a end .. the end is marked with /
<object></object>
Everything between there is information about that object..

Maybe put a comment in some events to get a clearer picture.

But it will be some work to figure out what event belongs to which number:
Code:
  <events> // list of all event 
    <event eventtype="0" enumb="0">// seem to be create event
      // and that event's information is in here
    </event>
    <event eventtype="2" enumb="0">
      // event information
    </event>
  </event>
and they seem to use the sprite names directly:
Code:
  <spriteName>&lt;undefined&gt;</spriteName>
  <spriteName>sprRecord</spriteName> // another object got
 
@TailBit
That's useful to know about it being xml, or HTML.

When you save the output of "show information" it does so in a HTML format (at least for me), so I've just been copying the displayed result as text to paste into a standard file. This makes it readable / editable for basic text functions, but has perhaps come from a stage where GMS has already parsed and stripped out these markups. I will generate a new example and see what it looks like in the original format.

Thanks!

EDIT:
I opened up an object in Notepad that had entries (which I guess the first didn't) and it is easy to see how the information is stored within these tags. So I will see about manipulating them.

Thanks for your help - it's clarified some things for me.
 
Last edited:

Yal

šŸ§ *penguin noises*
GMC Elder
Fun fact, I got no notification by that atting. Not sure why, because I've seen other people show up when I mention them. Maybe my awareness skill is just so low I auto-fail attention rolls.

What you want to do is to click this thing:
upload_2019-11-13_23-49-54.png

Then open the subfolder "objects" and you'll find all the object files. The structure is much more straightforward in GMS1 than GMS2 (I haven't checked GMS2's file format in a while so don't ask me how it's different): objects are basically XML files with embedded GML code. One big thing to be aware of is that <, >, & and potentially some other characters I forgot about all are escaped in these files (since they have special meaning in XML), so you'll see &quot;, &amp; and so on instead. Be careful when messing around with these files, and take proper backups before you change any files. Also make sure GM isn't running if you're going to do replace files, or it could overwrite them again with stuff stored in memory, or other weird results.
 
Fun fact, I got no notification by that atting
No worries :) Thanks for replying. In retrospect it's perhaps not really something that needed moving, and TailBits reply cracked it for me. I've got a good idea how to edit it now (the GML code is a string, helpfully marked by <string> </string>)., and will mark this as solved.


EDIT: Just in case you mention it: I know that the unseen text editor characters need maintaining when text is replaced in the string, and its reinserted into the text file.
 
Last edited:
@TailBit I did @ them after it was originally posted :) I don't know if we can move a topic ourselves, but in the end it was much more straightforward than I thought. Your help me made take a second look, and see how they can be edited. Cheers!
 
Top