Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

GMLive.gml

Livecoding for GameMaker: Studio / GameMaker Studio 2 · By YellowAfterlife

[Fixed in 1.0.54+] Enums acting weirdly in room assigned variables

A topic by EngineerKappa created Aug 19, 2021 Views: 271 Replies: 4
Viewing posts 1 to 3
(2 edits)

Hello! So far GMLive has been super helpful when it comes to testing code, but live rooms have been giving me some trouble. I notice that I get errors about an array being out of range whenever I use an enum value for variables assigned in the room editor. This only happens if it's an enum, if I replace it with a number of the equivalent value it works totally fine. I'm making a metroidvania right now, so enums are something I use a lot to keep track of things like items. Is there anything I can do to get around this?


Developer(+1)

I could use a sample project/code snippet for enum - it is possible you can fool GMLive into calculating enum values differently from base GM since it has to do so at runtime (no information about enums is left in the compiled game).

If the issue is about enum value calculation, displaying the enum values in “live” events/scripts would also show different from pre-reloaded code.

https://www.dropbox.com/s/u4yem0nbyxt1uf4/EnumTest.yyz?dl=0

This project includes an enum, an array with a few strings, and an object that draws a string from the array using the enum. It works fine when the room starts for the first time, but it gives the error I mentioned when the room reloads. This doesn't happen if the object uses the default value or an integer.  You'll also have to re-import GMLive's included files, because I didn't want to reupload those here. 

Thank you in advance, and I apologize if it's something that can't be worked around right now. 

Developer(+1)

Released a new version that fixes this - I at some point implemented an optimization so that enums and macros are only processed if they are referenced in “live” code, but room loader was not aware of this mecnahism.

Thank you so much!