0 votes
by (150 points)

Hello!

I have recently begun working on a small story for a writing test, demonstrating branching dialogue systems and consequences. I've recently run into a problem. I have one question 'hub' where the player can explore different options, being returned to the hub at the end of each option. I want to be able to lock the player out from repeating options and have managed to make some progress with 'visited' and ensuring that I can toggle between the active links and deactivated links when I want.

However when I test it, and follow an option back to the hub, I find that the other links are left grey and inactive regardless of if they've been visited or not. I'm a bit stumped and very new to this so please let me know if I've made any glaring errors:

<<if visited (Passage One)>><strike>Passage One</strike>
<<else>><<choice [[Passage One]]>><<endif>>

<<if visited (Passage Two)>><strike>Passage Two</strike>
<<else>><<choice [[Passage Two]]>><<endif>>

I've changed the passage names for readability, but this is the general setup I am using. I'm working with Sugarcube 2.

My apologies if I haven't explained myself well! I need to brush up on the vocabulary to make more sense of my problem.

1 Answer

+1 vote
by (65.4k points)
edited by
 
Best answer

I'd suggest reading SugarCube's documentation for the <<choice>> macro because it explicitly spells out that the macro deactivates all other <<choice>> macros within the same passage.

For what you're attempting to do, regular links or <<link>> macros are what you want.

PS:  I'd suggest reading SugarCube's documentation.

PPS:  Sent from my phone.  I'll clean up this answer later.  Edit: Cleaned up.

by (150 points)
Cheers! I completely overlooked that, it's fixed and working as intended.
by (65.4k points)

Since you replied before I had a chance to tidy and expand my original answer, here are some other comments I wanted to make.


The following from your example (though corrected to use a regular link):

<<if visited (Passage One)>><strike>Passage One</strike><<else>>[[Passage One]]<<endif>>

Should look more like this:

<<if visited("Passage One")>><s>Passage One</s><<else>>[[Passage One]]<</if>>

 

Issues: (in order of appearance)

  • It's not idiomatic to put a space between function/method names and their invocation parenthesis.  For example:
    /* GOOD */
    visited(…)
    
    /* BAD */
    visited (…)
    
  • You also need to quote the name of the passage within the call to the function, however, since it won't work otherwise that was likely just a typo in your example.
  • The HTML <strike> tag has been officially deprecated since around 2000 (HTML4) and obsoleted since 2014 (HTML5).  The correct markup to use is either SugarCube's strikethrough markup or the HTML <s> tag.  For example:
    /* SugarCube's strikethrough markup */
    ==struck text==
    
    /* HTML <s> tag */
    <s>struck text</s>
    
  • The <<end…>> style of closing macro tag has been deprecated for quite a while now.  You should be using <</…>> style closing tags, as shown in all examples within SugarCube's Macro Library documentation.

Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...