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

Possible bug with vars inside array in Harlowe?

$
0
0
I'll show the code first:
(set: $hammer to (datamap:
		"Name", "Hammer",
		"Description", "Yeah, it's a hammer.",
		"slot", "right_hand"
	)
)
(set: $weapons to (array: $hammer,$hammer,$hammer))

(live: 1s)[
Name 1: (if:$weapons.length > 0)[(print: $weapons's 1st's Name)](else:)[I'm empty]
Name 2: (if:$weapons.length > 1)[(print: $weapons's 2nd's Name)](else:)[I'm empty]
Name 3: (if:$weapons.length > 2)[(print: $weapons's 3rd's Name)](else:)[I'm empty]

(link-reveal: "Discard 2nd hammer?")[(set: $weapons to it - (a:$weapons's 2nd))]
]
It creates a $hammer var, and a $weapons with two "hammers" inside. The problem is: if I want to discard only one hammer, with the given link-reveal, it discards all of them.

Wasn't it supposed to only remove the second $hammer from the array instead of removing the var itself and rendering empty other positions?

Thank you.

Viewing all articles
Browse latest Browse all 1844

Trending Articles