Howdy, Stranger!

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

Twine 2, Sugarcube 2, whitespace issues, listing links to passages displayed based on variables

Okay, if this has been asked before, I am sorry! I have looked around a bunch. Maybe this has been asked, and I didn't get it, I dunno. I DID find like, <<nobr>> just from the documentation, and stuff, but that creates a single line, and I need several lines.

Endgame area, you have a list of discussion topics, which are, no matter what, options. But, some are specific. Like, we're talking lots and lots of variables are set. Some add or subtract from what I'd call personality macros-- how much of a jerk you are, how friendly, etc. There are also variables like $disney, for example, which depend on the player specifically going to a passage where they make a joke about Disney World.

So, current code, or, a sampling of it, for the optional endgame conversations you can have:
[[... Are we gonna die down here?->willwedie]]
[[For real, though, what do you think this... $elevatorname... is?->whatisthis]]
<<if $friends >=4>>[[What kind of appointment did you come here for, anyways?->whyareyouhere]]<<else>><</if>>
<<if $dick >= 5>>[[Do you have a problem with me?->gotaproblem]]<</if>>
<<if $triedcieling is true>>[[That ceiling thing always works on TV...->discussceiling]]<<else>><</if>>
<<if $fourdone is true>>[[Let's talk about what happened when I pressed the 4 button.->talkabout4]]<<else>><</if>>
<<if $jerrymode is true>>''Jerry Mode dialogue, make me into a passage later.''<<else>><</if>>
<<if $playername is "Tom">>''Dialogue option based on the name Tom. Requires you to have a certain friendliness/flirt level. Ask if she watches PnR. Deal with that later."<<else>><</if>>
<<if $disney is true>>[[... Ever been to Disney World?->beentodisney]]<<else>><</if>>

So, for sure, non-variable-dependent stuff, that goes up top. But if, say, jerrymode is false, $fourdone is false, $playername is "Tom" is false, and $friends is not greater than four, I end up getting odd whitespace, which just, that doesn't work for me. For example, quick run through, $jerrymode is false, $triedcieling is false, $fourdone is false, $dick is not gte 5, $friends is gte 4, $playername is "Tom," and $disney is true.

This is how it looks:
MYDOV6o.png

<<nobr>> would make that all a single line. <<elseif>> attached to an <<if>> kind of confuses me but seems like it wouldn't work, just replace something based on a set variable, which will be helpful for certain stuff here, but still doesn't fix unrelated variables (this is just what I bothered to put down, but for example, Jerry Mode is entirely something unrelated to almost all of the other variables, it can be true or false regardless of any other variable besides $playername).

So yeah. Gotta fix that whitespace. Help, please?

Comments

  • Have you tried using backslashes at the ends of the lines? Try breaking it up like that with your macro tags on their own lines with a slash at the end and see if it works.
    <<if $friends >=4>>\
    [[What kind of appointment did you come here for, anyways?->whyareyouhere]]<<else>>\
    <</if>>\
    <<if $dick >= 5>>\
    [[Do you have a problem with me?->gotaproblem]]
    <</if>>\
    
  • @methodandred

    A couple of things:

    1. In your example a number of your <<if>> macros have redundant <<else>> macros, if you don't plan to include some sort of output in them then they should be removed.

    2. If a variable contains either true or false then you don't need to compare that variable to true or false in an <<if>> macro, you can just use <<if $varaiable>> to test for true and <<if not $variable>> to test for false.

    eg.
    <<if $jerrymode is true>>''Jerry Mode dialogue, make me into a passage later.''<<else>><</if>>
    
    should just be
    
    <<if $jerrymode>>''Jerry Mode dialogue, make me into a passage later.''<</if>>
    
  • Have you tried using backslashes at the ends of the lines? Try breaking it up like that with your macro tags on their own lines with a slash at the end and see if it works.
    <<if $friends >=4>>\
    [[What kind of appointment did you come here for, anyways?->whyareyouhere]]<<else>>\
    <</if>>\
    <<if $dick >= 5>>\
    [[Do you have a problem with me?->gotaproblem]]
    <</if>>\
    

    Well, this produces basically the same effect as <<nobr>>. It puts 'em all on the same line.
    greyelf wrote: »
    @methodandred

    A couple of things:

    1. In your example a number of your <<if>> macros have redundant <<else>> macros, if you don't plan to include some sort of output in them then they should be removed.

    2. If a variable contains either true or false then you don't need to compare that variable to true or false in an <<if>> macro, you can just use <<if $varaiable>> to test for true and <<if not $variable>> to test for false.

    eg.
    <<if $jerrymode is true>>''Jerry Mode dialogue, make me into a passage later.''<<else>><</if>>
    
    should just be
    
    <<if $jerrymode>>''Jerry Mode dialogue, make me into a passage later.''<</if>>
    

    Okay, word, IDK why I didn't know that I didn't need <<else>>'s. I guess I read that documentation wrong, or it just didn't connect for me. I'll comb through and try to get rid of else's that aren't needed, and reformat stuff. I've been going about this with a poor workflow tbh, but, as I'm adding friendly/neutral/dick-ish, and stuff in-between those, an conditional potential options to the previous passages, and THEN re-counting up potential profiles on how you could have acted, I might as well clear all that up.

    But yeah, backslashes just performed like <<nobr>>, so, same whitespace issue OR having them on one line is where I'm at still, both of which don't really work for me.
  • edited April 2016
    re: controlling the line breaks
    Try placing the line-breaks you want to appear inside the <<if>> macro while removing the ones after the <<endif>> with a backslash.
    eg.
    [[... Are we gonna die down here?->willwedie]]
    [[For real, though, what do you think this... $elevatorname... is?->whatisthis]]
    <<if $friends >=4>>[[What kind of appointment did you come here for, anyways?->whyareyouhere]]
    <</if>>\
    <<if $dick >= 5>>[[Do you have a problem with me?->gotaproblem]]
    <</if>>\
    <<if $triedcieling is true>>[[That ceiling thing always works on TV...->discussceiling]]
    <</if>>\
    
    .... etc....
    
    ... that way the line-breaks will only be added if the <<if>> macro is true.
  • edited April 2016
    Worked perfectly! Thanks a ton!

    And now... //I have so much whitespace to fix.//

    edit: that is NOT how you italicize things, but i haven't slept in a very long time and I find that mistake hilarious
Sign In or Register to comment.