Ending scene when at end of text array

I have this:

[code]HouseScene is a Scene.
HouseScene begins when location is the house.

HouseSceneText is a text that varies.
HouseSceneText is “[one of]Something[or]Something else.[or]Something entirely different.[or]END SCENE[stopping]”

Every turn during HouseScene, say “[HouseSceneText][line break]”

HouseScene ends when HouseSceneText is “END SCENE”.

When HouseScene ends:
say “End of scene!”[/code]

The intention is to have a new sentence printed out every turn during the HouseScene until HouseSceneText reaches its end.

It works but it feels a little clunky.

I assume this isn’t the usual way to do this. Is there a way to end the scene without having to compare the value of HouseSceneText when the length of HouseSceneText is variable?

The [one of]… thing is a shortcut. It’s not really meant to be used as a control variable. Obviously you can do it (the way you did it) but there’s no more convenient way to extract its value.

You could use a numeric counter instead, or have a “scene ends in four turns” and just match the duration up manually.

If you want a different kludge, you can put in a say phrase that actually sets a flag, like this:

[code]HouseScene is a Scene.
HouseScene begins when location is the house.

HouseSceneText is a text that varies.
HouseSceneText is “[one of]Something[or]Something else.[or]Something entirely different.[or]END SCENE[end the scene][stopping]”

Every turn during HouseScene, say “[HouseSceneText][line break]”

Scene ending trigger is a truth state that varies.

HouseScene ends when scene ending trigger is true.

To say end the scene: now scene ending trigger is true.

When HouseScene ends:
say “End of scene!”[/code]

That’s still a kludge, though. If you want to do something that works a bit more naturally, another thing you can do is fill up a table with the things you want to say. Then every turn you say the first non-blank row and blank out the row, and you end the scene when the table is empty. Like this:

[code]The Garden is a room. The house is inside from garden.

HouseScene is a Scene.
HouseScene begins when location is the house.

Table of House Scene Text
Text
“Something.”
“Something else.”
“Something entirely different.”
“End Scene.”

Every turn during HouseScene:
repeat through the table of house scene text:
say the text entry;
say line break;
blank out the whole row;
break. [this repeat… break structure just picks the first non-blank row then stops]

HouseScene ends when the Table of House Scene Text is empty.

When HouseScene ends:
say “End of scene!”[/code]