I use a combination of "everything that's a constant is in all caps" and "the scope is implied by common sense" here.
Code:
enum PLAYER_STATE
{
RUNNING,
WALKING,
JUMPING,
};
state = PLAYER_STATE.RUNNING;
No need to call the variable
player_state since it's already in the player object, so the context of it referring to
PLAYER_STATE is implied. (I'd also be using the same name twice otherwise, just not all caps...)
This has the added benefit that the
state variable has a uniform name across
all objects, so there is no need to remember it and type it out every time. Ideally, this would let me use a script that literally sets
state and takes care of any other potential operations I'd like to apply to any instance upon changing states. It's as close to inheritance of not only variables but also methods/functions as it gets with GML's current capabilities.
On the subject of not having to type out things all the time, for those of the "shorten variable names so you have to type less" mind set: I highly advise against shortening any descriptive names such as
PLAYER_STATE.
PSTATE could refer to just about anything that starts with P. Player, portal, plane, platypus...
On top of that,
P L A Y ENTER requires less key strokes than typing out
P S T A T E, but does not require me (
or my collaborators) to memorize or look up which variables I shortened, and to what. So does
P L A Y DOWN DOWN ENTER if you have multiple enums that start with PLAYER. Shortening stuff when it's impossible to figure out what it refers to by common sense when it pops up in auto-complete ("bgm" for example) is a stab in the back of the entire team, sans maybe yourself.
Why
PLAYER_STATE and not
PLAYER_STATES? For me, it's a matter of context and chosen quite deliberately in this case.
If I'm only ever going to use a collection in a scalar context, I use a singular name. A prime example of this is a state enum - whenever I use it, I'll either assign or check for one specific state.
If a collection is only useful when I have access to and use multiple or all of its elements, for example to iterate over it or to pass multiple values around, I use a plural name, such as for inventories, tiles...