Similar to TFM4, I often set up rooms as zones, and have all the actual locations inside them. For example, one room might be the castle, and all the locations inside the castle go in the room; there might be a forest room that holds all the locations in the forest. It keeps rooms together, makes them easier to find, and also easier to hide when I am working on other stuff. I can also check if the player is in the castle:
if (player.parent.parent = zone_castle) {
...
I have said this before, but when creating a new command, and good way to approach it is to go though all the conditions it will not work for.
If the player is not holding a certain item, it is not going to work
If she is not in the right room it is not going to work
If somethng is not turned on it is not going to work
If it passes the above, it works
Convert that in to a cascade of
if/else if/else.
if (not certain_item.parent = player) {
msg("You are not holding a certain item.")
}
else if (not player.parent = certain_room) {
msg("You need to be in another room.")
}
else if (not something.switchedon) {
msg ("You need to turn something on.")
}
else {
msg ("You do that thing, and solve the puzzle")
player.parent = prize_room
}