X
xorphinindi
Guest
I'm getting a weird error and I can't figure out why.
My game uses a system of electric doors that have a locked and an unlocked state which can be toggled using a computer terminal. This is by use of an in-game menu that calls a script which holds a switch statement. The terminal communicates with a motion sensor object called obj_doorsense separate from obj_door. If the sensor is in the "unlocked" state, the door actually opens when the player approaches it and enters the sensor's vision cone. My room has 4 doors, each with an accompanying sensor.
The problem is that I'm getting an error while using the terminal to unlock a door, saying:
"Variable <unknown_object>.<unknown variable>(100047, -2147483648) not set before reading it.
at gml_Script_scr_systemsMenuD (line 42) - if(obj_doorsense.shopRoom_lock.open = true || obj_doorsense.shopRoom_lock.opened = true){"
The line in question is from the menu script within case 3.
It's weird because this is only happening for ONE of the doors. It's even weirder because if I delete the sensor associated with the error, then the error will jump to a different door.
Here's my code:
Relevant stuff from obj_doorsense create event:
Menu object create event:
Menu script called by selecting a menu option:
Thanks in advance for any help.
My game uses a system of electric doors that have a locked and an unlocked state which can be toggled using a computer terminal. This is by use of an in-game menu that calls a script which holds a switch statement. The terminal communicates with a motion sensor object called obj_doorsense separate from obj_door. If the sensor is in the "unlocked" state, the door actually opens when the player approaches it and enters the sensor's vision cone. My room has 4 doors, each with an accompanying sensor.
The problem is that I'm getting an error while using the terminal to unlock a door, saying:
"Variable <unknown_object>.<unknown variable>(100047, -2147483648) not set before reading it.
at gml_Script_scr_systemsMenuD (line 42) - if(obj_doorsense.shopRoom_lock.open = true || obj_doorsense.shopRoom_lock.opened = true){"
The line in question is from the menu script within case 3.
It's weird because this is only happening for ONE of the doors. It's even weirder because if I delete the sensor associated with the error, then the error will jump to a different door.
Here's my code:
Relevant stuff from obj_doorsense create event:
Code:
teleRoom_lock = instance_place(1008, 272, obj_doorsense);
questRoom_lock = instance_place(1232, 272, obj_doorsense);
saveRoom_lock = instance_place(1008, 688, obj_doorsense);
shopRoom_lock = instance_place(1232, 688, obj_doorsense);
Code:
menu[0] = "Command";
menu[1] = "Teleporter Room";
menu[2] = "Save Station";
menu[3] = "Shop Room";
menu[4] = "Return";
space = 32;
mpos = 0;
Code:
switch (mpos){
case 0:{
// command room door lock
if(obj_doorsense.questRoom_lock.open = true || obj_doorsense.questRoom_lock.opened = true){
obj_doorsense.questRoom_lock.open = false;
obj_doorsense.questRoom_lock.opened = false;
obj_doorsense.questRoom_lock.image_index = 0;
}
else{
obj_doorsense.questRoom_lock.open = true;
}
break;
}
case 1:{
// teleporter room door lock
if(obj_doorsense.teleRoom_lock.open = true || obj_doorsense.teleRoom_lock.opened = true){
obj_doorsense.teleRoom_lock.open = false;
obj_doorsense.teleRoom_lock.opened = false;
obj_doorsense.teleRoom_lock.image_index = 0;
}
else{
obj_doorsense.teleRoom_lock.open = true;
}
break;
}
case 2:{
// save room door lock
if(obj_doorsense.saveRoom_lock.open = true || obj_doorsense.saveRoom_lock.opened = true){
obj_doorsense.saveRoom_lock.open = false;
obj_doorsense.saveRoom_lock.opened = false;
obj_doorsense.saveRoom_lock.image_index = 0;
}
else{
obj_doorsense.saveRoom_lock.open = true;
}
break;
}
case 3:{
// shop room door lock
if(obj_doorsense.shopRoom_lock.open = true || obj_doorsense.shopRoom_lock.opened = true){
obj_doorsense.shopRoom_lock.open = false;
obj_doorsense.shopRoom_lock.opened = false;
obj_doorsense.shopRoom_lock.image_index = 0;
}
else{
obj_doorsense.shopRoom_lock.open = true;
}
break;
}
case 4:{
// Return
instance_create(x, y, obj_menuD);
with(obj_systemsMenuD){
instance_destroy();
}
break;
}
}