Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

sfgml_spaces forces indentation using 4 spaces instead of tab characters. This is somewhat important when generating scripts for GMS1 because GMS1 is allergic to tabs and will remove all of them whenever it updates the script.

sfgml_hex (nowadays, sf_hint_const) will attempt to increase readability of magic numbers where available - for example, if your Haxe code had "0x10", it'll try to make GML code use "0x10" or "$10" as well.

Good reasons to target extension files instead of scripts are:

  • Allows Haxe define macros properly (instead of having to resort to enums for constants, and nothing at all for getters)
  • Allows to bypass IDE-specific issues (e.g. GMS1 compiler in >=1773 knows that array_create can have two arguments, but IDE doesn't, so you can't use that if it's in a script)

Sorry for my ignorance, but what "define macros properly" mean here? I thought GMS1 only allowed you to put macros in a special file, not in-line.

Also, is there any way to automatically generate the function calls for extension? It seems you have to manually add them to the GMS1 IDE before being able to actually call Haxe. Any way around this?

Also, after compiling, I've copied the code inside the .gmx_ file and put it inside the extension's .gml file, is that correct?

Extensions can define macros (named "constants" in the UI) and these work akin to how ones defined in the project do.

If you target an extension ( some.extension.gmx._ ), it will be auto-populated, but you might need to reload the project in GM the first time this happens. You should not have to manually copy anything.

I see, thanks for clarification.

I'm attempting to use this to build the project:

haxe -debug -lib sfhx -lib sfgml -cp src -js ../extensions/Haxe.extension.gmx_ -main Class -dce full -D sfgml-assets-path=../my_project.project.gmx -D sfgml_snake_case -D sf_pretty -D sfgml_local=_

This generates a Haxe.extension.gmx_ file which contains the generated GML code. The original .gmx file remains untouched, and so does the blank script you need to create when setting it up. Is that expected?

I've checked the files with external editors to be sure the IDE wasn't just failing to load changes.
Also, sorry for asking for support here, is there a better/preferable channel?

Please direct your attention to the dot between "gmx" and the underscore afterwards - that's what indicates to modify the extension file. "some.extension.gmx._", not "some.extension.gmx_"

Ideally you'd ask on either itch community or GitHub issues so that other people can find your question later if they have a similar one

Welp, can't believe it was just a typo all this time. Thank you very much!

Is there any way to submit merge requests to the documentation? I couldn't find the directives I asked about, so I would like to help putting them there if possible (even if it means pretty much copy-pasting your explanation).