I have a simple room, designed so that every exit is available, and all exits lead back to the original room.
The only way I’ve been able to wrangle it is with:
North from Starry Starry Night is Starry Starry Night.
East from Starry Starry Night is Starry Starry Night.
West from Starry Starry Night is Starry Starry Night.
South from Starry Starry Night is Starry Starry Night.
Northeast from Starry Starry Night is Starry Starry Night.
Northwest from Starry Starry Night is Starry Starry Night.
Southeast from Starry Starry Night is Starry Starry Night.
Southwest from Starry Starry Night is Starry Starry Night.
Inside from Starry Starry Night is Starry Starry Night.
Outside from Starry Starry Night is Starry Starry Night.
Up from Starry Starry Night is Starry Starry Night.
Down from Starry Starry Night is Starry Starry Night.
This seems so kludgy, surely there’s a simpler way to do it? My searches in the docs have proved unfruitful. Any insights? Thanks.
I’d just use:
Instead of going when the location is Starry Starry Night:
say "You wander a bit, but the vast canopy of stars above remain - almost as if you aren't even moving at all."
Depending on how you have it set up, if you want one physical exit from the room (like if the player can return inside a building by going west), you might use
Instead of going nowhere in Starry Starry Night: [...]
Which will only fire when the player goes a non-existent direction.
Slick! That is a nice way to achieve the same effect. (The room needs no exits,)
“Instead of going nowhere…” is also a handy way to selectively override the default “You can’t go that way.” message and customize it per location “The tall hedges prevent movement in that direction.”
This can be done game-wide or regionally:
Instead of going nowhere when the location is enclosed by Main House:
say "You learned at an early age that walking into walls isn't useful."
It works great with:
Instead of going nowhere in Starry Starry Night:
Before going [somewhere]:
Say "You do your best to move in the direction that you imagine [noun] to be."
Gives me the behavior I need. I was a little impressed that “Do nothing.” is a valid instruction in I7.
Yes, I think it’s synonymous for “Stop the action.” I don’t know for sure, but I think “Stop the action” prints the default refusal for the action where “Do nothing” won’t even print a message. Just don’t leave your player in a situation where they try every direction and think the game is broken and not responding. (I see how you did it though.)
“Stop the action” and “do nothing” aren’t the same–“do nothing” really does absolutely nothing. See §11.1 of Writing with Inform.
The reason the “Instead of going nowhere in Starry Starry Night: do nothing” rule is effective is that, since an Instead rule has run, the processing of the action is cut off in the way that Instead rules usually do. (Since the Instead rulebook has default outcome failure.) The purpose of “do nothing” is just to have something to put after the header. If you write “before going: do nothing” the rule will run, do nothing, and then the action will proceed as it usually does.
“Stop the action” guarantees that the rule will end in failure no matter what kind of rule it’s in–stopping the rule, the rulebook and the action. This is discussed in §19.11 of Writing with Inform. (There’s some sort of subtle difference between “stop the action” and “rule fails” but it’s not super important most of the time, or at least I can never remember how it works.) So if you use “stop the action” in a Before or Check rule, that rule will work as if you’d used an Instead rule–none of the rest of the rules for the action will run.
I don’t think “stop the action” will print the default refusal unless it happens after the stage where the default refusal got printed–it ends things right then, with nothing else printed.
The quickest way of actually mapping all the exits (rather than simply intercepting the going action as suggested above) is to do it at run-time.
When play begins:
repeat with D running through directions:
change D exit of Starry Starry Night to Starry Starry Night.
I wouldn’t call that a meaningful optimization. The idiom is hard to read, and one Instead rule is not a speed hit worth worrying about.
If you’re really that concerned about cycles, you should use the verbose form this thread started with – it does the same thing with zero runtime cost.
However, I should point out this line from an example above:
Before going [somewhere]:
Say "You do your best to move..."
The [somewhere] in that line is a comment. This is just a “Before going: …” rule.
A few other tips:
Specific beats general, so if you have “instead of going nowhere” and also “instead of going”, the first one will take precedence.
But, if you do actually need the opposite of “going nowhere”, you can say “going to a room”; that happens only when the player moves through a valid map connection.
A bit of testing suggests “going somewhere” is equally opposite to “going nowhere”.
In most contexts “somewhere”, “a room”, and “any room” are synonymous.