Punctuation within Understand

Wondering if there’s a way to bypass the system to allow something like

Crying is an action applying to nothing. Understand "wail!" as crying.

without Inform getting mad at you about the “understand” text containing literal punctuation. (Presumably I’m getting this error because the parser reacts to ending punctuation like exclamation points differently, but I don’t see how that would have an affect on the player’s parser inputs.)

Thanks in advance for the assistance!

Could you maybe just have it as understand "wail" as crying. but in its rules check whether the player’s command includes the character “!”?

Not sure if this is what you mean, but adding

Check crying:
	if the player’s command includes “!”:
		continue the action.

comes up with the same error.

To be clear: Is your goal that the player must include the exclamation point in order to generate a crying action, or is it just that the parser recognize >WAIL! alongside >WAIL as a way of generating a crying action?

If the latter, you may find Emily Short’s Punctuation Removal extension (installed but not active by default) to be useful.


The parser splits out ending punctuation before trying to recognize verbs. This is why the compiler is reporting that error.

You need to do some trick similar to Punctuation Removal, which runs “after reading the player’s command”.

1 Like

Yay! This was indeed solved with the punctuation extension, at least for my game. However, I wonder for the future if there’s an elegant way within the extension (or perhaps without) to remove the exclamation points on SOME commands but not others? Or to only register the action if it includes an exclamation point?

Something here might help: §18.33. Reading a command.

Sorry for leading you astray earlier. The perils of a little knowledge and a mobile-friendly forum!


There are ways to do these, but the methods I have found aren’t exactly elegant.

For the first part, regarding removing exclamation points from some commands but not others…

To start, I’m not sure that I would recommend doing this. I think that most players rightfully prefer consistency in parser responses. Without pretty explicit prompting, it would be very hard to learn under which circumstances an exclamation point is allowed/required vs. when it is not. Still, as a technical matter, this can be accomplished without too much hassle by setting up a topic (or group of topics) with the verb words to which you want to attach the requirement.

"Exclamations Sometimes"

Include Punctuation Removal by Emily Short.

Place is a room.

Crying is an action applying to nothing.

Report crying:
    say "You cry for a bit."

Understand "wail" or "cry" or "lament" as "[wail word]". [creates a topic to use in matching]

Understand "[wail word]" as crying. [uses topic as basis for understanding verb; may break if the same verb words are used for other verbs as seen in https://intfiction.org/t/bug-topic-based-actions-not-parsed-if-they-share-a-verb-word-with-another-action/50281]

After reading a command:
    let temp storage be the substituted form of "[player's command]"; [see WWI 20.7 Making new text with text substitutions]
    remove exclamation points; [have to do this so that topic matching works correctly; handling of exclamation marks seems a bit inconsistent internally]
    unless the player's command matches "[wail word]": [see WWI 18.33 Reading a command]
	    change the text of the player's command to temp storage. [reverts to text including exclamation mark if a "wail word" not seen after their removal]

Test me with "jump / jump! / wail / wail!". [note that >JUMP! doesn't work but >WAIL! does]

For the second part, regarding allowing only commands with exclamation marks…

Advisability aside, as a technical matter, this can be accomplished with some I6-level manipulation.

"Exclamations Always"

Place is a room.

Crying is an action applying to nothing.

Report crying:
    say "You cry for a bit."


[ WailBangSub ;
    BeginAction( (+ the crying action +) , (+ noun +), (+ second noun +));

Verb 'wail!' * -> WailBang; 

-) after "Grammar" in "Output.i6t".

Test me with "jump / jump! / wail / wail!". [note that >WAIL doesn't work but >WAIL! does]

Note that neither of the above gets the parser to understand that an exclamation point ends the command, so >WAIL! CRY! won’t be handled the same way that >WAIL. CRY. would be handled under normal parsing rules.

1 Like