Simple Inventory and Blank Lines

Twine Version: 2.8.1

Hi all

I have a simple inventory as a Footer on all passages with each item appearing on a new line, and a variable set to true or false to display them like so:

{=(if: $HasSword is true)[You have a sword]<br>
(if: $HasLantern is true)[You have a lantern to light the way]<br>
(if: $HasSkeletonKey is true)[You have a skeleton key]<br>

If the player has an item, it shows in the list but if not, there’s a blank line because I’m using the br tag

I’ve tried it without the br tag and collapsing whitespace, but that just puts all items on a single line that runs together.

I guess I’m after the best of both worlds where I want all items the player has to appear on one line each but without the blank lines. Is that possible?


You could make it a list:

(if: $HasSword is true)[<li>You have a sword</li>]
(if: $HasLantern is true)[<li>You have a lantern to light the way</li>]<br>
(if: $HasSkeletonKey is true)[<li>You have a skeleton key</li>]<br>

(if you dont like how list looks, you can change it in the CSS :stuck_out_tongue:

The easiest way to change what you already have is to put your line breaks inside the hooks.

{=(if: $HasSword is true)[<br>You have a sword]
(if: $HasLantern is true)[<br>You have a lantern to light the way]
(if: $HasSkeletonKey is true)[<br>You have a skeleton key]
1 Like

Perfect - thanks a lot. :+1: