Howdy, Stranger!

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

[harlowe] Creating columns within a passage.

What's the best way to create some columns to better display info and use all the space I have in a passage?

Comments

  • Harlowe's default CSS is setup so that the tw-story and it's child tw-passage areas will horizontally take up the centre 60% of the web-browser's view-port window.

    Where do you wish to make these columns?

    a. within the tw-passage area (the central 60%)
    b.outside the tw-passage area (to the left and/or right of the central 60%)
  • greyelf wrote: »

    I would say inside the passage area. I wanted to make a list of characters on the party, with their hp, mp and class to the right of their names.

    But forget the columns for a moment. What's the best way of doing this list?
  • Your "list of characters" question is missing a number of details like: what data structures and variables are you using to define a character and a party? what do you want the list to look like?

    There are many ways to do what you want, the following is one of them. It consists of two passages:

    1. Setup the data structures and variables, ideally this is done in your story's startup tagged passage.
    (set: $people to (datamap:
    	"Yasu", (datamap: "Name", "Yasu", "HP", 100, "MP", 100, "Class", "Mage"),
    	"Imani", (datamap: "Name", "Imani", "HP", 100, "MP", 100, "Class", "Fighter"),
    	"Gili", (datamap: "Name", "Gili", "HP", 100, "MP", 100, "Class", "Rogue"),
    	"Nitzan", (datamap: "Name", "Nitzan", "HP", 100, "MP", 100, "Class", "Cleric"),
    	"Nerd", (datamap: "Name", "Nerd", "HP", 100, "MP", 100, "Class", "Nerd")))
    
    (set: $party to (array: "Imani", "Gili", "Nitzan", "Yasu"))
    
    2. The Show Party passage, it uses a (live:) macro to simulate a for-loop.
    Party:
    |party>[]{
    
    (set: $counter to 0)
    (if: $counter < $party's length)[
    	(live: 50ms)[
    		(set: $counter to it + 1)
    		(set: $member to $people's ($party's ($counter)))
    		(append: ?party)[(print: "`(`" + (text: $member's HP) + ":" + (text: $member's MP) + "`)` " + $member's Class + " " + $member's Name + "<br>")]
    		(if: $counter >= $party's length)[
    			(stop:)
    			(set: $counter to 0)
    			(set: $member to 0)
    		]
    	]
    ]
    }
    
Sign In or Register to comment.