Twine Version: Harlowe 2.3.14
I’m pretty new to Twine, and I’m trying to figure out how to create a loop for that gives the player a number of prizes based on their overall score. Let’s say the player gets 5 prizes.
Each time the loop runs, a random number from 1 to 20 is generated. If the value is below 10, the player gets a cookie. If the value is above 10, the player gets a doughnut. If the value is 10 exactly, the player gets a cake. The loop count then increases by one, and the loop runs again until the count reaches the number of wins (5, in this case.)
At the end of the loop, I want to return to the story and give the result in a summary statement:
You earned $cookie cookies, $doughnut doughnuts, and $cake cakes!
I’ve tried writing this a number of ways, but I keep getting the same basic problem – I can’t figure out how to write a loop that runs, increments, and then tests the count to decide if it should exit and return. Any help with this would be most appreciated.