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

Harlowe: Referencing a datamap with variables

$
0
0
I'm learning to work with datamaps in Harlowe, and I'm trying to use variables to call up a specific datamap, like this:
(if: "$" + $temp contains $action)[
	(click: "?" + $temp)[
		(replace: ?reaction)[(print: "$" + $temp's $action)]
	]
]

Where $temp shares the name with the datamap I want to pull up, and $action is the same as a name in the datamap.

I know that $action fires correctly, because I can put in the exact name of the datamap ("$city") and everything works.

I know that $temp has the right value ("city"), because in my game, ?city becomes clickable when I use the exact name of the datamap.

However, the code above doesn't work, returning nothing, or (if I put in $city instead of the "$" + $temp):
You can only access position strings/numbers ('4th', 'last', '2ndlast', (2), etc.) and 'length' of the string "city", not the string "go".►

As a further limitation, I can't rename the temp value to $city, because I also need to call upon ?city.

Any help?

Viewing all articles
Browse latest Browse all 1844

Trending Articles