Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Dynamic links with SugarCube 2

$
0
0
I'd like to create a passage with some links, created from an array (of strings). To create this links I have insert this code on the passage:
<<for _i to 0; _i lt $gallery.length; _i++>>
	<<set _link to $gallery[_i]>>
	[[_link|GalleryImage][$galleryImage to _link]]<br />
<</for>>

$gallery is an array of strings like "home", "church", "university".
All links are linked to the same passage "GalleryImage". On this passage I want to show the images, based on the gallery array. So I want to set $galleryImage for every link. But here is the problem: Every link sets $galleryImage to the last element from the $gallery array.
How can I solve this problem?

Kind regards
from Purzelkater


Viewing all articles
Browse latest Browse all 1844

Trending Articles