Howdy, Stranger!

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

Collapse text

I'm such a rebel, two questions at once. Anyway, I'm using Harlowe and I haven't found anything by Google, so I may as well ask. What kind of code can I use to make some text collapsible?
In this game, FWAA, I'm using this sidebar code and within it is display: displaying the contents of an inventory. It's really long, though, so can I make it so that it's able to be opened and closed at leisure?

Comments

  • This might help you; you'll need to fiddle with the line breaks but it should set you on the right path.
    (set: $collapsed to false)
    (set: $collapsingtext to "of a lot of collapsible text. Here, have some lipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam augue ipsum, iaculis imperdiet ligula non, tempor bibendum nulla.")
    
    (link-repeat: "This is the beginning")[(if: $collapsed is false)[(replace: "?texthook")[](set: $collapsed to true)](else:)[(replace: "?texthook")[$collapsingtext](set: $collapsed to false)]]
    [$collapsingtext]<texthook|
    
  • edited November 2016
    (why did this double post, i don't know)
  • edited November 2016
    For some reason I get an error when I use the text you provided. All I've done was replace the lorem ipsum text with (display: other passage), and instead of displaying that other passage, I just get:
    ☕ Unexpected identifier
    This error message was reported by your browser's Javascript engine. I don't understand it either, but it usually means that an expression was badly written.

    What have I managed to break? :neutral:
    *EDIT* Haha, I figured out why I got that error and fixed it. Combining this sidebar code and the collapsing text code is giving me serious trouble though.
    What exactly is the "missing ) after argument list" error trying to tell me? Where could I have missed a )?
  • It probably means just what it says. You've left out a ) in some macro or other. They're often hard to spot.
  • without an example of the actual code producing the error we can only guess what may be causing that error.

    The 'argument list' part can be referring to the parameters you are passing to any of your macros, and can occur if you are trying to use a particular type of quote (either double or single) to both delimit a macro String parameter as well as delimit the overall String value.
    eg. both of the follow would result in the same error.
    (set: $var to "some text (display: "the passage name") some more text")
    
    (set: $var to 'some text (display: 'the passage name') some more text')
    
    ... and to fix this issue you need to either use the other type of quote internally or to escape the internal quotes using a backslash character.
    (set: $var to "some text (display: 'the passage name') some more text")
    (set: $var to "some text (display: \"the passage name\") some more text")
    
    (set: $var to 'some text (display: "the passage name") some more text')
    (set: $var to 'some text (display: \'the passage name\') some more text')
    
Sign In or Register to comment.