It looks like you're new here. If you want to get involved, click one of these buttons!
(set: $knife to (datamap: "Name","Knife", "Description","a simple knife", "equip", false) ) (set: $iknife to "(link-reveal: 'knife')[(set: $myeq to it + (a: $knife))]")
(set: $myeq to (a:))
(set: $myeq to (a: $knife, $otheritem, $etc)
(set: $myeq to (a: $knife), "", $otheritem, $etc, "", "")
Comments
1. Harlowe does not have a looping macro but you can emulate one using either
a. The (live:) macro as shown in this post.
b. Using Subarrays as shown in this topic.
c. Using Javascript as shown in this post.
Although each of those methods come with their own side-effects, like the (live:) macro interfering with the Reader's ability to interact with the screen.
2. Your $myeq array does not actually have empty elements, it has elements that are equal to an empty String literal. So you could use code (either TwineScript or Javascript) to loop through the array until you come to the first empty String literal and replace it.
3. Each time the Reader navigates between Passages all the known variables are copied and that copy is what is made available to the new Passage being shown. This means that the object contained with your $knife variable and the object contained in the knife element of the $myeq array will no longer be the same object, they will now both contain two new objects that have the "same value" as the original object.
This effect can be demonstrated using two passages:
a. First ... the two after change values will be the same.
b.Second ... the two after change values will no longer be the same.
note: There are a number of ways to solve this issue depending on what exactly you want to be able to do with those object references.
datamap:
1, "",
2,"",
etc...