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

Sugarcube 2: Issues setting a variable in a link

$
0
0
Hi,

I have an array $houses containing a bunch of objects. I have a passage set in a street, where I load a list of houses that link to a House passage that would then describe whichever house the player decided to go to.

The code in my street passage to display the list of houses as links is as follows:
::Street

You are on <<print $activeStreet>>.

You can go to:
<<for $i to 0; $i lt $houses.length; $i++>>
	[[$houses[$i].housenumber + " " + $houses[$i].street|House][$activeHouse to $houses[$i]]]
<</for>>

The code in my House passage is as follows:
::House

You are standing in front of <<print $activeHouse.housenumber>> <<print $activeHouse.street>>.

The problem is that the passage link is not setting $activeHouse to $houses[$i]. Am I doing something wrong?
Error: <<print>>: bad evaluation: Cannot read property 'housenumber' of undefined 
Error: <<print>>: bad evaluation: Cannot read property 'street' of undefined.

Thanks.

Viewing all articles
Browse latest Browse all 1844

Trending Articles