Is there any way to override the direction commands?


#1

I’m trying to use Inform 7 for a choice based game and I’m using parser parer (basically a list of “Understand nothing as” statements) to eliminate all existing commands. I’d like to be able to use letter shortcuts but I can’t seem to make e.g. “e” refer to anything other than going east. I already have “understand nothing as going.” from parser parer and have added “Does the player mean going: it is very unlikely.” and “does the player mean doing something to a direction: it is very unlikely.”

But if I try to make a thing called “choice e” or whatever then going east will always take precedence if I use it bare with something like "understand “[any choice]” as choosing. If I make “e” an actual command (like "taking fifth choice is an action applying to nothing. Understand “e” as taking fifth choice.) it works but that’s very restrictive and clunky solution.

Am I missing something obvious? Is this some deep i6 level hardcoding that’s outside the normal understand system? Is there something in the standard rules that I can can delist? Is this a bug I can report? Am I doomed beyond all mortal help?


#2

There are two things going on here. One is that any command consisting of a direction (with no verb) is interpreted by the parser as “go”. There’s not much you can do about that, as it’s hard-coded in the parser.

The other thing is that the standard directions have their usual abbreviations, “e” for east and so on. This is fairly easy to override — you can just replace the section of the Standard Rules in which those abbreviations are defined.

Create a section in your code called something like

Section - Directions (in place of Section SR1/4 - Directions in Standard Rules by Graham Nelson)

Then go into the Standard Rules, and copy and paste Section SR1/4 (without its section heading) as your new section. Now you can edit it to get rid of the abbreviations.

Of course, this will have the effect that the player can never use “e” to refer to east. But if you’re 100% choice-based that won’t matter. If you were planning a mixed-mode choice/parser interface, you might be able to use conditional understand statements to allow direction abbreviations just when you wanted them.


#3

Thanks, that worked! I went ahead and made all the directions privately-named too while I was at it. I think that will make them fully inaccessible now, hopefully without breaking anything.


(Andrew Plotkin) #4

There should be a better way to drop the parser entirely and just get a line of input. (“Does the player consent” does this, in a specialized way.)

Possibly what you want is an “After reading a command” rule which always rejects. Or which always replaces the player’s command with a controlled snippet like “CHOICE 5”.


#5

I don’t want to eliminate the parser completely though. I’m just trying to turn off all previous verbs so I can make new ones for a different interface. “Choice e” was kind of a toy example for why I might need to repurpose single letters. I also don’t want to destroy all the testing commands.

Regardless, overriding the standard rules and making directions private-named seems to work, so I think I’m just going to go with that. Thanks for the suggestion though.