Forum Discussion
Ensuring a Random Number is not Re-picked
Owen - I have a knowledge check dice game with only 6 numbers. Currently I am using the Random number variable, but of course the learner roll 1-5, answer questions 1-5 and have to roll 10 more times to get question #6.
If I use your java - do I take out the random number variable? I am also not clear how, when the array picks a number I plug that number into a text variable (%diceroll%!) so that I can trigger a jump to a slide/question.
Thanks.
Correct, you would not need to use StoryLine's random number if you are using JavaScript.
Once you generate a random number using JS, you send it back to SL using the setvariable code.
In this example -> player.SetVar("Text_Array", textArray);
player.SetVar is the command.
"TextArray" is the name of the StoryLine variable being used.
textArray is the JS variable that has the value you are sending back to StoryLine.