Say "punctuation mark" yields error

Hey All-

I’ve got a situation in which I’d like the player to be able to SAY ?. As in, SAY QUESTION MARK.

Saytext is a text that varies.

Instead of saying:
	now saytext is the player's command;
    if the player's command matches "say ?":
		say "CORRECT.";
	otherwise if the player's command matches "say question mark":
		say "CORRECT";
    otherwise:
        say "WRONG".

Obviously the “SAY QUESTION MARK” works fine, but me being me and always inadvertently picking things that present coding problems, the “SAY ?” part yields this error:

Problem. You wrote ‘if the player’s command matches “say ?”’ : but ‘understand’ text cannot contain literal punctuation, or more specifically cannot contain any of these: . , ! ? : ; since they are already used in various ways by the parser, and would not correctly match here.

Is there a way to get around this, or do I need to rethink it?

Shot in the dark that may not exist but worth a try:
if the player's command matches "say [question mark]"

1 Like

Here’s how I would start:

Saytext is a text that varies.

Saying is an action applying to one topic.
Understand the command "say" as something new. [ Otherwise it's already taken by the answering action. ]
Understand "say [text]" as saying.

Instead of saying:
	now saytext is the topic understood;
	if saytext is "?":
		say "CORRECT.";
	otherwise if saytext is "question mark":
		say "CORRECT";
	otherwise:
		say "WRONG".
2 Likes

HAHA! That works. I thought this would be harder. Thanks! I’ll use “the topic understood” from now on!

Just to be clear, topic understood only works with the [text] token.

1 Like