I'm using datamaps to track the player's state, and it would be really nice if I could make the appearance of certain links depend on specific stats being set to specific values. As an experiment, I made a really quick prototype container and link:
{(set: $player to (datamap:
"Name", "Bob",
"strength", 10,
"dexterity", 8,
"wisdom",3,
))}
(if: $player's strength < 5)[[You can barely move the boulder]]
(else:)[[You casually toss the gigantic rock over your shoulder and move on]]
This obviously generates an error- the if macro says "the command should be assigned to a variable or attached to a hook," but I thought I'd done both; $player's strength is a valid variable, and there are no spaces or anything between the macro and the hook. Am I making an obvious syntax gaffe, or are links not intended to be combined with the if: macro?
Comments
Hopefully someone more familiar with harlowe can help you. If not I'll load it up and play around with it and see if I can help.
Edit: If you need a link after the if, try the (link-goto) macro.
The only drawback is that the editor doesn't seem to parse it correctly, so you'll end up getting a new passage generated, but deleting that and ignoring the error indication results in something that works as intended.
An (if:) macro with it's associated hook looks like the following: ... and a markup based link where the Link Text and the Target Passage Name are the same looks like:
So you when you combine them together you need three open square brackets and three closed square brackets, but due to an error in the Auto Create Missing Passage feature of the Twine 2 application's editor you can't have three open square brackets in a row so you need to add a space between the first and second open square bracket like so: