Howdy, Stranger!

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

Passage Help - Hiding some text in a long passage then replacing the visible with the hidden text?

In effect, make it look like we've gone to another passage, but all we've done is replace the text in the first part of the passage with the text that we previously hid? Using Sugarcube 2.5?/Twine 2.

If it's not clear, I wanted to have my Passages 'look' like you can read them in one glance, then there's a link at the bottom of it (which I know how to do now (span/click/replace)), which opens up the text - but replace just seems to 'add' onto the existing text entry, where I'd like it to replace the first part of the Passage? Hope that makes sense now.

I've been trying to find out how to do this - if it's not possible, that's okay. I'll be content on having more text open up, but... I think it'd be a cool way to keep showing text until you're done reading that entry.

Comments

  • WARNING: You should upgrade your SugarCube v2.5 to the latest which is v2.7.2

    The following will do what you asked, assuming that v2.5 has the same features as v2,7,2, it uses a Custom Style to define element with an ID of text which is replaced when the "Continue" link is clicked.
    @
    
    <<click "Continue">>\
    	<<replace "#text">>Different paragraphs of text.
    Different paragraphs of text.<</replace>>\
    <</click>>
    

    note: If the text you are replacing the original with is long then you may want to store that text within another passage and use a <<display>> macro to display it.
    <<click "Continue">>\
    	<<replace "#text">><<display "Long Text">><</replace>>\
    <</click>>
    
  • edited August 2016
    Oh. I have 2.7.0 Sugarcube, sorry. Oh. I guess there's an update for it? and I'll see if that works for me. I'll test it in a few minutes.

    (Okay. Updated to 2.7.2)

    How do you get rid of the second "Keep Reading" <<click>>? It works beautifully - but the 'Click to continue' doesn't 'disappear' at all.
  • And as for the passage - It wasn't really long, per se. Just wanted a way to somewhat condense it into a visual way that you could read in one go, then click the button, and get more in the same area, then once you were done, pick your choices, etc.
  • If you want the "Continue" link to also be replaced then place it within the area marked for replacement.
    @
    
  • greyelf wrote: »
    If you want the "Continue" link to also be replaced then place it within the area marked for replacement.
    @
    
    That is weird. I tried it, and it works. Just that... well, just looking at the code you had provided to help the "Keep Reading" click macro disappear... it seemed like it'd erase all of the text. But apparently not. haha. Thanks again :)
  • Gryphbear wrote: »
    That is weird. I tried it, and it works. Just that... well, just looking at the code you had provided to help the "Keep Reading" click macro disappear... it seemed like it'd erase all of the text. But apparently not. haha. Thanks again :)
    The <<replace>> macro replaces all content within the targeted element(s). No more, no less.

    The target element in greyelf's examples is the one created by the custom styles markup. For example:
    @  ← This is the markup's closing tag.
    
    …content outside of the container…
    
    For the <<click>> to be replaced along with everything else, it needs to be within that container. In their first example, the <<click>> was simply outside of the replacement area, which is why it wasn't replaced.

    There is, honestly, nothing weird about how this works.
Sign In or Register to comment.