Word list

I would like to have a canvas on which the player can paint things. One, of course, is the “correct” option and has a triggered event, but rather than a simple denial, I’d prefer to permit the player to paint in other objects if they choose.

That part isn’t terribly tricky since the things in the painting are non-interactive, but the catch is that, while abstract art allows for portrayals of a lot of words, I still don’t want players to be able to put in silly gibberish. It’s a long shot, but is there any way I can access a word list without actually composing one myself? For instance, Inform “knows” a lot of plurals, so it must have a list of words and their plurals somewhere; could I check the input against that list?

No, that list exists only in the compiler. (And I believe it’s a list of patterns and exceptions, rather than a list of every pluralizable word in English.)

The game file only has access to words used in the game itself – that is, words used in object names and “Understand” declarations.

I have absolutely no idea how efficient this would be, but you could possibly try including a prebuilt word list in your game. http://wordlist.sourceforge.net/ looks like an interesting place to start. You could maybe take the Part of Speech database, extract all the nouns, and write a little script to generate code that makes a table out of this. And if that’s still too large, you could go do some hand-trimming of the list. It would be a decent amount of work but certainly better than trying to start from scratch.

-Kevin

You could do that, but you might want to think a little about resource management before you do:

How much will such a thing improve the player experience?
How much does it have to do with the actual game, in terms of setting the scene or advancing the story?
How much programming work will it require?
Will it slow down the runtime noticeably or make the game too large for some platforms?
Is there a cheap hack I could do instead that would cover a majority of use cases?
Is it worth it?

If it’s just a matter of painting objects that appear in the game, but adding plural forms to them, you could probably do it with indexed text. Or even manually add plural forms for those objects:

[code]Test is a room.

A pluralization is a kind of value. Items is a pluralization. Every thing has a pluralization called the plural form. Understand the plural form property as describing a thing. Understand “things” as items.

There is an animal called a mouse in Test. Mice is a pluralization. The plural form of mouse is mice.

test me with “x mice”[/code]

Another option is to have the game be up-front about what it does and doesn’t understand. Sometimes this is more satisfying to the player than making them guess whether the game really understood their command or is just pretending to be clever. Let me see if I can find the code to do that (pinched from Ron Newcomb and Aaron Reed):

[code]Include Default Messages by Ron Newcomb.

To decide which snippet is the misunderstood word: (- (((wn - 1) * 100) + 1) -) .
To decide what number is position of non-dictionary word: (- (FindUnknownWordToken(2)) -).

Include (-
[ FindUnknownWordToken wordnum
w twn numwds;
#ifdef TARGET_GLULX;
numwds = parse–>0;
#ifnot;
numwds = parse->1;
#endif; ! TARGET_GLULX;
! Throw out invalid word numbers
if (wordnum <= 0 || wordnum > numwds) rfalse;
twn=wn; ! save the value of wn so it can be restored
wn=wordnum;
while (1)
{ w=NextWordStopped();
if (w == -1) { wn=twn; rfalse; }
if (w == 0 && TryNumber(wn-1) == -1000)
{ wordnum=wn-1;
wn=twn;
return wordnum;
}
}
];
-)

Table of custom library messages (continued)
library-action library-message-id library-message-text
– 30 “[if position of non-dictionary word is 0]That’s not something you can see right now.[otherwise]The word ‘[the misunderstood word]’ was not understood.”

Test is a room.

There is a mouse.
Test me with “x mouse/x foo”[/code]