Howdy, Stranger!

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

Can't figure out how to remove unwanted skipped line

(Using Harlowe 1.2.3) I have a passage that contains text for two separate scenarios ($step 1 and $step 2). The problem is with (else-if: $step is 2), when I test or play this step, the text skips the first line and is below where the text on all my other pages start. I attempted to use the tips in the Harlowe 1.2.3 manual for 'collapsing whitespace' and 'escaped line break', but they didn't help, and any tinkering I did to my $step 1 text would only result in errors.
Is there any way to remove the line skip?

Comments

  • edited March 2017
    You could try something like this:
    {
    (set: $step to (random:1,2))
    }
    {
    (if: $step is 1)[The quick RED fox jumped over the lazy dog]\
    (else-if: $step is 2)[The quick YELLOW fox jumped over the lazy dog.]\
    }
    

    Ignore the (set:) part, that being just to setup the $step variable for testing.

    I am having another issue with linebreaks. I want to keep them! But only inside a hook. I beginning to think it may not be possible. Aside from this digression, hope ma code helped.
  • Basically, every time you use the ENTER key on your keyboard to add a line-break to the contents of a passage this line-break will be converted by the story format into a HTML br element and this can result in empty line appearing in the generated page.

    You have two choices:

    1. Use Collapsing Whitespace markup.

    This removes all line-breaks between the open and close curly braces, but not the line-break after the close curly brace. The down-side is that you can't separate sentences into paragraphs within a set of braces without using a HTML (p)aragraph element
    {
    This sentance
    will appear on
    a single line.
    
    Unfortunately this paragraph/sentance will appear on the same line.
    <p>But this paragraph wont but it will be added to the generate page before the previous sentances, this is because it's using a HTML element.</p>
    }
    


    2. Use Escaped line break markup.

    The BACKSLASH character can be used to either remove a single line-break immediately prior to it, or a single line-break immediately following it, but not both.
    This sentance \
    will appear on \
    a single line.
    
    This sentance 
    \will also appear on 
    \a single line.
    
    This sentance 
    \
    will appear on 
    \two lines.
    
    
    NOTE: In the second example each of the first two lines ends with a SPACE character.

    You can also use Escaped line break markup to remove (a) empty line(s) added to the content of your passage.
    To do this you need either:
    1. add a single SPACE character to \
     \
    the start of the empty line \
    or
    2. use two semi-consecutive BACKSLASH characters, one at the end of the first line of text \
    
    \and one at the start of the second line of text \
    but this only works if there is a single empty line.
    
  • Could this also work inside a hook?

    I was hoping something like this might work...
    (set: $var to 1)
    {
    (if: $var is 1)[This sentance 
    \
    will hopefully appear on 
    \two lines. In my dreams it does.
    ]
    }
    
    Sadly it doesn't. Can anything be done here? Or would it be easier just to setup a new passage, and display its contents.
  • There is no need to use both Collapsing Whitespace markup and Escaped line break markup on the same section of text, use one or the other.
    Kallooka wrote: »
    Could this also work inside a hook?
    I was hoping something like this might work...
    As I stated earlier, Collapsing Whitespace markup removes ALL line-breaks within the marked text.

    Try the following, it results in the first two words of the sentence appearing on one line and the rest of the words appearing on the next.
    (set: $var to 1)
    (if: $var is 1)[This sentence \
    
    will appear on 
    \two lines. No dreams required.
    ]
    
  • Thanks for all the suggestions! I did manage to solve the line skip by myself, but only by diverting both steps to their own separate passages and then redirecting them back together, which was quite fiddly. I'll work through everyone's solutions to make things easier in the future!
Sign In or Register to comment.