Twine Version: 2.9.2
Harlowe: 3.3.9
Forgive me if this has been asked somewhere else, I have looked but can’t seem to find the answer I’m looking for.
I’d like to add a ‘search’ function into my story’s sidebar. Ideally I’d like the player to use a prompt macro to enter a number and then whatever that number is takes them to the appropriate passage in twine.
(I would like for this to be in the sidebar but if that’s not possible then I can just add it to each passage.)
I’ve got the below code into a header tagged passage. The ‘search’ function shows up in the sidebar and works with (prompt:) but I can’t seem to get it to then use the variable produced ($selection) to work with the (if:) and (else-if:) macros to perform the (go-to:) function.
Any ideas?
{
(append:?sidebar)[
(link:"Search",(button:))[
(set: $selection to (prompt: [Search], "Item Number", "Cancel" , "Confirm"))]
(if: $selection is '1')[(goto:'passage 1')]
(else-if: $selection is '2')[(goto:'passage 2')]
]
}
I also can’t get the (prompt:) macro to appear again once entered once but haven’t had time to try and tackle that yet so if anyone has any suggestions for that also I’d appreciate it.
Thank you!