I have come to a point where I’m not sure how I should proceed. There are plenty of directions leading away from various rooms that don’t lead anywhere. In many games, I notice that if you try to go in a direction that isn’t intended, the game says something like “Only overgrown forest lies in that direction”, or some other flavorful text. When I try something like this:
Before going north from the gatehouse, instead say "There is nothing to the north apart from a high wooden wall.".
The game will respond with “You can’t go that way”. If I try something like:
Before going nowhere from the forest path, instead say "Leaving the path would be unwise."
The game will respond correctly enough, but also give you that response if you type “up” or “in”, which is not ideal. Also you lose the option to give different flavor text for different directions. What is the best way to handle this sort of thing?
The problem is that “going from” is only called if the preliminary map check succeeds. You need “going north in the gatehouse” instead if there’s no map connection there.
Not sure if this is the best way, but I did it with a dummy location and an instead statement, like this:
[code][==== Street ====]
To say too dangerous to cross the street: say “You lean out between the tree branches and peer up and down the street. The street seems too dangerous to cross at this point and you decide against it.”
dummyloc is a room.
East of VB Cross N1 is dummyloc. West of dummyloc is nothing.
West of VB Cross N1 is dummyloc. East of dummyloc is nothing.
Instead of going east from VB Cross N1: say too dangerous to cross the street.
Instead of going west from VB Cross N1: say too dangerous to cross the street.
Edit: After reading the post by Draconis above, I now see that just changing “from” to “in” does the same with no dummy location needed. “Instead of going west in VB Cross N1: say …”
That works, but it would probably be easier just to use the word “in” and not worry about trimming all the map connections Inform adds to the dummy location.
Thank you for the responses. I’ll report back if I have any further issues.
I think you need to code each direction if you want something other than “You can’t go that way.” It helps to put the phrase wanted in a separate statement:
To say cant-go: say "Leaving the path would be unwise."
Check going east in the forest path: Instead say "[cant-go]"
It definitely would be nice if we could declare more than one direction at a time. Perhaps “Check going northward:” could refer to NW, N and NE and the such. That might even make a nice extension
EDIT: Ah, and Draconis already showed I was wrong about that… Thanks, Draconis! That little tip helps me as well.
Hardly worth an extension:
Definition: a direction is northward if it is north or it is northwest or it is northeast.
Instead of going a northward direction in the Kitchen:
instead say "Northward."
Every time I think something is going to take all sorts of code, I’m pleasantly surprised by little things like this in I7.