Get links from inventory.join

If you are requesting technical assistance with Twine, please specify:
Twine Version:
Story Format:
Hi there i would like to display a link for every item in the inventroy and then link it to its passage for example rock to passage rock. At the moment i am getting the items without links.
This is my code
/% the Array#join() method combines all array elements into a single string, with each element separated by the argument given %/
<<= $inventory.join(’, ')>>.

Assuming the contents of your Array variable looks something like…

<<set $inventory to ['rock', 'paper', 'scissors']>>

…then you could use the range variation of the <<for>> macro combined with the <<link>> macro like so…

<<for _item range $inventory>>
	<<link _item _item>><</link>>

Thanks got it. My problem now is i want to direct to another passage (depending on the item) when clicking the link. How can i do that? I know if for example is “a rock” it will go to the passage “a rock”, but what if i want to send to a passage called just “rock” instead of going to the “a rock” one. As in the passage “a rock” something else is going on, not the description of the item and the picture i want to show. Thanks again for your time!!!

How about change the passage’s name a little.

so you can go to passage ‘a rock1’

Oh thats perfect!!!. This Inventory is dispalyed in the side bar through story caption and when i click directs me to the inventory passage where i show the array of items as links. This works perfect. But what about if i would like to display a dropdown menu in the side bar with the items so i can click them and go to theirs descriptions. So i will click inventory and then a dropdown menu will show all the items and depending which one i click i could go to “a rock” for example. Thanks!!!