Imagine you're programming a store. You have a passage named
Store and maybe five items for the player to choose from to buy.
So you have options to buy
Lamp or
Table or
Microwave but you have to create a passage for each item you buy, when really all you need to do is <<set $itemBought to "Table">>. And you don't need to have the "You've bought the BLANK" in multiple passages, so the literal buying passage would just be
<<set $itemBought to "Table">>
<<goto YouHavePurchasedSomething>>
Now, two lines of good doesn't need a passage, and if your store has a lot more than just five items, making a passage for every single one is beyond tedious. Is there a possible way that when you have a multiple links for
Buy the BLANK, clicking it just changes a variable?
I would imagine it to be something like
<<set $itembought to "Table">>, but all that does is create a passage titled <<set $itemBought to "Table">>, and I don't know where the passage destination would fit into that. A different macro might be needed.
Any help is greatly appreciated.
Comments
If you read the documentation related to links (v2.x or v1.x) you will see two link types listed as Link w/ Setter and Link w/ Text & Setter, both of which do exactly what your are asking for.
Thank you very much, I didn't know such a resource was available. This will greatly help my stories.
However, it does leave a "broken link warning" over the passage this macro is put into. Is there a way to amend that?
There are some hacky tricks to try and get around this issue but the simple answer is no.
The full setup would look something like: