GMS 2 Undefined variable that IS defined

Error:
Undefined variable 'door1' referenced in room rHouse_01 in instance inst_67C21C7D's variable 'dev_what'

CREATE
Code:
dev_who = 0;
dev_what = 0;
LEFT PRESSED
Code:
with (dev_who) {
    dev_what = true;
}
VARIABLE DEFINITIONS (defined in the room are)
dev_who = 0; (resource: set to oBoss)
dev_what = 0; (resource: set to door1)

Basically im trying to make a simple button that I can reuse to test certain triggers in the room triggering events that fire when a false is made true.
 

Catastrophe

Member
Edit: nvm, looking at this again, didn't realize it was an issue with variable definitions at first

You do have a resource named door1 right? It's not oDoor1 or something? Because it will consider it a variable if it can't find the resource. E.g. I get that error if I choose a resource, and then delete that resource afterwards and build the game
 
Last edited:

samspade

Member
My guess it is a scoping issue - e.g. whatever object 0 is in your resource tree doesn't have dev_what defined. Also you shouldn't use with like that. It theoretically works but it relies on both your resource tree order and the underlying workings of game maker.

You could always run it with the debugger and see if that object has it defined.
 
Top