Help Using enum in Version 2.3

PlayerOne

Member
Just getting accustomed to the new laylout, but what I'm confused about is how enums work with this new update. This is how its currently looking in the enum script. I'm going through the manual and I can't find what function_enum_fields() does.

can someone explain what i need to do to make this enum work and how enums work with this new update?

Code:
function enum_fields()
{
    
    enum MENU
    {
    Main=0,
    Load=1,
    Settings=2,
    Unlocks=3,
    Sound=4,
    Controls=5,
    Game=6,
    Monitor=7,
    Rebind_Keyboard=8,
    Rebind_Sony=9,
    Rebind_Xbox=10,
    Confirm_exit=11,
    confirm_exit_desk=12,
    confirm_exit_main=13,
    Credits=14,
    Effects=15,
    _max=16,
    }
}
 

kburkhart84

Firehammer Games
That function doesn't seem to be one that is included in GMS, rather something that was made by someone else. I'm guessing that you had a script that was named "enum_fields" and then the conversion just assumes that this is meant to be a function, and so adds brackets, "function", and () to it to comply with the new way to define functions.

Enums haven't changed...so assuming I'm right about this, you should be able to just remove everything except the enum itself, and it should work. Scripts are still called right at the beginning of the game, so the enum will still be created just like before.
 

gnysek

Member
As enum and macros are replaced on compile time, and removed from final game, they don't need to be inside any function - they can be anywhere, in script, or in object (but they aren't scoped). I'm always thinking about them as like IDE is making "Search & Replace + match case + only words" on whole project.
 

PlayerOne

Member
Never mind, I'm a idiot, The so called "function" is just the name of the script. Still learning 2.3 and all that it has to offer. Sorry folks.
 
Top