I'm trying to manipulate an object generically by setting a temporary variable to act on that is supposed to modify the original object. What I think is happening is that I'm making a copy of that object and modifying the copy, which leaves the original untouched.
Here is my code:
resource tester
<<nobr>>
<<set $chosenResource>>
<<set $Water = {
"name" : "Water",
"type" : "resource",
"resourceType" : "standard",
"amount" : 0,
}>><</nobr>>\
\
You have <<=$Water.amount>> water rations left
\<<set $Water.amount += 1>>
You have <<=$Water.amount>> water rations left
\<<set $Water.amount -= 1>>
You have <<=$Water.amount>> water rations left
<<link "Fill" "incrementResource">><<set $chosenResource = $Water>><</link>>
incrementResource:
<<= $chosenResource.name>>: <<= $chosenResource.amount>>
Adding 1
\<<set $chosenResource.amount += 1>>
<<= $chosenResource.name>>: <<= $chosenResource.amount>>
<hr>
<<set _temp = State.index(State.length - 2).title>>\
<<link "Continue" _temp>><</link>>
How do I set a variable to reference an existing object, instead of copying an object?