Passing text argument to "To say"

I am trying to create a dynamic description based on passing a text argument to “To say”.

I can get it to work with a number argument:

``````To say foo (bar - a number):
say
"bar is: [bar]".

test is a room.
Description of test is "[foo 3]".
``````

Gives me expected results of:

test
bar is: 3

But this code:

``````To say foo (bar - some text):
say
"bar is: [bar]".

test is a room.
Description of test is "[foo 'baz']".
``````

Results in a compilation error:

Problem. In the sentence ‘"[foo ‘baz’]"’ , I was expecting to read a text, but instead found some text that I couldn’t understand - ‘‘baz’’.

Any assistance is appreciated.

You can’t nest quoted text like this, but you can define a text constant:

``````Baz-text is always "baz".

Description of test is "[foo baz-text]".
``````

Or you could break the description out into a separate phrase:

``````Description of test is "[test-description]".

To say test-description:
say foo "baz".
``````
2 Likes