When defining a new object within an array something seems wrong.
e.g.
StoryInit
<<set $children = []>>
<<set $mom to {
name: 'mom',
hair: 'blonde',
skin: 'white',
eyes: 'blue'
}>>
<<set $dad to {
name: 'dad',
hair: 'brown',
skin: 'white',
eyes: 'brown'
}>>
In the passage...
<<set _hair to [$mom.hair, $dad.hair]>>
<<set _skin to [$mom.skin, $dad.skin]>>
<<set _eyes to [$mom.eyes, $dad.eyes]>>
<<set $children.push( {
hair: _hair.random(),
skin: _skin.random(),
eyes: _eyes.random()
} )>>
<<print $children[0].hair>>
<<print $children[1].skin>>
<<print $children[2].eyes>>
The settings are set in StoryInit, but only the first variable works normally, the others do not....
Running...
"Brown hair"
"Error: <<print>>: bad evaluation: Cannot read property 'skin' of undefined"
"Error: <<print>>: bad evaluation: Cannot read property 'eyes' of undefined"
Is it likely that I'm doing something wrong? It seems like a problem to set the final object with all variables. As I'm a beginner this happens a lot.