I'm not sure if anyone has done this before - I've seen a number of requests for a random number generator. So I've thrown this together - give it a whirl.... Story is attached.
I was tyrying to get a random number generator from SL but in the end ran a Java script to get it to work, I will have a look at this as it would be ipad friendly.
Thanks
Lance
PS I have another problem with the same module but will post in a new post.
Jeannette, you screenr on question banks and random branching was the inspiration for this - it just took about 30 minutes to throw together once I realized it was possible. The question banks were made once, then copied, and the variables changed. You could continue this process for as many digits as you need...
I have spent the last few days dissmantling your project to understand it, of which I thought I did. I have created a sample cut down using your and Jeanettes technique but for the life of me cannot get it to work.
I am trying to get the project to draw a random number which I can use in a menu slide. Like yours Lance I need to return to the start and generate a new random number each time the process finishes.
I have two problems,
1) When I set the question bank to set the var "Rand" and jump to the next slide on the start of the time line, the number is always 0 (in this sample)
2) If I change the settings on the question bank to jump to the next slide at the end of the time line, it will generate a random number but then when I return to the begining it keeps selecting the same number.
Would you mind having a look to see what I am doing wrong?
In the number bank, somehow you had the advancing set up as a player trigger, rather than a slide trigger. This may have affected the trigger order. I set up both the triggers as slide triggers, and ensured that the variable assignment is first. I also changed the trigger at the end of the slides, to "restart course". Story is attached.
Yes I now see the difference between a slide and player trigger.
I think the last problem now is that to get it to continue to genrate random numbers is to make it restart the course. I am assuming that means all variables and results are lost. I think this would mean you can only use the random generator once in the course.
I have a Menu (pseudo card game) which is currently using Java to generate a random number 0~9 and launches a scene depending on the results of the number generated. There are 5 scenes and you must visit all 5 scenes prior to completion, I would love to deploy this to ipad but Java inhibits this. Of course I can get around it byu using a conventional menu but that takes the fun out of it.
This is really cool. I'm trying to take this concept and make it a word scramble. So instead of a random number appearing on click, can the value be changed to "text" instead of "number"? I can't seem to change it.
I think for your application using a random number generator in Java maybe simpler, then allocate the returned number to a letter using an SL if statement such as if VarNum=1 then SomeotherVar=a and so on.Of course constrain your random number to 26.
For more than one leter then you could use a counter variable to itterate the random number generator and increment the variables.
var number=Math.floor(Math.random()*25); GetPlayer().SetVar("RandNum",number);
This will generate a number between 0 and 25 if yo want another number then change the *265 to what you need.
I do not have SL on my home PC so cannot place it in a story line as yet I will have a look at one when I get into the office.
Use a button press to execute the java code.
Ensure you have created a variable called "RandNum"
If you need further numbers in SL you can then use a counter variable to fill in what you need also you can use a if var =0 to generate numbers where needed.
As for creating random letters, words, anything you just make a table that if VarNum = x then SomeVar = y
Lance thanks for this post. I've just started playing with storyline and the variable options, and this has helped me out
What I wonder now is if I can somehow take two random numbers and perform a mathematical operation on them and have it calculate the correct answer, or if this would be something that would be cleaner using javascript.
Thanks for the JavaScript Colin, I just used it in a new project and it works like magic.
Colin Harm said:
Sorry for the delay in replying;
Yes the code is
var number=Math.floor(Math.random()*25); GetPlayer().SetVar("RandNum",number);
This will generate a number between 0 and 25 if yo want another number then change the *265 to what you need.
I do not have SL on my home PC so cannot place it in a story line as yet I will have a look at one when I get into the office.
Use a button press to execute the java code.
Ensure you have created a variable called "RandNum"
If you need further numbers in SL you can then use a counter variable to fill in what you need also you can use a if var =0 to generate numbers where needed.
As for creating random letters, words, anything you just make a table that if VarNum = x then SomeVar = y
I'm looking for a similar concept but instead of numbers, I'm wanting to use colors and have the colors randomly generated so the learner will progress around a board game. I found a discussion about creating a spinner (using Articulate Presenter with the spin animation and a hyperlink to the ending color), etc, but I would have to specify the color the spinner would land on.
I'm using Storyline AND I would prefer to have the colors randomized. I thought I'd have a spin button for the trigger. When the learner lands on the color, he gets a question he must answer in order to proceed, so using the model here, would I have to have two question banks? There's a total of 80 circles (20 of each color). Each color represents a type of math problem (i.e. a different learning objective).
I haven't used the question bank feature in Storyline yet, so I'm a little confused by how to set up the generator. Will be going to the tutorials next.
In the number bank, somehow you had the advancing set up as a player trigger, rather than a slide trigger. This may have affected the trigger order. I set up both the triggers as slide triggers, and ensured that the variable assignment is first. I also changed the trigger at the end of the slides, to "restart course". Story is attached.
I just created the same file its working fine, but is there any way doing this differently because I dont want to restart my story everytime
I'm not sure I understand what you're looking to do - but if you'd like to connect with Lance G. directly you may want to PM him, as he may not be subscribed to the thread.
49 Replies
Maybe this has been done before so its old news?????
That's really clever, Lance! What a cool way to use a question bank!
I was tyrying to get a random number generator from SL but in the end ran a Java script to get it to work, I will have a look at this as it would be ipad friendly.
Thanks
Lance
PS I have another problem with the same module but will post in a new post.
Jeannette, you screenr on question banks and random branching was the inspiration for this - it just took about 30 minutes to throw together once I realized it was possible. The question banks were made once, then copied, and the variables changed. You could continue this process for as many digits as you need...
I {♥} question banks!
HI Lance
I have spent the last few days dissmantling your project to understand it, of which I thought I did. I have created a sample cut down using your and Jeanettes technique but for the life of me cannot get it to work.
I am trying to get the project to draw a random number which I can use in a menu slide. Like yours Lance I need to return to the start and generate a new random number each time the process finishes.
I have two problems,
1) When I set the question bank to set the var "Rand" and jump to the next slide on the start of the time line, the number is always 0 (in this sample)
2) If I change the settings on the question bank to jump to the next slide at the end of the time line, it will generate a random number but then when I return to the begining it keeps selecting the same number.
Would you mind having a look to see what I am doing wrong?
Kind Regards
Colin
Hi Colin,
I made a few changes to your story.
In the number bank, somehow you had the advancing set up as a player trigger, rather than a slide trigger. This may have affected the trigger order. I set up both the triggers as slide triggers, and ensured that the variable assignment is first. I also changed the trigger at the end of the slides, to "restart course". Story is attached.
Thanks for your time Lance.
Yes I now see the difference between a slide and player trigger.
I think the last problem now is that to get it to continue to genrate random numbers is to make it restart the course. I am assuming that means all variables and results are lost. I think this would mean you can only use the random generator once in the course.
I have a Menu (pseudo card game) which is currently using Java to generate a random number 0~9 and launches a scene depending on the results of the number generated. There are 5 scenes and you must visit all 5 scenes prior to completion, I would love to deploy this to ipad but Java inhibits this. Of course I can get around it byu using a conventional menu but that takes the fun out of it.
This is really cool. I'm trying to take this concept and make it a word scramble. So instead of a random number appearing on click, can the value be changed to "text" instead of "number"? I can't seem to change it.
I think for your application using a random number generator in Java maybe simpler, then allocate the returned number to a letter using an SL if statement such as if VarNum=1 then SomeotherVar=a and so on.Of course constrain your random number to 26.
For more than one leter then you could use a counter variable to itterate the random number generator and increment the variables.
i don't suppose you have a sample that i could study the code on that? Thanks so much for your immediate reply.
Lance this is an excellent thread; learnt a lot from your .story.
Colin
Are you able to share the java code and how you would use it?
Regards
JIlo
Hi Jilo,
here's a link to w3schools. I've made the link point to the random generator
Geert
Sorry for the delay in replying;
Yes the code is
var number=Math.floor(Math.random()*25);
GetPlayer().SetVar("RandNum",number);
This will generate a number between 0 and 25 if yo want another number then change the *265 to what you need.
I do not have SL on my home PC so cannot place it in a story line as yet I will have a look at one when I get into the office.
Use a button press to execute the java code.
Ensure you have created a variable called "RandNum"
If you need further numbers in SL you can then use a counter variable to fill in what you need also you can use a if var =0 to generate numbers where needed.
As for creating random letters, words, anything you just make a table that if VarNum = x then SomeVar = y
Hope this helps
sorry, too early in the morning for rational typing
*265 should read *25
Lance thanks for this post. I've just started playing with storyline and the variable options, and this has helped me out
What I wonder now is if I can somehow take two random numbers and perform a mathematical operation on them and have it calculate the correct answer, or if this would be something that would be cleaner using javascript.
Thanks for the help,
Thx for your .story Lance. I've used it in combination with my flashcards and 'calculator' lesson about Math. Http:/www.educhunks.nl/optellen
Thanks for the JavaScript Colin, I just used it in a new project and it works like magic.
I'm looking for a similar concept but instead of numbers, I'm wanting to use colors and have the colors randomly generated so the learner will progress around a board game. I found a discussion about creating a spinner (using Articulate Presenter with the spin animation and a hyperlink to the ending color), etc, but I would have to specify the color the spinner would land on.
I'm using Storyline AND I would prefer to have the colors randomized. I thought I'd have a spin button for the trigger. When the learner lands on the color, he gets a question he must answer in order to proceed, so using the model here, would I have to have two question banks? There's a total of 80 circles (20 of each color). Each color represents a type of math problem (i.e. a different learning objective).
I haven't used the question bank feature in Storyline yet, so I'm a little confused by how to set up the generator. Will be going to the tutorials next.
Hi Gayle,
You may want to PM Paul, as I'm not sure he's subscribed to the thread.
I just created the same file its working fine, but is there any way doing this differently because I dont want to restart my story everytime
Hi Parashuram,
I'm not sure I understand what you're looking to do - but if you'd like to connect with Lance G. directly you may want to PM him, as he may not be subscribed to the thread.
Thanks Ashley,
I'll text him.
Sounds good Parashuram. Let us know if you need anything else.
This discussion is closed. You can start a new discussion or contact Articulate Support.