Producing starting code programmatically

This might not have terribly wide scope, but I was playing around with some PERL code to create a few basic verbs. Yes, creating a bunch of them is bad. But I find often that getting started with a game or new feature has annoying roadblocks of mistakes you don’t want/need to make again.

Obviously there’s good old cut-and-pasting, too, or using extensions, but I was wondering about something more flexible that could immediately help someone make a game that does something–putting the planning aside.

For instance the code below, when you type “ xyzzy,plugh,dive” turns up a skeleton that would’ve taken an annoying while to type.

[code]use Win32::Clipboard;

$clip = Win32::clipboard::new();

@verbs = split(/,/, @ARGV[0]);


$a = sprintf("%schapter %sing\n\n%sing is an action applying to nothing.

understand the command “%s” as something new.

understand “%s” as %sing.

carry out %sing:
the rule succeeds;

", $a, $, $, $, $, $, $);



The above applies to Inform 7, but I think it can apply generally. Is there something more powerful that I’ve missed? Do we already have a repository of scripts like this? And is there a chance a simple tweak to the IDE can add a verb?


Well, it can do something almost as good. Emily Short had an extension a while back to build a conversation framework programmatically during play, which was used to build Alabaster. These days making an interactive definition system like that would be even easier, thanks to the introduction of indexed text.

The last thing that code does is display all of that generated code on the game window and write it to the file. Using “the topic understood” and indexed text, it should be easy enough to reproduce that behavior to generate, for example, verbs.

Wow. That is really cool. I’ll give it a go. I’ve actually played Alabaster but never saw that part of the source. It’d make a lot of things easier.