A recent Early Access build has introduced C-style enumeration to GameMaker Studio, an overdue feature that will be welcomed by veteran coders. Enumerations consist of named integer constants called “members” or “enumerators”.
An example is shown below.
In the example, an enumeration with a set of 7 members is declared. The constant values of the members range from 1 to 7. The enumeration can then be referenced in the manner shown.
Learn more about enumeration »
A copy of the code used in the example can be found below. You can paste this directly into GameMaker.
enum DAY { //declare enum type sun, mon, tue, wed, thu, fri, sat }; var example = DAY.thu; show_message(string(example)); //output: 5
var test = {
test1: 123,
test2: 456
}
show_message(string(test.test2)); //output is 456
Will that work?
This will work:
enum TEST {
foo = 1,
bar = 2,
john = foo + bar,
dooh = john +5
}
Colo notattion is not working, also you can’t assign string values to enum list.
I saw this the same day it was announced, and although it can be achieved by other means, it’s simpler to create this type of data structures this way :D.
what is the other mean? my version of game maker doesn’t seem to have “enum” and i can’t update it
Seems rather useful, but it could be similarly accomplished by using constants. Still, I suppose for local scripts, it would be useful for increasing readability.
how can you accomplish this without using “enum” my version of game maker doesn’t seem to have it and i can’t update it