Preventing a command in only one room?

i’m back again, this is a super simple request and i’m honestly not sure how i didn’t easily find the answer. i basically want to do a instead of command, do this and make it room specific.

specifically, im trying to give a player a different message when going south, but only when they’re in a specific room. how would i go about this?

1 Like

Several ways to phrase it, but

Check going south in the kitchen:
	say "You can't leave until the pot boils." instead.

“instead of going…” works fine, too, if that’s your preference.

3 Likes

can i check for the room being unvisited with this method somehow? the normal [if unvisited] tags don’t seem to work

1 Like

I’m sure it can be, yes. To be clear, are you trying to stop someone from going south when the room to the south is unvisited? Or just give a one off message then let them proceed?

2 Likes

im trying to give them a different message if the room theyre currently in has never been visited, and then a different one once they leave and come back

2 Likes

The problem with this model is that once the player is in a room, that room has been visited. It would probably work better to use [if the player is in the kitchen for the first time]. That phrase and its use is documented here.

6 Likes

@OverThinking’s solution is a really good one.

For posterity, there a few other solutions that might help you solve related problems:

  1. [if the kitchen was unvisited] fires only once. [if the player is in the kitchen for the first time] will fire every time you are in the kitchen for the first time, before you move out.
  2. you can define a specific truth state, though this creates a coding/testing problem if you have multiple places where you see different stuff the first time in the kitchen. A use case might be if you use an out-of-world command after entering the kitchen, but you don’t want to see first-time text. Then I believe the two pieces of code above would not work.
3 Likes