0 votes
by (130 points)
edited by
Here is my Start code.

(set: $Inv to (datamap: "pet", false, "box", false, "figure", false, "necklace", false, "wrench", false))

When items are picked up I set them to true.

Thank you!

1 Answer

+1 vote
by (159k points)

Please use the Question Tags to state the name and full version number of the Story Format (and/or the Twine Compiler) you are using, instead of including that information within your question.

You can use the (datanames: ) macro to obtain the name of each item contained within your $Inv data-map, and then use the (find:) macro to create an array containing the names of the items that currently equal true.

(set: $Inv to (datamap: "pet", false, "box", true, "figure", false, "necklace", true, "wrench", false))

(set: _have to (find: _item where ($Inv's (_item)), ...(datanames: $Inv)))

You are Carring: _have


If you want the output of the above _have variable to look slightly better then you could also use the Java-script <Array>.join() function to generate the coma separated list like so.

You are Carring: (print: _have.join(", "))

 

by (130 points)
edited by
So awesome here and in the Discord channel!!! Thank you @greyelf.
This site has been placed in read-only mode. Please use the Interactive Fiction Community Forum instead.
...