+1 vote
by (270 points)

Hi guys, I'm trying to create a blacksmith system... I figured I'd do it all in one passage using "link-reveal"...but apparently link-reveal doesn't work with if-statements... any suggestions how to go about it?

 

"Aye, what can I do ye for?"


(link-reveal: "Weapon+2 - 40 gold pieces")[(if: $gold>29)[
Here ye go! (set: $Weapon+2)
](else: )[You don't have enough money for that]

 

 

1 Answer

0 votes
by (159k points)

There are two syntax errors in your example:

1. You are missing the end square bracket of the (link-reveal:) macro's associated hook.

2. Your (set:) macro is missing the reference to the variable who's value you want to add 2 too.
You could use either the actual variable's name or the it keyword if the variable is the same one as you are assigning the result to.

The following is a corrected version of your example.

(link-reveal: "Weapon+2 - 40 gold pieces")[
	(if: $gold > 29)[Here ye go! (set: $Weapon to it + 2)]\
	(else:)[You don't have enough money for that]\
]

note: I also added some line-breaks and Escaped line break markup to make the code a little more readable.

...