0 votes
by (390 points)
closed by

I posted this question earlier, but maybe didn't clearly explain what I needed to have done. Then again, maybe it is not possible. I am working in Harlowe 2.1 in Twine 2.

I am programming a baseball game that has different variables that include the player's name, the result of the pitch, where the ball went, and how far.

When the math is all said and done, I end up with a larger variable that displays the calculated variables as such:

(set:$event to "$batter hit a $hitdist $bases to $hitloc.")

Which would say something like "Bryan hit a deep outfield fly to LF"

And with each pitch, the event changes.

What I want to do is to STORE that variable into an array as a string of pure text so that you can see a complete recap of the game. Unfortunately, whatever I have tried just displays the most recent event.

Here is some of the code I have tried...

(set:$recap to it + (a:"(text:$event)"))
(set:$hist to "(text:$event)")
(set:$recap to it + (a:$hist))

Then even tried to get ahead by turning the internal variables themselves into text when creating the $event variable...

(set:$event to "
(text:$batter) gets on with a (text:$hitdist) (text:$bases) to (text:$hitloc).")]

(set:$hist to (text:$event))

(set:$recap to it + (a:$hist))

Is it possible to take these changing variables and convert them all into text to be stored uniquely in an array?

Thanks for any help.

closed with the note: I figured the answer out. I had to set the variables in $event to be outside of the quotations.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...