Similar OPTIONS/VERBS between games

I’ve noticed that a lot of my games with similar motifs had very similar OPTIONS or VERBS commands. This gave me the idea of putting said commands into an extension, so I don’t have to cut-and-paste text.

I generally like to alphabetize things, which creates a small problem: how do I deal with if one game has a special options command the others don’t? Let’s say DEF is the option. Then this wouldn’t be adequate for all versions of the story:


Version xxx of My Series Options by Andrew Schultz

optionsing is an action out of world.

understand "options" as optionsing.

carry out optionsing:
    say "ABC does this.";
    say "DEF does that.";
    say "GHI does something else.";

But we could say

def-available is a truth state that varies.

carry out optionsing:
    say "ABC does this.";
    if def-available is true, say "DEF does that.";
    say "GHI does something else.";
    say "JKL does that other thing.";

Then we could set def-necessary in the main program e.g.

include My Series Options by Andrew Schultz

def-available is true.

This looks like a good way, but I was also interested by having

Version xxx of My Series Options by Andrew Schultz

number-in-series is a number that varies. [the exact number is defined at the top of the main story.ni]

to decide whether def-available:
    if number-in-series is 2, no;
    yes;

carry out optionsing:
    say "ABC does this.";
    if def-available, say "DEF does that.";

etc.

The “to decide” statements seem fiddlier, but the definitions would be in one localized place, which would be nice.

There don’t seem to be massive plusses or minuses either way, so it’s not a huge decision, but I’m wondering what others would recommend in case I’m missing something important.

Thanks!

1 Like

If you make your options things, then you can sort them in whatever order you like.

This extension uses the “things as options” idea but doesn’t make any attempt to sort them. But, Inform has phrases to sort lists and tables, so you can just gather them into a list (“the list of boolean options”) and sort as you like.

3 Likes

Wow. This is really slick. and flexible. I wish I’d noticed it when it was originally created!

Yeah, if the end user wants to sort things, they can do it themselves. Certainly it’d be no problem to give the option-things a number called sort-order for a full OPTIONS command.

I already see a lot of fun stuff I might do with a local version: I imagine you could also give a boolean option patterns like on-text or off-text e.g.

report boolean toggling:
if noun is active:
say “[if on-text of noun is empty]default statement[else][on-text of noun][end if]”;
else:
say “[if off-text of noun is empty]default statement[else][on-text of noun][end if]”;

Or even a pre-check rule to see if you can toggle it on or off, or to warn the player that toggling may have no effect.

And this could be expanded pretty easily to where I want the player to specify a number for an option.

So many possibilities! Thanks for sharing the code you wrote here.

No problem! I originally made it when I ran into this exact sort of problem. I wanted a bunch of options (like screen reader accessibility, graphics, status line map, hard mode…) that could be toggled on and off individually and realized if I made them things I could use Inform’s built-in phrases to do things like sorting them and presenting them.

1 Like