Skip to main content

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

Static problems

A topic by RefresherTowel created 23 days ago Views: 114 Replies: 2
Viewing posts 1 to 2

I use a lot of statics in my project, and GMLive tends not to be able to handle them in a lot of cases. For instance, inside a constructor, I have calls like

static __sprite = spr_something;
static __sprite_width = sprite_get_width(__sprite);

And GMLive doesn't seem to be able to handle the statics being set to function calls (it doesn't even seem to matter if I'm using the static sprite variable or just using a sprite asset name plainly as an argument). Same goes for particles, I setup some particles as statics in my constructors and GMLive throws errors for them as well. I also override prior statics in child constructors like this:

function Parent() constructor {
   static Draw = function() {}
}
function Child() : Parent() constructor {
   static __draw = Draw;
   static Draw = function() {
      __draw();
      // Some other code
   }
}

Which again, does not like GMLive compile the new code if I edit anything in the script (doesn't matter if I'm working with the statics at all, it just won't recompile if they exist anywhere in the constructor). The error messages are fairly generic:

[GMLive][26/06/2025 2:19:48 PM][ERROR] Error in CrewDie:DrawModifier:
[GMLive][26/06/2025 2:19:48 PM][ERROR] CrewDie:DrawModifier [line 5, col 46] Cannot compile call
[GMLive][26/06/2025 2:19:48 PM][ERROR] Error in CrewDie:
[GMLive][26/06/2025 2:19:48 PM][ERROR] CrewDie [line 29, col 46] Cannot compile call

This actually makes it surprisingly unusable for me, lol, as I use a lot of constructors and almost all of them have many, many static calls to things that GMLive does not like, so it's only the exceptional circumstances that I can even use the live reloading features (such as when I'm just working plainly with objects or something).

Developer(+1)

Ah, that would be because statics aren’t quite in the script and some of the expression transformation logic (including the bit that figures out what func() should refer to) doesn’t run on them. I’ll look into this for the next update.

You can get around it by calling a live-reloaded script in your constructor and have that in a separate file.

Ah, ok, sounds good.