Creating Links based on values in Nested Datamaps and Arrays

Hi,

I’m setting up a fight system in my game. There is the potential for a lot fighting within the premise of the game, so, rather than having a set of passages for each potential fight sequence, I thought it would be better to have a single set of passages that could be accessed from anywhere in the game.
The set of passages will be;

Fight Init - where any fight-specific variables are set and calculations made.
Fight Screen - where the actual fighting will take place.
Spoils - where the user will collect gold, items, etc.
and a link to the Game Over passage.

The actual fighting-part works fine, and the links to the ‘game-over’ and ‘spoils’ passages work fine, and I believe i can use a combination of arrays and datamaps to allow me to change the variables going into the fight. But what i am struggling with is the spoils screen itself.

Each enemy will have a random amount of gold and possibly weapons, armour or items. These will be preset in a datamap within an array, e.g.

(set: $enemy01 to (datamap: "Name", 'A Slaver', "Gold", 10, "Strength", 4, "Item01", $item01, "Item02", 'n/a')) (set: $enemy02 to (datamap: "Name", 'A Raider', "Gold", 20, "Strength", 5, "Item01", $item02, "Item02", 'n/a')) (set: $enemy03 to (datamap: "Name", 'A Soldier', "Gold", 50, "Strength", 6, "Item01", $item01, "Item02", $weapon02)) (set: $enemies to (a: $enemy01, $enemy02, $enemy03))

The items and weapons will also be datamaps, e.g.

(set: $item01 to (datamap: "Name", 'Small Health Potion', "Ability", 'HP + 25', "Qty", 0, "Value", 25)) (set: $item02 to (datamap: "Name", 'Large Health Potion', "Ability", 'HP + 100', "Qty", 0, "Value", 100)) (set: $weapon01 to (datamap: "Damage", 3, "Value", 1, "Name", 'Rusty Dirk', "Qty", 0))

What i want the spoils screen to do is recognise that the enemy is carrying items and display the items with options to ‘take’-(update the user inventory) or ‘leave’. So, if enemy01 was defeated, the spoils screen would show that they were carrying $item01 and would have a link to allow the user to + 1 to the Item01 ‘Qty’ in their inventory.

Any suggestions?