"You'll have to say which compass direction to go in"

So, I was coding as usual, doing nothing specially fancy, and all of a sudden this keeps popping out after every input:

You'll have to say which compass direction to go in.

I have no idea why, and I never saw it before. All I know is this starts appearing after triggering a scene that moves the player to another room (“move player to Rome”). But I’ve used this before and it didn’t appear… So I don’t know.

Not really a game breaker, but annoying :confused:
Any idea why it appears/how to avoid it?

This message occurs when a go action is attempted but no direction is provided. Try just:

go

to see the default response.

Without seeing your source code, my guess would be that a go action is being triggered somehow, i.e. “try going” is in a rule you created.

Ah, you’re right.

The scene triggers after the player tries to go somewhere, but is actually sent somewhere else:

Instead of going west in Constantinople: say "You gaze westwards, towards the other side of the Bosphorus and the European lands beyond it. Do you really want to go back?"; if the player consents: move player to Rome.

I was assuming that because it’s an “Instead”, the action of going was being overriden and not happening. But as you point out, it seems Inform was still trying to go somewhere after the player had been moved to the relevant destination.

I added “stop the action” and now it works fine.

Instead of going west in Constantinople: stop the action; say "You gaze westwards, towards the other side of the Bosphorus and the European lands beyond it. Do you really want to go back?"; if the player consents: move player to Rome.

This seems odd. The original code you have should’ve worked as is–it did for me in a small sample game–and the second code you posted shouldn’t work, because as soon as it hits “stop the action” it stops the rule and cuts off all the code below it. Do you have some other code elsewhere in your project that might be running in these cases? You might want to type “rules” before you type “go west” in the game and see what rules are running.

One way that you can produce the error you were getting is if you have “try going” in your source code, without a compass direction–you might want to check for that.

Actually it seems I have been too hasty… and my code is stranger than I thought.

Stopping the action does indeed stop the action, completely and before anything at all happens, so… nothing happens and the player doesn’t get moved anywhere.

Going back to the original code, it works but I keep getting “You’ll have to say which compass direction to go in”. Following your advice I’ve re-checked a lot of code… and found the culprit.

There is an NPC who follow you in that scene:

Every turn when the companion is follower: if the location of companion is not the location of the player: let the way be the best route from the location of companion to the location of the player; try companion going the way; otherwise: say "The companion follows your every step."

After moving the character to the new location, I had a line of code making this NPC off-stage. But apparantly off-stage does not mean he’s “inactive”.

I added “now the companion is unfollower”, and the annoying message ceases to appear.

So my interpretation of this is - even while being off-stage, the NPC was still trying to follow you, and precisely because he was off-stage, he couldn’t find a route so Inform kept on asking for directions. Sound crazy?

:open_mouth: :open_mouth: :open_mouth:

Since there is no valid route determined, your temporary variable “the way” is set to nothing. Trying to make the companion go nothing (i.e. no direction) is what’s generating the message.

Yeah, that’s the big lesson here. If you have to toggle on special behaviour for a character, or an object, or a scene or whatever, it’s best to make sure and turn it off after you’re done with it (easier said than done, what with all the things you have to remember just to get a game working at all, I know).

Yup. Never assume an NPC will stop doing his duty just because he’s out of this world :slight_smile: Some commitment.

Thanks a lot everybody, this little thing was driving me mad!

And here’s one weird trick to keep this from happening:

Every turn when the companion is follower: if the location of companion is not the location of the player: let the way be the best route from the location of companion to the location of the player; if the way is a direction: try companion going the way; otherwise: say "The companion follows your every step."

Basically, whenever you look for the best route, it’s a good idea to add “If the way is a direction” (with whatever variable you used for “way”). That way, you won’t get messed up if there is no path and the way turned out to be nothing. This is a local thing you can do in the same rule where you have routefinding, which will prevent these particular errors from occurring. You should definitely also toggle off the follower attribute when the NPC gets removed from play, but if you get in the habit of doing this in the rule with the routefinding you’ll be less likely to get messed up by something happening in a distant part of the code.

Anyway, good on you for figuring out the real bug! These can be nasty to track down.