Howdy, Stranger!

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

Variable passages and one-and-done links.

I'm working on my first project. It's taking place in the same location over a series of nights, changing based on a number of global state variables. Each state changes the passage's basic description, what options are available, and what those options do.

Those options represent (broadly) the current day, and a few physiological or psychological traits. If I wanted to make one passage per combination of variables, I'd end up with 30+, so  it would be easiest to implement as a single passage with segments that vary based on those states.

What would be the easiest way to implement this?

I'd also like some choices to be selectable only once. I've experimented with click: and hooks, but those appear to "reset" if you leave the passage and come back.

What would be the easiest way to implement a "click one and done" link?

Thanks!

Comments

  • You need to state which story format your are using, as answers can be different for each one.

    There is a concept called a Setter Link (from Twine 1), that works by assigning a value to a variable when a user clicks on a link, and then customizing the next passage show based on those variables.

    In Twine 2

    SugarCube:
    First use a Link with Setter to show a link and then use the <<if>> macro to customize the next passage.

    :: First Passage
    [[Option 1|Second Passage][$option to 1]]
    [[Option 1|Second Passage][$option to 2]]
    [[Option 3|Second Passage][$option to 3]]

    :: Second Passage
    <<if $option is 1>>
    This is the text to show for option 1
    <<elseif $option is 2>>
    This is the text to show for option 2
    <<else>>
    This is the text to show for option 3, or any other option.
    <</if>>
    Harlowe:
    This post expains how the link is setup and this previous post in same thread explains how to use (if:) macros to setup the next passage.
  • I'm using Harlowe, but I can switch to Sugarcube if that's more conductive to what I'm trying to do.
Sign In or Register to comment.