Howdy, Stranger!

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

Harlowe - collapsing whitespace where dialogue options are unavailable?

Any help appreciated here - I've got the hang of whitespace collapsing with { }, but am a bit stumped here.

In this example, let's say we have a passage where you are presented with a chimp, and can choose to give it either a banana, your watch or a coin.

Each choice leads to a passage (bananagive, watchgive, coingive), where you may choose to either send the chimp away (moving on to a new decision tree), or give the chimp something else from the original list - sending you to that parallel passage.

To ensure a player can only visit each passage once, they contain a macro which sets a 'flag' variable (eg $beenbananagive) to 'true'. Each passage will only show a link to unvisited parallel passages, whose flag variables are still set to 'false':
You give the chimp a coin

(if:$beenbananagive is false)[[[give him a banana|bananagive]]]

(if:$beenwatchgive is false)[[[give him your watch|watchgive]]]

[[send him away|chimpsend]]

However, on testing, I've found the passages contain lines of whitespace where options have been hidden due to values being true. Can anyone help me remove these, so the available options appear below the "you give the chimp a coin" text without additional spaces?

Thank you!

Comments

  • Any help appreciated here - I've got the hang of whitespace collapsing with { }, but am a bit stumped here.

    In this example, let's say we have a passage where you are presented with a chimp, and can choose to give it either a banana, your watch or a coin.

    Each choice leads to a passage (bananagive, watchgive, coingive), where you may choose to either send the chimp away (moving on to a new decision tree), or give the chimp something else from the original list - sending you to that parallel passage.

    To ensure a player can only visit each passage once, they contain a macro which sets a 'flag' variable (eg $beenbananagive) to 'true'. Each passage will only show a link to unvisited parallel passages, whose flag variables are still set to 'false':
    You give the chimp a coin
    
    (if:$beenbananagive is false)[[[give him a banana|bananagive]]]
    
    (if:$beenwatchgive is false)[[[give him your watch|watchgive]]]
    
    [[send him away|chimpsend]]
    

    However, on testing, I've found the passages contain lines of whitespace where options have been hidden due to values being true. Can anyone help me remove these, so the available options appear below the "you give the chimp a coin" text without additional spaces?

    Thank you!

    Use the nametag:
    (if: $beenbannanagive is false)[You give the chimp a coin
    
    [[give him a banana|bananagive]]
    
    [[send him away|chimpsend]]](if: $beenwatchgive is false)[You give the chimp a coin
    
    [[give him your watch|watchgive]]
    
    [[send him away|chimpsend]]](else)[You give the chimp a coin
    
    [[give him a banana|bananagive]]
    
    [[give him your watch|watchgive]]
    
    [[send him away|chimpsend]]]
    

    Try that. I hope it'll work.
  • Hmm - maybe I've misunderstood you, but I'm having problems getting results from that in my passages? Appreciate the time though!
  • edited October 2016
    This can be accomplished by taking out the spaces between the hooks and then, inside each hook, adding a return after the link. This way, the return is only displayed when the link is displayed, adding another line for the next link to be displayed on.
    You give the chimp a coin
    (if:$beenbananagive is false)[[[give him a banana|bananagive]]
    ](if:$beenwatchgive is false)[[[give him your watch|watchgive]]
    ][[send him away|chimpsend]]
    

    This does kinda screw up the formatting-- and I think there's a way to collapse individual lines with backslashes \, which leaves it more readable-- but I personally find this way easier to remember.

    Hope that helps!
  • Marvellous - thanks Wraithling!
  • ...and now I can't find how to mark this as answered; apologies!
  • ...and now I can't find how to mark this as answered; apologies!

    Yeah, I think that this forum's been updated or something, because now I find it impossible to accept answers. It's weird innit.
Sign In or Register to comment.