Array variables are pointers vs values in Twine Harlowe

Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2.3.9
Story Format: Harlowe 3.1.0

Question: How do I get the value of a variable stored in an array without storing it as a pointer?

Reason:
I have an array which I store all the past history of my conversations with a character.
I have a problem when I generate random content, I use text variables $tempText, $tempText2, etc… to store random text and then print them and then save them into the $history array.

I found out that the (set: $history to (a: “$tempText $tempText2 $tempText”) + $history) does not store the values of $tempText but rather the pointer of that variable. So in the following passage I use the same variables again, result is that the $history is inaccurate since it references as a pointer $tempText, rather than value of that variable at the time I added to the array. I tried to convert the variables to Strings with (text: $tempText) but that doesn’t work either. How do I store a value of a variable in an array in Harlowe and not the pointer variable?

Examples:
The following is the code I am playing with. You can see that
$tempText in the top history should be either: “I want to thank you! You saved my life!” or “OMG! It’s you! You saved my life, you’re amazing!”
$tempText2 should be “If you hadn’t shown up, I’d be doomed for sure!”
but they are overridden by the following passage’s use of $tempText

First Passage:

	(set: $tempText to (either: "I want to thank you! You saved my life!",
	"OMG! It's you! You saved my life, you're amazing!"))
	(set: $tempText2 to "If you hadn't shown up, I'd be doomed for sure!
") (set: $tempText3 to (either: "You can bet the Militia would never have come back for me", "Damn Militia sent us out there to get slaughtered" )) $tempText $tempText2 $tempText3 (set: $history to (a: "(text: $tempText) (text:$tempText2) (text:$tempText3)
") + $history)

Following Passage:

(set: $tempText2 to (either: "Did the Militia send you into that fray, and then left you there?","What do you mean? I thought the Militia was here to protect us all?","What you mean about the Militia?"))
	(link-reveal-goto: "$tempText $tempText2","meetOpposedMilitia")[
		(set: $history to (a: "$tempText $tempText2
") + $history) ]

Result:
"
Your welcome. Did the Militia send you into that fray, and then left you there? Damn Militia sent us out there to get slaughtered

Your welcome. Did the Militia send you into that fray, and then left you there?

The Militia sends us all to our doom! We’ve lost countless Bunnies to their terrible command and leadership! I was forcibly conscripted to fight for them.
You found me after the last command abandoned us when the zombies got too close for comfort
"
Your welcome… left you there? replace prior values

If you’re attempting to store the choices within a passage/section/whatever as a single concatenated string within the $history array, then you should be able to do so via something like the following:

(set: $history to (a: $tempText + " " + $tempText2 + " " + $tempText3) + $history)

Thats exactly what I am doing. But when $tempText changes later in the story the stored values in the $history array changes to the new $tempText values
e.g. (set: $tempText to Hello!)

(print: $history) result:
"
Hello! Did the Militia send you into that fray, and then left you there? Damn Militia sent us out there to get slaughtered

Hello! Did the Militia send you into that fray, and then left you there?

The Militia sends us all to our doom! We’ve lost countless Bunnies to their terrible command and leadership! I was forcibly conscripted to fight for them.
You found me after the last command abandoned us when the zombies got too close for comfort
"

As explained by TME you need to concatenated the contents of the relevent ‘text’ variables together before adding the result to your $history Array.

note: The following example is a variation of your own and it uses TWEE Notation.

:: Startup [startup]
(set: $history to (a:))

:: Start
{
(set: $tempText to (either: "I want to thank you! You saved my life!",	"OMG! It's you! You saved my life, you're amazing!"))
(set: $tempText2 to "If you hadn't shown up, I'd be doomed for sure!<br>")
(set: $tempText3 to (either: "You can bet the Militia would never have come back for me", "Damn Militia sent us out there to get slaughtered"))
}\
$tempText $tempText2 $tempText3
(set: $history to (a: $tempText + " " + $tempText2 + " " + $tempText3) + $history)
[[Next]]

:: Next
(set: $tempText2 to (either: "Did the Militia send you into that fray, and then left you there?", "What do you mean? I thought the Militia was here to protect us all?", "What you mean about the Militia?"))\
(link-reveal-goto: "$tempText $tempText2", "meetOpposedMilitia")[
	(set: $history to (a: $tempText + " " + $tempText2) + $history)
]

:: meetOpposedMilitia
DEBUG History: count: (print: $history's length)
list: {<ol>
(for: each _entry, ...$history)[
	<li>_entry</li>
]
</ol>
}

If you add the above to a test Harlowe based project, the select first the Next link and then the Random Text link, you will see that the debug output of the $history Array contains both the initial random text as well as the random text of the second link.

You were right! Some inputs I used had concatenations and others didn’t! " " + $tempText solves the variable issue :smiley:

I’m gonna test arrays out with storing string variables and see what happens too. Thanks for the help!