Please use the Preformatted text option (in the comment field’s toolbar) when including a code example in your comment, as it stops the forum’s software from converting standard single & double standard quotes (' and "
)into invalid Curly Typographical equivalents (’ and ").
You don’t include an example of the contents of your $cyclopinv
Array, so I assumed it is something like the following in the test project I create…
(likely each of your Data-Map instances have more properties that just “name”)
(set: $cyclopinv to (a: (dm: "name", "aaaa"), (dm: "name", "bbbb"), (dm: "name", "cccc")))
I tested the following code and it worked successful…
(set: $cyclop to (dm: "name", "zzzz", "strength", 10, "intelligence", 11, "dexterity", 12, "magic", 13))
(set: $cyclophealth to 14, $cyclopcarry to 15)
(set: $cyclopinv to (a: (dm: "name", "aaaa"), (dm: "name", "bbbb"), (dm: "name", "cccc")))
(print: $cyclop's "name"): Str (print: $cyclop's "strength"), Int (print: $cyclop's "intelligence"), \
Dex (print: $cyclop's "dexterity"), Mag (print: $cyclop's "magic"), Hp (print: $cyclophealth)
Items: (for: each _item, ...$cyclopinv)[{
(link: "(print: _item's name)")[
(set: $selecteditem to _item)
(goto: "Item Description")
]
}]( (remaining strength (print: $cyclopcarry))
(link-goto: "Return", (history:)'s last)
warning: Whenever the contents of either an Array or a Data-Map is updated the (set:) macro clones the original collection object and then updates the new clone, this process breaks object referential integrity. Which is a fancy way of saying if two variables were referencing the same object before the update the update then those two variables will be referencing different objects after that update. The following to test case demonstrate the above mentioned behaviour.
Updating the name of the Array element…
(set: $cyclopinv to (a: (dm: "name", "aaaa"), (dm: "name", "bbbb"), (dm: "name", "cccc")))
(set: $selecteditem to $cyclopinv's 2nd)
Original Array: (print: ($cyclopinv's 2nd)'s "name")
Original selected: (print: $selecteditem's "name")
(set: ($cyclopinv's 2nd)'s "name" to "dddd")
Changed Array: (print: ($cyclopinv's 2nd)'s "name")
Unchanged selected: (print: $selecteditem's "name")
Updating the name of the selected item.
(set: $cyclopinv to (a: (dm: "name", "aaaa"), (dm: "name", "bbbb"), (dm: "name", "cccc")))
(set: $selecteditem to $cyclopinv's 2nd)
Original Array: (print: ($cyclopinv's 2nd)'s "name")
Original selected: (print: $selecteditem's "name")
(set: $selecteditem's "name" to "dddd")
Unchanged Array: (print: ($cyclopinv's 2nd)'s "name")
Changed selected: (print: $selecteditem's "name")