0 votes
by (270 points)

Twine 2 , Sugarcube 2.21

Probably a  really simple question.  Now that TME has helped me develop a reasonably useful inventory system I am going back and trying to implement it in an old project and I realize I am not sure of the best way to use the macros I customized lol.

I would like to trigger macros when choices are made

i.e.  something like combining 

 [[Buy the overalls | p2.1][$player.money -=20]] 

and

 <<addToContainer $player.inventory $Overalls>> 

 in one line.

Is there anyway to do this with setter links? or do I have to manually cobble it together using <<link>> and passage tags?

I feel like it's an obvious answer, but I would appreciate the feed back

1 Answer

0 votes
by (63.1k points)
selected by
 
Best answer

You should use <<link>>. I don't know why you would need passage tags. Also, don't put white space in the link markup. I also don't think it's a great idea to have punctuation in your passage names outside of _ and probably -. 

<<link [[Buy the overalls|p2-1]]>>
    <<set $player.money -= 20>>
    <<addToContainer $player.inventory $Overalls>>
<</link>>

 

by (270 points)
Ahh I didn't think it through seemed like using the bracket style links inside a <<link>> , seemed like it might cause a redundancy issue.  Just went and re read the documentation and yep... 2nd to last formatting is exactly what i want. Thanks, should of slept on it.
...