Twine Version: 2.7.1
SugarCube 2.36.1
Hello everyone,
i encountered a, what i think a simple problem, but i cant solve it. I want to remember twine, which link was clicked from a for-loop, on a new site. I tried the following.
StoryInit
<<if not $StudLinkClicked>>
<<set $StudLinkClicked = new Array(119).fill(false)>>
<</if>>
Selection site:
<<for _i to 0; _i lte 39; _i++>>
<<set _index = _i>>
<<link `"$student_names[_index]$student_surnames[_index]"``"Student"`>>
<<run $StudLinkClicked[_index] = true>><</link>>
<</for>>
I have two arrays, one with names and one with surnames. I am combining this two to one link.
E.g. array1-name: Sarah. Array2-surname:Parker. Gives the Link “Sarah Parker”.
In therory the variable $StudLinkClicked should save the array location.
The link site “Student”:
<<for _i to 0; _i lte 39; _i++>>
<<if $StudLinkClicked[_i]>>
The Link for $student_names[_i]$student_surnames[_i] was clicked.
<</if>>
<</for>>
On this site, it shall show me which linked was clicked.
Now the Problem: The variable has always the value 40! And i dont understand why…? Can someone help and explain it to me?
Many thanks