Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(1 edit)

I'm consistently getting an issue in the latest release where enums are being read as variables? It happens any time I make a change to an event that contains an enum reference.

[live][12/6/2022 3:21:34 PM] Runtime error: [error] `instance#ref 105090(obj_drone_silo)` (instance of obj_drone_silo) does not have a variable `drone`.

And checking the code, it's just a simple switch statement where I do this...

switch (state) {
    // IDLE
    case drone.idle:
    break;
}

Any idea why that's happening? Can I bypass it somehow?

What does the declaration of your enum look like? (assuming that’s an enum)

enum drone {
idle,
collect,
deposit
}

Try moving that to a separate script and restarting gmlive-server. If that solves it, send me a copy of the original script that had the enum in it

(1 edit)

Yeah that worked! I delare all my enums in the Room Creation Code for my first room r_Initialize. This is what's in there currently:

// Set anti aliasing to 0 for pixel art and turn on vertical sync so we don't get render lag
display_reset(0, true);
// Setup player states...
enum playerLoadout {
laser,
printer,
guns,
plows,
watering_cans,
seed_spreaders,
harvester,
logger,
miner,
construction_tools,
length
}
enum mods {
laser_beam,
force_field,
seed_spreader,
hammer,
length
}
enum droneTask {
unassigned,
ore,
organics,
crops,
defense,
length
}
enum menus {
pack = 0,
catalog = 1,
//equipment = 2,
length = 2
}
enum effect_type {
fire,
asteroid,
rain,
electro,
wormhole,
portal
}
enum key_indicator {
up,
right,
down,
left,
bumper,
trigger_l,
trigger_r,
stick,
key,
button
}
room_goto(r_Menu);

Oh, the server doesn’t currently check rooms for enums/macros - that’s kind of expensive (I mean, a little less expensive now that tile arrays in rooms are compressed, but still!). I guess I could check room creation code very specifically since it’s named predictably.

Gotcha. I personally don't feel like that's necessary, I can easily just move all these enums to the new script. I think this is some of the oldest code I have from a Shaun Spalding way back in the day. Not sure why it's only causing me problems now but good to know how to get around it. Thanks for the support. This tool is a literal lifesaver.