Howdy, Stranger!

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

Conditional lines showing up as blank lines

I am puzzled. I am using Jonah, so passages just cascade one after the other down the page. I think people using some of the other story formats in which only one passage shows on the screen at a time will not see this problem so obviously.

I have a passage like this:

==Passage Title==
Passage text.

<<If $A>>[[Choice A.]]<<endif>>
<<If $B>>[[Choice B.]]<<endif>>
<<If $C>>[[Choice C.]]<<endif>>
<<If $D>>[[Choice D.]]<<endif>>
<<If $E>>[[Choice E.]]<<endif>>
<<If $F>>[[Choice F.]]<<endif>>

Depending on the values of the variables, the player will see from one to six links after the passage text.

The problem arises when the passage displays less than all six links. For each link that is not displayed (because that <<if>> statement's variable is not true) there is an extraneous blank line.

I can't simply wrap the whole thing in <<nobr>> or put all the <<if>> statements on one line because then my list of choices would no longer be a list, it would be a paragraph.

Is there any way around this? Maybe a different story format that still cascades text down the page? CSS? HTML?

Comments

  • Try this, noting I force a <br> at the end of each line.
    <<nobr>>
    <<If $A>>[[Choice A.]]<<endif>><br>
    <<If $B>>[[Choice B.]]<<endif>><br>
    <<If $C>>[[Choice C.]]<<endif>><br>
    <<If $D>>[[Choice D.]]<<endif>><br>
    <<If $E>>[[Choice E.]]<<endif>><br>
    <<If $F>>[[Choice F.]]<<endif>><br>
    <<endnobr>>
  • Holy moly! You can put <br> inside <<nobr>>!? I've got some code tidying to do...
  • <<nobr>> prevents newlines in the input from being converted to <br> when a passage is shown, but if you put the <br> there yourself it remains. However, if you want to prevent empty lines for absent choices, you should put the <br> inside the <<if>>.
  • Sweeeeeeet! Thank you both! Very logical/easy to remember. :)
  • Don't forget that you can tag passages with the nobr tag, which acts like you've wrapped the entire passage in a <<nobr>> macro.
  • Didn't realise that about tagging the passage, great tip!
  • mth wrote:
    However, if you want to prevent empty lines for absent choices, you should put the <br> inside the <<if>>.


    Oops! That's right. I knew something didn't look right. Should'a tested.

    TheMadExile wrote:

    Don't forget that you can tag passages with the nobr tag, which acts like you've wrapped the entire passage in a <<nobr>> macro.


    BRAIN ESPLODE
  • This is pretty cool info indeed. I will definitely be using this, good stuff.
Sign In or Register to comment.