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. I would like to point out that the program was created with special attention to screen reader users.

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:

Repeat

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 [<log entry index>]

Search

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

> !search <term>

Aliases

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
Done!

You can even assign aliases to other metacommands!

> !alias !a=!alias

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

Replaces

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

Notes

This command allows you to take notes.

> !note shortcut=note

Terminal

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"
11:26:30

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

> !alias time=!terminal date +"%T"
Updated.
> time
11:26:30

Macro

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.

metacommander-1.1.zip (12.9 KB)

4 Likes

Version 1.1

Released a minor update. The main feature is bookmarks. You can now bookmark any paragraphs of interest in the game and come back to them later.

Some important paragraph of text.

> !bookmark important
Bookmark saved as "important".

...

> !bookmark important
Some important paragraph of text.

A bookmarks metacommand has been added to work with bookmarks (view, delete, modify).

The description of the in-game help and the “README” has also been updated.

1 Like