I7 : Passing a text to a say function from inside say

Sorry for the confusing topic line. I’m struggling on the syntax for this (or whether it’s possible). If I have a function

To say some-text (T - a text) with (A - number):
    say "[T] [A]".

How do I then reference this in the originating ‘say’ command?

say "This is [some-text 'Text' 1].";

Single or double quotes don’t work. What’s the syntax? Is this possible?

Thank you!!! (This may be really obvious, but I’m strugggling!!! lol


1 Like

Try this:

Lab is a room.

To say rockified (T - text) with (A - number):
	say "[T] [A]";

When play begins:
	say "Get ready for some rockified text:[line break]";
	say rockified "Rocking good news!" with 3;

Now you’ve got T&A. Hehehehe…



Thanks Wade! I’ve just been trawling the board and found out, belatedly that you can’t say the text variable within text. Yeah, I’m going to have to do something like this!!!

Specifically, you can’t put a text literal inside another text literal. This is the main reason for “multi-part substitutions” like [one of]…[or]…[stopping].

1 Like

I had sort of been using a solution similar to Wade’s but I always assumed it had to be

to say special-text of (x - a thing) and (y - a number): …

I’d always assumed the “of” and “and” had to be there. There are so many things like this in Inform–sometimes it wants exact syntax, sometimes it doesn’t. Which was confusing until I realized the lexer was, indeed, taking care of the most obvious ways people could vary, and the cases it didn’t were obviously semantically tricky. One more thing to add to my file of “stuff neat to recall but inefficient to remember.”

I also had some similar test cases and know I was a bit disappointed I couldn’t do stuff like [if the player’s command matches “word”] inside quotes, but the workaround (a separate “if” line that breaks up a sentence) is not very inconvenient at all, so I don’t mind throwing in a few extra “say” lines of code.

1 Like