Before Processing a Command: initial feedback

@Draconis , I’ve been giving your extension a major workout in my WIP!

I’d started to do things like operate on one of several chained commands (i.e. replacing text in the first command of a chained command) at the ‘before processing’ level, but I’ve found the results are unpredictable. Sometimes the replacement works. Sometimes the change breaks the chain, so the subsequent commands no longer go through, or it causes just the action part to go through without a noun.

I assume this unpredictability is because it’s somehow not safe to alter the text of the whole remaining typed line at this point? But I guess that’s what I want to do.

One example is when you want to replace a near colloquialism and anything else the player typed with a whole line that just works. But if there are chained commands, I can’t replace the whole line. I just need to replace the first clause of the chained command, the ‘current command’ so to speak.

-Wade

1 Like

Yeah, I didn’t expect people to need that behavior, but Zed pointed out that it would be fairly easy to add—I have a new version sitting around somewhere that I planned to put here after testing, but then I never got around to testing it. Let me dig that up. (It’s literally a single additional line of I6 code.)

1 Like

Here we go. Note that this has not been tested at all, but it should handle that problem. Thanks to Zed for spotting this!

Before Processing a Command-v2.i7x (38.8 KB)

2 Likes

@Draconis, is this new version compatible with 6M62? The compiler complained about the format of the extension’s version number, so I changed that, and now it’s saying this:

In Section - I6 Code in the extension Before Processing a Command by Daniel Stelzer:

Problem. You wrote ‘Include (- [ Parser__parse syntax line num_l […] . ! ! = ]; ! end of Parser__parse -) replacing “Parser__parse”’ : but this is not a form of I6 code inclusion I recognise, because the clause at the end telling me where to put the code excerpt is not one of the possibilities I know. The clause can either be blank (in which case I’ll find somewhere sensible to put it), or ‘when defining’ plus the name of an object or kind of object, or ‘before’, ‘instead of’ or ‘after’ a double-quoted name of a template layer segment, or of a part of one. For instance, ‘before “Parser.i6t”.’ or ‘after “Pronouns” in “Language.i6t”.’

It is not. Try this one.

Before Processing a Command.i7x (15.8 KB)

I really need to get my local Inform 7 installation working properly again, because then I can test these and put them on the Github instead of just posting them as attachments.

Thanks, though that looks like version 2/250424. I was hoping for the version that allowed altering the player’s command, because I’m using another extension that changes the text of the player’s command.

That version should, I just forgot to update the version number. This one will say 260110 as expected.

Before Processing a Command.i7x (15.8 KB)

The key block is this:

	! CHANGED DMS
	FollowRulebook((+ before processing a command +));
	if(RulebookFailed()) jump ReType;
	
	VM_Tokenise(buffer,parse);
	num_words = WordCount(); players_command = 100 + num_words; token_filter = 0;
	allow_plurals = true; ResetDescriptors();
	! END CHANGE

Originally it just had the first two lines. Zed pointed out it should also include the bottom three lines, to avoid issues when changing the command. (Really only the num_words and players_command parts should be necessary, but it doesn’t hurt to reset some extra variables to make sure.)

1 Like

Thank you! I think that fixed a bug I was running into with how this extension was interacting with the other extension.