Twine Version: 2.9.2
I’ve been reading a lot of documentation and previous people’s posts and I cannot work out why this isn’t working for me as I’ve followed others advice which tells me there is probably something I’ve completely missed.
I’m trying to use the (if:) macro to go to a certain passage depending on what item the player has picked up and added to the $inventory
variable. However, at the moment it’s only running the (else:) macro and not (if:).
Any Ideas?
:: Startup Tagged Passage::
(set: $inventory to (array:))
::Passage::
As $name walks down the street they see a box on the floor. It flaps open in the wind and reveals two objects. They haven't got space in their bag for both, so which one does $name pick up?
{
(click: "pick up?")[(transition-depart:'slide-left')[(hide:?box1)]
(show:?object1)(show:?object2)]
=|=
|object1)[ (link:"object 1")[(set:$inventory to it + (array:'object 1'))(hide:?object2)
[Keep walking]
]
]]
=|=
|object2)[(link:"object 2")[(set:$inventory to it + (array:'object 2'))(hide:?object1)
[Keep walking]
]
]]
|==|
(if: $inventory contains 'object 1')[(click-goto:"Keep walking",'Path 2') ]
(else:)[(click-goto:"Keep walking",'Path 3')]
}
I know that the $inventory
variable is working as I have it print in the sidebar and can see that it is collecting the correct data dependant on what option you choose. However the (click-goto:)
is always choosing the (else:)
option.