Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

[Added in 1.0.63+] GMLive weird about static variables?

A topic by Cloaked Games created Oct 06, 2022 Views: 285 Replies: 2
Viewing posts 1 to 2
(1 edit)

I am having some trouble with static variables. If I try to live run a function containing static variables, upon reloading it I get the error: "Expected a statement, got ident". If I make those variables as local var instead, it works as expected.

I don't know if this is a bug, if GMLive just doesn't support static variables (I checked documentation about this, but I may have missed it), or if there is something I'm doing wrong. I'm brand new to GMLive and I just wanted to clarify my understanding. For now, I'm using local variables instead while live coding, it's not a problem.

I can provide a code snippet if necessary. I'm on IDE v2022.8.1.37, Runtime v2022.8.1.53, GMLive Version 1.0.62

Thanks! GMLive has already paid itself off in time saved even with the debugging I've done to figure out how to use it.

Developer

I am currently working on supporting static variables, but there is a range of problems:

  • There is not a way to get/set static variables like you usually would with variable_ functions, so I can’t automatically pick up the existing static variables and they’ll be re-initialized.
  • Constructors are worse - if you change a static variable in the constructor itself, the change will be reflected across all instances of the constructor. There is not a way to do that “dynamically” in GML, but people can probably do without it.
  • Constructor inheritance is much worse - technically inheritance just calls the parent constructor in the beginning of child constructor, but this will not grant you static variables from it - you have to use new on it, so a “live” constructor would have to construct the nearest non-live parent and add functions on top of it.

Awesome! Thanks for the reply.

As long as I'm not losing my mind, and it is indeed not yet supported. Makes sense, all good. I can definitely imagine all the problems that would come with that, GMLive is a complicated beast. Good luck with that, haha.