Metacommander โ€” a simple Python wrapper (preparser) for terminal-based interpreters and games

Hello everybody!

I have written a wrapper (preparser) for terminal-based IF interpreters and games. It gives the player additional control options and adds many new features to existing programs. I hope some of them will be useful to someone.

A key feature of Metacommander is the built-in metacommands :slightly_smiling_face:, which are commands interpreted by a wrapper itself instead of the game.

Here are some of them:


Redisplay previous blocks of text. This differs from the again command because it does not re-execute the action, but outputs the result of its execution (takes it from the log). Now you can go back to any episode of the game at any time.

> !repeat [<block number>]


Search text in game log. You no longer have to worry about missing something important in the game. Regular expressions are supported.

> !search <term>


This is my attempt to implement the โ€œMUDish approach to playing IFโ€ :slight_smile: Aliases allow you to assign any command to a shortcut abbreviation.

> !alias shortcut=command(s)

Now you can do like this:

> !alias toga=remove overalls. wear toga
Aliases updated.
> toga

You can even assign aliases to other metacommands!

> !alias !a=!alias

In fact, such an alias is already in use :slight_smile:


Replaces a specified text in output with another specified text. Allows you to remove, for example, various annoying messages, symbols, swear words. Become a co-author or a censor. Regular expressions are supported.

> !replace old value=new value


This command allows you to take notes.

> !note shortcut=note


Allows you to run terminal commands right in the game! Great scope for imagination. Display the current time, read the walkthrough from the file, or whatever.

> !terminal date +"%T"

Did I mention that you can assign aliases to terminal commands too?

> !alias time=!terminal date +"%T"
> time


Recordes the macro and saves it in the โ€œaliasesโ€.

> !rec start
> <do stuff>
> !rec stop

All available metacommands can be viewed with the !help. For a detailed description of the metacommand use !help [metacommand] or read the โ€œREADMEโ€ file.

All settings are saved in the metadata file. Itโ€™s a regular json file containing game log, aliases, notes, etc. It can even be loaded with another game or interpreter. Of course, you can create any number of metadata files for any purpose.

The second key feature of Metacommander is its extensibility. All metacommands are placed in classes, so it is quite easy to add a new one using existing metacommands as samples.

Finally, the third feature is support for different interpreters and games. Potentially, any interpreter or game that can work entirely through input and output streams should run in MC. Iโ€™ve successfully run it with Dumb Frotz, Glulxe(CheapGlk), instead-cli, and IntFicPy. However, it is possible that some functions (including those of the interpreters themselves) may not work or may not work properly. See the Troubleshooting in the โ€œREADMEโ€.
It would also be great to run some TADS-games in MC, but as far as I understand there are no suitable TADS-interpreters like dfrotz.
I will be grateful for any comments. (11.9 KB)