I'm having problems altering the movement commands in Inform 7... suggestions?

The Index isn’t exactly lying, but it’s a little misleading because the functionality is not enabled through normal action processing as you seem to be assuming.

As Draconis explains, this type of command input is not handled through normal action resolution and is built directly into low-level parser code.

Your redefinition of "l" works because the Standard Rules contain the line:

Understand the command "l" as "look".

No similar modifiable assertions exist for the "[direction]" pattern – it’s just I6 code.

The good news is that it’s pretty straightforward to disable this low-level functionality in 6M62. If you’re using 10.1.2, it should still be possible, but it will require a huge inclusion (the whole of the Parser__parse() routine). I think that’s something to consider before abandoning Inform completely.

This is what the change looks like in a 6M62-compatible form (which allows replacement of parser routine sections):

Include (-

! ==== ==== ==== ==== ==== ==== ==== ==== ==== ====
! Parser.i6t: Parser Letter B
! ==== ==== ==== ==== ==== ==== ==== ==== ==== ====

	#Ifdef LanguageIsVerb;
	if (verb_word == 0) {
	    i = wn; verb_word = LanguageIsVerb(buffer, parse, verb_wordnum);
	    wn = i;
	}
	#Endif; ! LanguageIsVerb

	! If the first word is not listed as a verb, it must be a direction
	! or the name of someone to talk to

	if (verb_word == 0 || ((verb_word->#dict_par1) & 1) == 0) {

	    ! So is the first word an object contained in the special object "compass"
	    ! (i.e., a direction)?  This needs use of NounDomain, a routine which
	    ! does the object matching, returning the object number, or 0 if none found,
	    ! or REPARSE_CODE if it has restructured the parse table so the whole parse
	    ! must be begun again...

	    wn = verb_wordnum; indef_mode = false; token_filter = 0; parameters = 0;
	    @push actor; @push action; @push action_to_be;
	    actor = player; meta = false; action = ##Go; action_to_be = ##Go;
	    ! l = NounDomain(compass, 0, 0);	! DISABLED
		l = nothing;	! ADDED
	    @pull action_to_be; @pull action; @pull actor;
	    if (l == REPARSE_CODE) jump ReParse;

	    ! If it is a direction, send back the results:
	    ! action=GoSub, no of arguments=1, argument 1=the direction.

	    if ((l~=0) && (l ofclass K3_direction)) {
	        parser_results-->ACTION_PRES = ##Go;
	        parser_results-->NO_INPS_PRES = 1;
	        parser_results-->INP1_PRES = l;
	        inferred_go = true;
	        jump LookForMore;
	    }

	} ! end of first-word-not-a-verb


-) instead of "Parser Letter B" in "Parser.i6t".

Note that the functionality can be re-enabled at the Inform 7 level via:

Understand "[direction]" as going.

In theory, this could be placed in the Standard Rules, taking direction-only commands out of the realm of special behavior. (I don’t know what the compiler would do with an ... as something new directive in this case, though.)

2 Likes

“Understand…as something new” erases all grammar lines for a given I6 verb, so as far as I know, it just doesn’t work for no.verb lines.

Personally, I think this would be better put into the Standard Rules where it can be manipulated from I7 code, but I think that about most things!

1 Like

I recognize the validity of this advice, but the whole point of this particular piece of interactive fiction is advocacy. If I went to another system, most of the message would be lost.

I have several ideas on how to cope with this, including returning to my very first thought of abolishing ‘directions’ entirely and connecting rooms with one-sided scenery ‘doors’. I’ll have to give the subject some consideration.

Now I’m glad that I dropped out of Spring Thing when I did. The design is complete, but the program will have to be completely rethought.

That’s why I’d recommend redirecting the action after it’s been parsed, rather than trying to alter the parsing itself.

One of my thoughts was, for the convenience of later authors if nothing else, to preserve the compass directions when used to define rooms’ relationships to each other, but to create a subroutine that translated relative directional commands into the (hidden) absolute directions, then telling the parser to continue with moving the player with compass-direction commands. If I rule out going a compass direction, can I later instruct the parser to do so?

That you can! One option is to only redirect “going” when a certain flag isn’t set, and set that flag before you redirect another action back to “going”. Another option is to make your own “absolute-going” action and copy the Standard Library “going” code into it.

1 Like

One last question: where exactly can I find the text of the Standard Rules? The Inform docs include lists of names of the rules, and some discussion of what they do, but I’d like to be able to take a look at the actual plaintext, and I can’t locate it. It doesn’t seem to be present anywhere in the Inform directories.

Thank you very much to everyone who responded. The code fix suggested is far beyond my understanding and ability to implement, but I have a much better understanding of what’s wrong and how to work around it.

from within the (windows) IDE, it’s file>open installed extension>graham nelson>standard rules

3 Likes

There’s also a nicely-annotated version of the Basic Inform and Standard Rules extensions on the Github, which is my go-to when I need to check something.

3 Likes