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

Sugarcube - Passage Link that just changes variable

$
0
0
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 [[Buy the Table|<<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.

Viewing all articles
Browse latest Browse all 1844

Trending Articles