Give rooms a number...Let's say you are in room number 1....
Dim door(20)..... so you can have 20 doors
If door(1) = 1 put an open door sprite there
If door(1) = 0 put a closed door sprite there
If item = 1 put the item there
If you pick up the item then item = 0
If you can drop the item in different rooms then you need to give the item the same room number. Let's say you drop the item in room 20...
Item = 20
If you open the door in room 20...
Door(20) = 1
If an item is in your inventory...
Item = 0
That sort of thing. Item can be anything....
Apple = 1
Gun = 1
Rock = 1