Forum Discussion
TracyParish
7 years agoSuper Hero
Ensuring a Random Number is not Re-picked
This one might be for the javascript experts in the community, but open to all.
I think someone (and it might have been Owen Holt) posted how you can use javascript to create a random variable and...
ScottWiley1
6 years agoCommunity Member
I just stumbled on this thread and am enjoying the sharing of JS coding ideas. Continuing in the spirit of sharing, I have a couple of prototypes I did a while back that touches on multiple posts here.
They were both done in Storyline 2.
- One deals with a dice rolling mechanism.
- A slider is used to select the number of dice to roll.
- Each of the 5 possible dice variables are randomized to one of 6 numbers.
- The number of each die is added together to come up with the total.
- The other randomized card deck mechanism.
- It deals with shuffling a large array (deck of cards) into random order, splitting individual variables into a new array (hand of cards), and the results are used to show what card was dealt to the hand.
I haven't had much luck posting JS code in the past, so for now at least I'll include the files which have lightbox slides including the basic code used in each case. The rest is based on triggers to set either the die or card to a unique state based on the random variables.
Hope this helps as an idea starter and/or further idea sharing.
- OwenHolt6 years agoSuper Hero
Nice share Scott.