Hello,
I am still quite inexperienced with Twine but I am trying to learn. If I miss out some information below please ask - thank you in advance for even reading! I am using Sugarcube 2.21.0
I have created the following code for one of my programs (I am trying to generate random characters):
<<set given: $male_names= ["Noah", "Liam", .... "Antoine"]>>
<<set given: $female_names= ["Emma", "Olivia", ... "Alianna"]>>
<<set given: $surname = ["SMITH", "JOHNSON", ... "NOEL", "VANG"]>>
<<set given: $sex = ["male", "female"]>>
<<set $uniformed_commander to {sex: either($sex)}>>
<<if $uniformed_commander.sex eq "female">>
<<set $uniformed_commander to {name: either($female_names), surname: either($surname), age: random(30,50)}>>
<<else>>
<<set $uniformed_commander to {name: either($male_names), surname: either($surname), age: random(30,50)}>>
<</if>>
$uniformed_commander.sex
$uniformed_commander.name
$uniformed_commander.surname
$uniformed_commander.age
Now this code works - it generates correctly male or female etc. (i have tested it). However when I run it I get the following outcome every time:
$uniformed_commander.sex
Ezequiel
ROBERTSON
40
Everything works, it goes through randomly but it does NOT give me the first parameter. I tried assigning it to some other value, tried renaming it, tried dropping the $sex and downright putting there male/female. It does not work - what am I doing wrong?