Spin the Wheel
Sep 04, 2019
Hello,
I am creating a quiz game using Articulate Storyline. I am facing a small challenge.
I have created 5 questions with a wheel design using triggers. The wheel spins and stops on a random number, then it jumps to the allocated question.
On the second spin, the same number might be repeated (Although, I added a trigger for each question) . For example: If the wheel stops on 2, the leaner answers Q2. This question must be marked as done and the wheel must NOT stop on 2 anymore. Is this a Javascript condition? Can anyone help me with it? I have attached the triggers used.
9 Replies
Elisa, just wondering, will your students/users be taking the quiz more than once? If not, then it may be easier to skip the random number piece of this and just "fake" randomize it by having the spinning wheel stop at the same stops every time....
If they *will* be taking the quiz more than once then it may be worth the effort to make this work.
I'll have to noodle on it over night, but off the top of my head I think you will need 5 T/F variables, default of False, that you'll set to true when a number is spun. So if your wheel variable equals 4 then set Q4 variable to True.
The next trick will be to assign a value of 1-5 to the wheel variable based on the values of these T/F variables.
......... to be continued, unless someone figures this out.....
Hi Brian,
Thank you for your reply, No they will not repeat the quiz, but they will move on and answer another 5 questions and keep and at the end they will answer 10 questions.
I did create 5 T/F variables, default False ...
Elisa, while the random number generator would be very cool to figure out and use, I think it's overkill in this instance if learners/users will not be repeating the quiz.
If they're going to complete this interaction once and never see it again, I'd go with a far more simple approach:
You give the appearance of random spinning but are controlling the outcome, which is much more simple to design than a random number spin.
If your learners will go through this interaction once and never see it again they will have no idea that the spinner isn't landing on a random number.
Hope this helps,
B
Hi Brian,
Sorry for the late reply.
This is what I did. However, I thought I can solve it using a trigger bc while transition you see a small glitch. But it is working correctly.
Thank you.
Elisa
Good to hear! Glad you got it working Elisa
FYI
Should you need to generate a non-repeating random number from a range...
WHAT YOU NEED:
A variable to store a single text array formatted like this: 1,2,3,4,5,6,7,8,9,10,11.... through your top number. Separate values with a comma only; NOT a comma + space. In my example, the variable is named Text_Array and goes from 1 to 100.
A variable to receive your Random Number. This can be either a text or numeric variable depending on what you want to do with it. In my example, it is a text variable named Random. My example doesn't do anything other than display the random number chosen, but obviously you would want to evaluate the value and then do something based on it like go to layer, play media, jump to slide, etc.
A variable to track how many items are left in your list. You will use this to track when you have used all of the numbers to do something different.
Something to trigger your JavaScript. I'm using a button. Here is the JavaScript code commented out so you can see what it is doing:
//get the StoryLine player
var player=GetPlayer();
//get Storyline variable value as a string
var textArray=player.GetVar("Text_Array");
//Convert string to a numeric array
numArray=textArray.split(",").map(Number);
//Get a random number from the array and send it to StoryLine
var randNum = numArray[Math.floor(Math.random() * numArray.length)];
player.SetVar("Random",randNum);
//Remove the random number from your array and get the array's length
numArray.splice(numArray.indexOf(randNum), 1);
var itemsLeft=numArray.length;
//Convert array to a string and send it back to SL along with the array's length
textArray=numArray.map(String).toString();
player.SetVar("Items_Left", itemsLeft);
player.SetVar("Text_Array", textArray);
See it in action here.
Thank you Owen
I will try it :)
Owen, thank you for sharing this... Definitely going into my bookmarks
👍
This discussion is closed. You can start a new discussion or contact Articulate Support.