Howdy, Stranger!

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

Choices that link to same passage

Hi, I can't really find the answer to my question. My question is, in the first passage, there will be two option, A and B. Both of them will link to the passage C. Up to now, I am ok with them. The problem is, I want to add the variables to them. Such as, if i pick A, (set: $variable1 to 1), without affecting $ variable2.
If i pick B, ( set $variable2 to 2), without affecting $variable1.
By the way, how to hide the (display: "Variable Passage")? There is a big blank space in my passage before the text shows up.
I am using Harlowe.

Comments

  • 1.
    |A>[Option A]
    |B>[Option B]
    (click:?A)[(set: $variable1 to 1)
    (goto: "C")]
    (click:?B)[(set: $variable2 to 2)
    (goto: "C")]
    
    2. Put the code between { }.
  • sok.com wrote: »
    1.
    |A>[Option A]
    |B>[Option B]
    (click:?A)[(set: $variable1 to 1)
    (goto: "C")]
    (click:?B)[(set: $variable2 to 2)
    (goto: "C")]
    
    2. Put the code between { }.
    Thanks.
    But I can't figure out how to use the {}
    Using this code {(display: "Variable Passage")} , there is still a big blank gap before the text.
  • The { } symbols along with the backslash character are used to collapse white-space within the page output generated from the contents of a Passage.

    The extra white-space that can appear when you use (display: "passage name") can come from two places:
    a. The passage calling the (display:) macro.
    b. The passage being displayed by the (display:) macro.

    Where you need to add either { } or \ depends on where the white-space is being generated. As an example lets say with have the following two passages:

    1. The First passage.
    This passage has two potential places where white-space will be generated, the first at the end of the first line, and the second at the end of the second line.
    Some text...
    (display: "Second")
    Some more text...
    

    2. The Second passage.
    This passage has one potential place where white-space will be generated and that is the empty first line.
    note: There is a deliberate empty line (line-break) in the following and I have to quote the following code because otherwise the line-break on the first line of the content is absorbed.

    The second passage's text...

    The above two passages will generate the following visual output:
    Some text...
    
    The second passage's text...
    Some more text...
    
    ... and the following HTML output, notice the <br> elements.
    Some text...<br><tw-expression type="macro" name="display"><br>The second passage's text...</tw-expression><br>Some more text...
    

    Changing the (display: "Second") in the First passage to {(display: "Second")} will not remove (all) the white-space between the first and third lines of the visual output because some of it is being generated in the contents of the Second passage so that is where you need to use the collapsing white-space related markup.

    note: I included the word (all) in the above because there are two places the white-space the between the first and third lines of the visual output is being generating as you can see in the placement of the <br> elements in the generated HTML, they are:

    1. The line-break at the end of the first line of the First passage's contents.
    2. The line-break on the first line of the Second passage's contents.
Sign In or Register to comment.