I think what’s happening is that AGAIN refers to the previous action, not the previous command, and when you forestall the action sequence with an ‘after reading a command’ rule, the previous action never gets changed.
If the reading-a-command activity is stopped, the parser considers the input to have been rejected, and loops back to the command prompt. It skips all of the parser activity, which includes recording the command buffer for “again” purposes.
I think what you want is to ‘change the text of the player’s command to “xyzzy”’, and then let the parser continue normally. (And add a line about ‘Understand “xyzzy” as xyzzying.’)
Ah-ha…this explanation of skipping the parser activity also explains behavior I’d seen elsewhere in my game.
The actual code looks through a table of possible commands and tokens and checks for matches & deconstructing it into 100+ separately defined actions would be awkward–especially since I don’t want to risk spoiling a magic-word verb early. But your advice gave me the idea to kick this code to the “Rule for printing a parser error when the latest parser error is the didn’t understand error:” block.
That seems to make more sense with what I want to do, and it cuts down on the time to parse through any old command.
I had blinders on thinking I had to put the parsing loop in “after reading a command” and not a parser error, because what I wanted to do was the opposite of a parser error, so I assumed it couldn’t go in the parser error code.
Your comment also tipped me off to look in Parser.i6t for the “g” code. I’d not looked much at the reserve files, having been generally intimidated, & the documentation is impressive. So thanks very much again!
(Incidentally, the table/code looks like this. I suppose I could define a topic, charges, disappearing, etc., but a table is easier to track:)
repat through table of magic-verbs:
if item-to-see entry is visible and player's command includes "[magic-word entry]" and can-operate-rule entry succeeds:
try magicking the item-to-see entry;
table of magic-verbs
item-to-see magic-word does-it-disappear charges can-operate-rule
potion "glug" false 5 can-identify-poisonous-potions rule
wand "zzzap/zzap/zap" false 7 trained-with-wand rule
wizard's hat "presto" false 8 trivially-true rule
scroll "gnusto" true 1 trivially-true rule
(100 more entries)