Understanding "understand"

I sadly don’t fully grasp the ‘understand’ function. For example, I have several occasions throughout the game I’m working on where the player will have to type on a keyboard or keypad certain words/numbers. In the scenario below I need them to type ‘selfishness of the man’s nature’. Any suggestions?

Understand "key board" or "keypad" or "key pad" as the keyboard.

The keyboard is here. It is scenery.

Typing is an action applying to one visible thing. 

Understand "type on [a keyboard]" as typing.  

After typing "selfishness of the man's nature" on the keyboard:
	say "You hear the iron click and the wheel begins to turn until it reaches a 180 degree position."

As it stands, you’re just creating the action “type on keyboard”. If you want the player to be able to enter arbitrary text in that command, you need to tell Inform to expect that:

The keyboard is here. It is scenery.

Typing it on is an action applying to one topic and one thing.
Understand "type [text] on [something]" as typing it on.

Check typing it on:
    say "That seems to accomplish nothing." instead.

Instead of typing "selfishness of the man's nature" on the keyboard:
	say "You hear the iron click and the wheel begins to turn until it reaches a 180 degree position."

The important parts here are “action applying to one topic and one thing”, as well as the “[text]” token in the understand line. See §17.5 of Writing with Inform.

2 Likes

I think I’ve got the formula now. Thank you!

But now I’ve got a new problem. When I replay it, I get Inform 6 ran out of memory

I had put:

Use MAX_PROP_TABLE_SIZE of 50000.

back at the beginning of the game but should I have put another line in addition?

Blockquote

I suspect that because I have two instances in the game where there is typing that I’ve created a clash instead of actually running out of memory. Here’s my two typing sections. Have I written something redundant?

Carry out typing it on:
	say "You type [the topic understood] on the wooden keypad.";
	If the topic understood matches "consciousness of duty":
		Say "[line break]The box makes a clicking noise which is followed by one of its sides popping out. It seems that the box was housing a portable stair step.";
		Now the portable stair step is in the location.
		The portable stair step is a thing.
 
The Rusty Keyboard is here. It is scenery.


Check typing it on:
    say "That seems to accomplish nothing." instead.

Instead of typing "selfishness of the man's nature" on the Rusty Keyboard:
	say "You hear the iron click and the wheel begins to turn until it reaches a 180 degree position."


The entire “Inform 6 ran out of memory” thing is an annoying relic in the design on the compiler. It doesn’t mean that you did anything wrong, your game has just gotten a bit larger than the compiler was set up to expect. Just raise the number in question until the error goes away.

As for your two sets of rules, yes, the generic “check typing it on” would prevent the “carry out typing it on” from running. You’d probably want to change the first one to be an Instead of typing it on the wooden keypad rule (assuming you have an object called a wooden keypad).

1 Like

Will be fixed in the next release.

4 Likes

Is there a project date on the next release?

Ok, I was trying fix this but I might have misunderstood what you meant. Here’s what I changed it to:

Typing it on is an action applying to one topic and one thing.  Understand "type [text] on [something]" as typing it on.

Instead of typing it on the wooden keypad: 
	say "You type [the topic understood] on the wooden keypad.";
	if the topic understood matches "consciousness of duty":
		say "[line break]The box makes a clicking noise which is followed by one of its sides popping out. It seems that the box was housing a portable stair step.";
		now the portable stair step is in the location.

This is a tricky bit of Inform-ese that’s not well explained in the documentation, unfortunately – your action is called “typing”, not “typing it on” – the “it” and the “on” help Inform understand where the nouns will wind up going, so they’re necessary when you’re doing action declaration, but not otherwise. This should work:

Instead of typing on the wooden keypad: 
	say "You type [the topic understood] on the wooden keypad.";
	if the topic understood matches "consciousness of duty":
		say "[line break]The box makes a clicking noise which is followed by one of its sides popping out. It seems that the box was housing a portable stair step.";
		now the portable stair step is in the location.
1 Like

Thank you thank you thank you!

It fixed the problem but the out of memory is reoccurring. Does it matter where I have this line or is it wrong altogether:

Use MAX_PROP_TABLE_SIZE of 50000.

I ask this because it’s still giving me the same message. :roll_eyes:

What is the exact message? You need to look in the Console tab, not the Report tab.

I have no more information about anyone else about the next I7 release.

You can build the latest I6 from source and install it into your I7 application; this should work and relieve the pain of memory setting failures.

Except it’s more complicated on MacOS because of app signing. You’d have to use a code-unsigning tool. (They exist but I haven’t looked into it.)

1 Like
The memory setting MAX_OBJECTS (which is 512 at present) has been exceeded.  Try running Inform again with $MAX_OBJECTS=<some-larger-number> on the command line.

Okay, so add the line

Use MAX_OBJECTS of 1000.

…somewhere in your game.

3 Likes

If I could shake your hand, I would! :fist_left:

1 Like