Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Clicking a link but staying on the same page

Hi I'm using SugarCube 2.18.0 and I want the player to be able to select two things:

Try to bribe the guard
Go back

If the player choses to bribe then the continuation text should be added on the bottom of the text that is already displayed on the page. One way of doing this would be using a link and a variable like this:
	"Can I pass?"
	"Sorry, I'm not allowed to let you through."

<<if not $bribe>>\
	[[Try to bribe the guard->gate][$bribe=1]]
	[[Go back->street]]
<<else>>\
	<<set $bribe=0>>\
	You pay the guard and he lets you through
<<endif>>\

But the page would reload and it doesn't feel like this is the best solution. What is the best way to do this?

Comments

  • You could use TwineScript like the following to achieve what you want.
    @
    
    .. it uses:

    1. Two Custom Styles to define the areas of the page being used to contain the dialogue and links.

    2. A <<link>> macro to allow Reader interaction within causing a passage transition.

    3. An <<append>> macro targeting the dialogue area to append the extra text once the first link is selected.

    4. A <<replace>> macro to remove the link being displayed within the links area.
Sign In or Register to comment.