@thetaw
One issue with your example is that the temporary _i variable referenced within the (link:) macro's assocated hook isn't evaluated until the end-users selects that link, and at that time the temporary _i won't exist. The following example demostrates this issue.
debug item value: |debug>[]
{
(set: $list to (a: "one", "two", "three"))
(for: each _item, ...$list)[
<br>
(link: _item)[
(replace: ?debug)[_item]
]
]
}
Harlowe doesn't have an equivelent of the SugarCube <<capture>> macro, so you need to use the (print:) macro to dynamically build the link and it's associated hook.
debug item value: |debug>[]
{
(set: $list to (a: "one", "two", "three"))
(for: each _item, ...$list)[
<br>
(print: "(link: _item)[(replace: ?debug)[ " + _item + "]]")
]
}
So the (link:) within your (for:) macro example would need to look more like the following...
(print: "(link: _i's name)[(set: $hero's clothes to " + _i + ")])")
... however if the _i variable is referencing a complex object (like a data-map) then the above technique will NOT work, because such objects don't convert to the String data-type well.