Hello all.
So, I am having a good time with Twine 2. Using the default Harlowe 2.0.1 format.
Here is what I have run up against. I want to make a clickable menu of choices for the player to purchase from a shop. I have a passage where I populate a dm with weapons, in the format "weapon name", "damage" for a bunch of weapons.
While I have no issue putting them onto the screen, all linked up and clickable using a for loop and the (click:) command, I cannot figure out how to read back what the player chose later. Obviously if I try to read back temp variable, it doesn't work as the variable went out of scope long before the player clicked.
It would be fine if I could read back the text of the clicked link, but I don't know how.
Anyway, to make it short: I want to populate a shop with links to buy items, find out what item the player chose, and then move on with that info (deducting gold from their inventory, etc.), and for whatever reason this has me stumped.
Comments
I have managed to figure out so many parts of the system, making an RPG system from scratch fairly quickly. But I still can't figure out how to dynamically populate a list of links and later determine the link clicked. I mean, I *could* simply hardcode the links, avoiding dynamic creation completely, but this will really limit just how many items I would include in the shop.
and after player goes to passage_bought, you can get the bought item's index in vendorItems array with $bought variable, for ex:
You can test the above example by creating a passage named Next and adding the following code to it.
Thanks again!