I'm using Sugarcube 2.21.0 and I'm trying to create a link that displays text but can also be clicked repeatedly.
<<link>> can be clicked repeatedly, but it doesn't display any text, instead operating silently.
<<linkreplace>> prints text, but it can only be clicked once.
I'm building an RPG and the goal is to create a <<link>> that allows the player to watch TV, which will output some random text about a show. However the player should also be able to click the link multiple times so as to watch multiple "episodes" in the same sitting.
This is a simplified example of the code I have so far:
<<linkreplace "Watch TV show">>
<<switch random(1, 2)>>
a warrior battling a dragon.
a wizard wandering the lands.
So right now when "Watch TV show" is clicked, the link disappears and it prints a random episode made up of the strings in the switch statement. But what should happen is that the "Watch TV show" link should stay active so the player can click it again to generate another random episode.
I've written a version of the code in Harlowe , using the (link-repeat) function, that does pretty much exactly what I need:
(link-repeat: "Watch TV show")
[(print: "You watch ")
(set: $output to (random: 1, 2))
(if: $output is 1)[(print: "a warrior battling a dragon. ")]
(elseif: $output is 2)[(print: " a wizard wandering the lands. ")]]
This was really simple and took me about 5 minutes to do, even though I don't understand Harlowe or use it regularly. The problem is that the program I need it for is written entirely in Sugarcube. Surely it's possible to do the same thing in Sugarcube?
Sorry if this is a really simple question. I've Googled everything relating to this for like half a day but can't find anything. Thanks in advance.