For directional: Make it run script:
If:
Flag is set "Door Unlocked"
Then:
Print "You open the unlocked door and go in."
move player to room "past door(or whatever)"
Else:
run procedure "Key"
Procedure "Key" is:
If:
Player has object "Key"
Then:
Print "The key unlocks the door."
set flag "Door Unlocked" to on.
Else:
print "The door is locked!"
For go to: Not sure.