Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

[Fixed in 1.0.32+] Enums referencing other enums as values busted in 1.0.26

A topic by Zargy created Sep 27, 2020 Views: 294 Replies: 3
Viewing posts 1 to 3
(1 edit)

I am running GMS 2.2.5.481, runtime 2.2.5.378. I purchased GMLive and downloaded the 1.0.26 version for GMS2. I cannot upgrade to 2.3 due to work requirements. I have this bit of code:

if(live_call()) return live_result;

 
enum TestEnum1 {
Value1,
Value2,
Value3,
Sizeof,
}

enum TestEnum2 {
Value1 = TestEnum1.Sizeof,
Value2,
Value3,
}

Any attempt at reloading results in the error:

[live][9/27/2020 6:08:14 PM] Error in test_enum:
[live][9/27/2020 6:08:14 PM] test_enum[L11,c20] Enum values should be constant

Clearly the value of another enum is a constant. Why does this not work? We use this pattern of using values of earlier enums all over our code base, mostly in files that also happen to contain the code that we most need to reload live (player movement/mechanics). Any attempt to reload those files also results in this behavior. I believe this should work as this is supported by GML and I cannot see it mentioned anywhere in the Limitation section on the documentation. Is this a bug, or is this somehow intended? If it's unintended, when will it be fixed? I bought this package expecting to be able to use it to drastically cut down on iteration time, but it doesn't work for me at all.

Could someone help me with this please.

Developer

This happens very specifically in that case since resolving enum values and injecting the resolved values into AST is two consequent passes. Macros are not affected.

I have fixed this for 1.0.27 (which I'll apparently have to release tomorrow since 2.3.1 beta removed a constant that's referenced in the extension), but if you need this urgently, contact me with your purchase reference (email for itch, email + purchase ref ID for marketplace) and I'll send you a GML file with that hotfixed.

It's okay, don't worry about it, I'll get it when you post it.