Hacking the restart rule

What is it that I am doing wrong here? I have the following code to replace the immediately restart the VM rule with a rule that sets a flag before restarting:

[code]Include (-
[ IMMEDIATELY_RESTART_VM_R;
((+ set data value +)–>1)(6,1);
@restart;
];
-) instead of “Immediately Restart VM Rule” in “OrderOfPlay.i6t”.

To set data value (X - a number) to (Y - a number):
…[/code]

This produces the error:

I suspect that what’s going on is that Inform doesn’t recognize the set data value phrase at the time that it is being asked to replace the template layer. But even defining that phrase immediately before the instruction to replace the template layer section fails in the same way.

I should be able to do this, right? Would I be smarter just to replace the immediately restart the VM rule in the table of final questions with my own I7 rule and be done with it?

Thanks!
–Erik

To make a phrase usable as a value, you need to name it:


Include (-
[ IMMEDIATELY_RESTART_VM_R;
   ((+ data-value setting +)-->1)(6,1);
   @restart; 
];
-) instead of "Immediately Restart VM Rule" in "OrderOfPlay.i6t".

To set data value (X - a number) to (Y - a number) (this is data-value setting):
	say "[X] to [Y]."

Thanks, zarf. I’d forgotten that subtlety. Did the trick!

That little trick is also mentioned here and it looks like it could come in handy. Any reason why it’s not documented in The Inform Documentation?

Eh? I learn this stuff from the Inform documentation in the first place, you know.

(Yes, I often look up stuff by searching the the Standard Rules, but that’s generally to find how to spell phrases that I know exist.)

Which trick are you asking about here? Naming a phrase to use it as a value is section 21.3. Including a chunk of I6 code to replace part of the standard templates is section 25.25. Hooking into an I6 routine with the “makes it so” definition is 25.23.

I don’t think the I6 implementation of named phrases is documented anywhere.

Yeah, I was quite vague there. I did mean the I6 implementation of I7 named phrases as Dannii correctly point out.

Ron Newcomb’s latest version of I7 for Programmers is quite good on a number of the otherwise undocumented aspects of I6-I7 interrelations. I think that this is documented there.

Okay, sorry.

(I think I learned that from Dannii, or maybe EmacsUser.)

The direct answer to your question is that it’s not documented because it’s internal to the language implementation. (You are referring to the internal I6 structure of an I7-generated object, the closure block, and how to invoke this from I6 code.) It should not be in the I7 manual because you can’t get at it from I7 code at all.

There could be an “I7 technical manual”, analogous to the “I6 technical manual”, documenting all this implementation-layer stuff. That would be great, but Graham hasn’t written it. Maybe it will come out along with the I7 source code. Then again, it may be in the I7 source code, as comments. Or maybe he hasn’t written the comments yet, which would be one reason that the I7 source code isn’t out.

It does explain it quite well, alongside a lot of other things. Looks like it will come in quite handy. I did find this bit at the end quite amusing.

This is only most of Inform 7. It is a large language with many nooks and crannies to explore. Finding them is frequently a game in itself. I hope you find it as enjoyable as I have.

Only too right! :laughing: