Codewords as arbitrary alphanumeric strings

Hi everyone,

I just finished my first IF game, and I’m pretty excited about Inform7. I’m a programmer by trade, and hacking Inform7 reminds me strongly of my Prolog days … :slight_smile: There is still a feeling I’m doing things in a cumbersome way, though. Maybe someone can help.

I implemented a “sentinel” in one of my games, who blocked the path into a certain direction if the “utteredness” of some codeword was yet “untold” (I know this sounds extremely cumbersome right from the start …):

codeword is a kind of thing.
utteredness is a kind of value. the utterednesses are told, untold.
a codeword has an utteredness. The utteredness of a codeword is usually untold.

ic0510 is a codeword.

Room1 is a room. 
Room2 is a room.
Room2 is west of Room1.

Instead of going west from Room1:
	if ic0510 is told:
		move the player to Room2;
	otherwise: 
                say "You have to say the code first.".
	
Saying is an action applying to one visible thing.
Understand "say [any thing]" as saying.
Carry out saying:
	if the noun is ic0510:
		if the location of the player is Room1:
                        say "The way is clear!";
			now the utteredness of ic0510 is told;

This works as expected. BUT: I want to extend this to arbitrary alphanumerical codewords, especially pure numbers. But then I’d have to make the action “saying” applicable to numbers, too, which I didn’t manage yet. Any hints?

Kind regards,
Johannes

To let saying apply to any string, do this:

Saying is an action applying to one topic. Understand "Say [text]" as saying.

And then the thing said is “the topic understood” rather than “the noun”. In your case I’d just use a truth state rather than a property to record whether the password has been said:

Password-said is a truth state that varies. Password-said is usually false. Carry out saying: if the topic understood matches "ic1050": say "The way is clear!"; now password-said is true; otherwise: say "That's not the password."

and so on.

See section 16.5, “The text token,” for more.

Awesome, that did the trick! :smiley:

Thanks a lot, Matt!

Kind regards,
Johannes