Hello-
TL;DR, I'm trying to append one array to another.
The player has an inventory, saved as $inv. The player is holding a sword and shield. So it looks something like
Some "places" have an "inventory", such as the refrigerator, which is $fridge.
It's easy to move a set item in and out of the fridge:
But since the player can put whatever the hell he wants in the fridge, there's an option to empty the whole thing into his inventory. I thought it would be something like:
... but that overwrites whatever was previously in $inv. What can I do to combine $inv and $fridge?
TL;DR, I'm trying to append one array to another.
The player has an inventory, saved as $inv. The player is holding a sword and shield. So it looks something like
(set: $inv to (a: "sword", "shield")
Some "places" have an "inventory", such as the refrigerator, which is $fridge.
(set: $fridge to (a: "sandwich", "drink")
It's easy to move a set item in and out of the fridge:
(set: $inv to $inv + (a: "drink")) (set: $fridge to $fridge - (a: "drink"))
But since the player can put whatever the hell he wants in the fridge, there's an option to empty the whole thing into his inventory. I thought it would be something like:
(move: $fridge into $inv)
... but that overwrites whatever was previously in $inv. What can I do to combine $inv and $fridge?