Bulleted list in array?

If you are requesting technical assistance with Twine, please specify:
Twine Version: 2.3.15
Story Format: Harlowe 3.2.3.

Hey everyone,
Total noob here, teaching myself as I go. I just figured out a way to keep an inventory, but I’d really like it to print as a bulleted list. I know this involves * and a space before each item, but I can’t seem to get it to work. My second item keeps coming up italicized, and the asterisks just show up in the text in the rest of the items. This creates a bullet at the beginning of the list, but how can I bullet each item?? My apologies if this is super basic.

(set: $inventory to (array: "* questions", " secrets", " thirst"))

Hmm…try this:

(set: _inventory to (array: "questions", "secrets", "thirst"))
(print: "* " + (joined: "\n* ", ..._inventory))

\n is a “newline”, (joined:) puts the first thing (new line, asterisk, space) between each two of the rest of its arguments. The “spread” operator ... spreads out the array values and passes them individually.

And then we add an asterisk and a space before the first one, and print the whole thing.

Thanks for the reply, and for taking the time to teach me.
I can’t get it to work, though… Should I be changing something or should I just be able to paste it in? Not sure what I’m doing wrong.

I figured it out - I was just putting it in the wrong place. I’m really new at this…
Thank you so much for your help!

Long time ago, someone once try to build a more nice looking UI for inventory in harlowe:

I have see this, so I pasted it if you are interested it:

say, if your inventory has a structure like this : ( dm: “item names”, numbers)


(set:$inv to (dm:
'paper', 1,
'handgun',3,
'herbs', 1,

) )

Then you store description, and price for those items in another datamap like this :

 (set:$iteminfo to (dm:))
(set:$iteminfo's 'paper' to (dm:
'cost',1,
'description','just a paper',
))

(set:$iteminfo's 'handgun' to (dm:
'cost',100,
'description','a string weapon',
))

(set:$iteminfo's 'herbs' to (dm:
'cost',10,
'description','a common vegetation',
))


Then the most fun part:

you can use a css to make it looks better:

<style>
table {
  border-collapse: collapse;
  width: 100%;
}

 .color {
    color: red
  }

th, td {
  padding: 8px;
  text-align: left;
  border: 1px solid #ddd;
}
tr:hover {background-color:#DC143C;}
</style>
</head>
<body>

Finally you build a chart to your inventory:

(set: $list to (datanames: $inv))

(set:$listhead to (a:'item name','number','cost','description'))
[
<!-- chart head-->

(set: $dummy to "<table>")
(set: $dummy to it + "<tr>")
(for: each _head, ...$listhead)[
(set: $dummy to it + "<td>")
(set: $dummy to it + _head)
(set: $dummy to it + "</td>")
]
(set: $dummy to it + "</tr>")

<!-- iteme names-->
(for: each _item, ...$list)[
(set: $dummy to it + "<tr><td>")
(set: $dummy to it + _item)
(set: $dummy to it + "</td>")


<!-- numbers-->

(set:$num to $inv's (_item))
(set: $dummy to it + "<td>")
(set: $dummy to it + (str:$num))
(set: $dummy to it + "</td>")



<!-- cost-->
(set:$cost to $iteminfo's (_item)'s 'cost')
(set: $dummy to it + "<td>")
(set: $dummy to it + (str:$cost))
(set: $dummy to it + "</td>")

<!-- description-->
(set:$description to $iteminfo's (_item)'s 'description')
(set: $dummy to it + "<td>")
(set: $dummy to it + $description)
(set: $dummy to it + "</td>")


]

(set: $dummy to it + "</tr>")
(set: $dummy to it + "</table>")
]}

So here it is, you’ve build your inventory system,

you can add a (print:$dummy) to show this charts