Invoking Undo (Inform 7)

I know how to prevent undo (and do variations on that, thanks to Erik Temple’s and Jesse McGrew’s extensions); the question is, can I invoke Undo myself? It kind of looks to me like the undo-interfering extensions work by hooking into an I6-level undo action, but I don’t really understand it, and I recognize that it’s a weird special command that involves arcane magic and such. Ideally, I’d like to be able to do the equivalent of “try undoing” in an After rule. If I can’t do it using the actual undo machinery, is there a convincing way to fake it? (For example, is it possible to follow the Report rules of an action without actually Carrying it Out?)

It’s easiest to use a little I6:

To undo a turn: (- VM_Undo(); -).

You can easily follow the report rules:

Follow the report waiting rules.

It may be cleaner than actually invoking undo. Keep in mind that generally, undo is a very blunt instrument; it’s not really designed to be invoked like this, even if it may be possible to do so. Unless you use @Protect (which I don’t know how to use, so ask someone else), no information will be conserved, so you won’t be able to prevent the player from doing exactly the same thing all over again.

NYKevin: What I can’t figure out is a concise way to follow the report rules for all of the possible actions I want to block – there are more blocked actions than unblocked. (This is just for a small part of the game, for stylistic effect.) I’m fine with the only thing preventing the player from promptly re-doing the action being the knowledge that the game will simply undo it again.

Danii: excellent, that is precisely what I was looking for.

Thanks, both of you.

It would probably be wiser to use this.

To undo a turn: (- Perform_Undo(); -).

This way undoing is checked beforehand so that you don’t end up undoing when there is nothing to undo to. Also, the relevant message will print if the interpreter fails to undo.

Noted. Thanks, climbingstars.

I don’t know exactly what you’re trying to do, but it sounds like the sort of thing that can be handled with Hypothetical Questions by Jesse McGrew.