Forum Discussion
Trivia Game - Using Variables and JavaScript to remove answered questions from the deck.
Hi Owen - I tried to use this code and modify it in order to randomly generate a unique number and then show the corresponding slide layer. I theoretically understand creating an array and removing numbers from the array that have been used by setting their value to zero. I just can't make it work. Can you help a gal out? I'm trying to make a "random accolade generator" for my team's Trainer Appreciation Week next week. I can get it to choose random - but not unique yet.
Thank you!
- OwenHolt7 years agoSuper Hero
Sorry for the late response, I've been at a leadership offsite. Any chance you can share your file so I can see what is going on under the hood?
I'm not sure I did a great job of explaining all of the details when I made this post, but there are some critical steps here.To keep it simple, let's assume that in Story line I have 5 variables to store values from 1 to 5 and I want to choose a random number. The array will do this fine, but when I send the value back to SL I also need a trigger to set the selected variables value to 0. If I fail to adjust the variables to 0 as they are selected, they will never be filtered out of my array. In my file, you will see that I perform this on the correct feedback layer for each question when the user presses the button to go back to the main menu. Make sense?