• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Needing help with this Variable <unknown_object>.<unknown variable="">

FATAL ERROR in action number 1 of Alarm Event for alarm 0 for object obj_transfer_plate: Variable <unknown_object>.<unknown variable="">(100261, -2147483648) not set before reading it. at gml_Object_obj_transfer_plate_Alarm_0 ############################################################################################ -------------------------------------------------------------------------------------------- stack frame is gml_Object_obj_transfer_plate_Alarm_0 (line -1)



My players who play my game get this error popping up. I can't reproduce the error myself. Can anyone explain what I am doing wrong in my code?

I didn't initialize int1, int2, and int3 at all other than in if statements. Would that be the cause of this? I can't tell if the issue would be fixed or not because I can't reproduce the error, lol...


obj_transfer_plate - Alarm 0 Event
Code:
if (global.restaurantSlot[restaurantNumber, 0] == obj_character0) {
    int1 = 0;
} else if (global.restaurantSlot[restaurantNumber, 1] == obj_character0) {
    int2 = 0;
} else if (global.restaurantSlot[restaurantNumber, 2] == obj_character0) {
    int3 = 0;
}

if (global.restaurantSlot[restaurantNumber, 0] == obj_character1) {
    int1 = 1;
} else if (global.restaurantSlot[restaurantNumber, 1] == obj_character1) {
    int2 = 1;
} else if (global.restaurantSlot[restaurantNumber, 2] == obj_character1) {
    int3 = 1;
}

if (global.restaurantSlot[restaurantNumber, 0] == obj_character2) {
    int1 = 2;
} else if (global.restaurantSlot[restaurantNumber, 1] == obj_character2) {
    int2 = 2;
} else if (global.restaurantSlot[restaurantNumber, 2] == obj_character2) {
    int3 = 2;
}

if (global.restaurantSlot[restaurantNumber, 0] == obj_character3) {
    int1 = 3;
} else if (global.restaurantSlot[restaurantNumber, 1] == obj_character3) {
    int2 = 3;
} else if (global.restaurantSlot[restaurantNumber, 2] == obj_character3) {
    int3 = 3;
}

if (global.restaurantSlot[restaurantNumber, 0] == obj_character4) {
    int1 = 4;
} else if (global.restaurantSlot[restaurantNumber, 1] == obj_character4) {
    int2 = 4;
} else if (global.restaurantSlot[restaurantNumber, 2] == obj_character4) {
    int3 = 4;
}

if (global.restaurantSlot[restaurantNumber, 0] == obj_character5) {
    int1 = 5;
} else if (global.restaurantSlot[restaurantNumber, 1] == obj_character5) {
    int2 = 5;
} else if (global.restaurantSlot[restaurantNumber, 2] == obj_character5) {
    int3 = 5;
}


if (global.restaurantSlot[restaurantNumber, 0] != "Empty") {
    with instance_create_depth(x+10, y+30, -1001, obj_transfer_slot) {
        image_index = other.int1;
        restaurantNumber = other.restaurantNumber;
        slotNumber = 0;
    }
} else {
    with instance_create_depth(x+10, y+30, -1001, obj_transfer_slot) {
        restaurantNumber = other.restaurantNumber;
        slotNumber = 0;
    }
 
}

if (global.restaurantSlot[restaurantNumber, 1] != "Empty") {
    with instance_create_depth(x+110, y+30, -1001, obj_transfer_slot) {
        image_index = other.int2;
        restaurantNumber = other.restaurantNumber;
        slotNumber = 1;
    }
} else {
    with instance_create_depth(x+110, y+30, -1001, obj_transfer_slot) {
        restaurantNumber = other.restaurantNumber;
        slotNumber = 1;
    }
 
}

if (global.restaurantSlot[restaurantNumber, 2] != "Empty") {
    with instance_create_depth(x+210, y+30, -1001, obj_transfer_slot) {
        image_index = other.int3;
        restaurantNumber = other.restaurantNumber;
        slotNumber = 2;
    }
} else {
    with instance_create_depth(x+210, y+30, -1001, obj_transfer_slot) {
        restaurantNumber = other.restaurantNumber;
        slotNumber = 2;
    }
 
}
 
Last edited:
D

Doulos

Guest
1st, line -1 makes no sense?
Error seems to be something getting read, not set. your ints seem fine.
I have to admit I am guessing.
Either global.restaurantSlot[] or obj_character0 are not initialized?
 
1st, line -1 makes no sense?
Error seems to be something getting read, not set. your ints seem fine.
I have to admit I am guessing.
Either global.restaurantSlot[] or obj_character0 are not initialized?
Yeah, I am not sure what's the deal with the "line -1" thing.

I am using this at the start of the game:

Code:
for (var u = 0; u < 6; ++u) {
 
    for (var i = 0; i < 3; ++i) {
 
    global.restaurantSlot[u, i] = "Empty";
 
    }
}
so that is being initialized.

I also have another object called obj_transfer_info which creates obj_transfer_plate.

obj_transfer_info - Create Event
Code:
with instance_create_depth(540, 250, -1000, obj_transfer_plate) {
    number = 1;
    restaurantNumber = 0;
}

with instance_create_depth(870, 250, -1000, obj_transfer_plate) {
    number = 2;
    restaurantNumber = 1;
}

with instance_create_depth(1200, 250, -1000, obj_transfer_plate) {
    number = 3;
    restaurantNumber = 2;
}
obj_character0 is initialized because that's an object and is from the resource tree.

The if statements for int1, int2, and int3 can be untrue. My guess is that I need to initialize int1, int2, and int3 in the create event.

I am guessing this is the problem:

Code:
image_index = other.int1;
because int1 might not get initialized because it is behind if statements? I am not sure.


EDIT:

Here is another error message that a different player got:


############################################################################################
FATAL ERROR in action number 1 of Alarm Event for alarm 0 for object obj_transfer_plate: Variable .(100239, -2147483648) not set before reading it. at gml_Object_obj_transfer_plate_Alarm_0
############################################################################################ -------------------------------------------------------------------------------------------- stack frame is gml_Object_obj_transfer_plate_Alarm_0 (line -1)

What's weird is that the first error message in the first post of this thread doesn't exactly match this one.
 
Last edited:

THE_T_V1RUS

Member
Make sure you initialize your variables in the create event for obj_transfer_plate.
Code:
number = noone;
restaurantNumber = noone;
If that doesn't fix it try changing the obj_transfer_info create event
Code:
var obj = instance_create_depth(870, 250, -1000, obj_transfer_plate);
with(obj)
     {
     number = 1;
     restaurantNumber = 0;
     }
 
D

Doulos

Guest
Do you have this exact text in your code somewhere?
(100239, -2147483648) <-- this?
or a variable set to this in your object variable defaults?
or an instance?

That error sort of looks like it thinks (100239, -2147483648) is a variable you are trying to read.
 
Make sure you initialize your variables in the create event for obj_transfer_plate.
Code:
number = noone;
restaurantNumber = noone;
If that doesn't fix it try changing the obj_transfer_info create event
Code:
var obj = instance_create_depth(870, 250, -1000, obj_transfer_plate);
with(obj)
     {
     number = 1;
     restaurantNumber = 0;
     }
Yeah, I had number and restaurantNumber initialized/set already. But I just changed my code in obj_transfer_info as you suggested. I also set int1, int2, and int3 in the variable definitions. Hopefully this all works.


Do you have this exact text in your code somewhere?
(100239, -2147483648) <-- this?
or a variable set to this in your object variable defaults?
or an instance?

That error sort of looks like it thinks (100239, -2147483648) is a variable you are trying to read.
I don't have that exact text in my code. I have no idea what it is referencing to. I have 5 variables in the variable definitions list in obj_transfer_plate:

number = -2 integer
restaurantNumber = -2 integer
int1 = -2 integer
int2 = -2 integer
int3 = -2 integer
 
This may not be causing your problem directly, but I'd caution against using -2 as a variable initial value.

-2 can be interpreted in certain contexts as the keyword other:

upload_2019-7-14_13-32-48.png

I would try and get the exact steps that the players are performing to cause the error, then repeat those steps when running the game from the IDE, if you can reproduce it the crash, you will get an actual line number to investigate.

Other than that, you could sprinkle liberal amounts of show_debug_messages in your code and try and pin-point which line it is happening on.

From the error message, some line of code is trying to reference a non-existing instance and/or variable. So its happening on the lines of code where you are using the (.) dot notation to reference another instance, but I can't spot it in your above code where it might be happening exactly. As you said, the likely error candidate are the "other.int3" lines and similar.
 
Top