Iron ChIF: Season One Episode 1 (lpsmith vs. Afterward, using Inform 7)

In THE LITTLE MATCH GIRL 6: FULCRUM OF THE TELKON VORTEX, each enemy unit needs its own description, >TALK TO text, >SCAN text, scan log object, “class” text, HP value, table of stance-changing texts, table for tracking status ailments, text for when it’s defeated, basic attack rule, targeting priorities, and AI routine. I’m not dumb enough to type out all these properties by hand for dozens of characters, but for a long time I was dumb enough to handle them with fiddly copying/pasting/hand-editing. Tedious and error-prone.

Recently I got around to writing some code to generate these statblocks for me. EMBARRASSINGLY RECENTLY—but recent enough that the notion was fresh in my mind for this project. And it has really come in handy!

The code that needs generating here is for objects that have “altered” and “unaltered” forms. The most tedious thing about this is that there will be lots of synonyms that we only want to apply to an object in one state or the other. Let’s say we want synonym-listing code for a cigarette that turns into a worm, like in that Wayside School book.

The code-generating code is of course written in Inform 7.

"object generator" by Ryan Veeder

Internal name is initially "worm".

Room name is initially "wayside".

Adjective list is initially "portable thing".

Normal name is initially "cigarette".

Normal synonyms is initially "smooth straight white death stick".

Normal description is initially "A smooth, straight, white cigarette. [']Death sticks,['] they call them.". 

Real name is initially "worm".

Real synonyms is initially "ooey gooey".

Real description is initially "An ooey gooey worm, writhing around! Yuck!". 

When play begins:
	let thisname be "[room name]-[internal name]";
	say "The [thisname] is a [adjective list] in Room-[room name].";
	say line break;
	say "Printed name of the [thisname] is '[normal name][quotation mark].";
	say line break;
	say "Underst";
	repeat with x running from 1 to number of words in normal name:
		let xtext be word number x in normal name;
		say "and '[xtext]' ";
	repeat with x running from 1 to number of words in normal synonyms:
		let xtext be word number x in normal synonyms;
		say "and '[xtext]' ";
	say "as the [thisname] while the [thisname] is not altered.";
	say line break;
	say "Description of the [thisname] is '[normal description]' ";
	say paragraph break;
	say "Real name of the [thisname] is '[real name][quotation mark].";
	say line break;
	say "Underst";
	repeat with x running from 1 to number of words in real name:
		let xtext be word number x in real name;
		say "and '[xtext]' ";
	repeat with x running from 1 to number of words in real synonyms:
		let xtext be word number x in real synonyms;
		say "and '[xtext]' ";
	say "as the [thisname] while the [thisname] is altered.";
	say line break;
	say "Real description of the [thisname] is '[real description]' ";
	
place is a room. printed name of place is " ".

Rule for printing the banner text:
	stop.

Run the game, and we get:

The wayside-worm is a portable thing in Room-wayside.

Printed name of the wayside-worm is "cigarette".

Understand "cigarette" and "smooth" and "straight" and "white" and "death" and "stick" as the wayside-worm while the wayside-worm is not altered.

Description of the wayside-worm is "A smooth, straight, white cigarette. 'Death sticks,' they call them." 

Real name of the wayside-worm is "worm".

Understand "worm" and "ooey" and "gooey" as the wayside-worm while the wayside-worm is altered.

Real description of the wayside-worm is "An ooey gooey worm, writhing around! Yuck!" 

That was so much faster than typing everything out! I might still have to write rules for smelling, listening to, and so on. But notice that I can put stuff like “closed openable transparent scenery container” in the Adjective list field, which goes a long way.

13 Likes