Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

(Harlowe) Combining two arrays?

$
0
0
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
(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?

Viewing all articles
Browse latest Browse all 1844

Trending Articles