Random word generator

Jul 06, 2015

We're wanting to use a method to ensure that our students complete all three activities by rewarding students with 3 randomly generated words that combined will let the teacher know that they completed all of the activities. In other words:

Activity 1 - The student gets a randomly password from a bank of 5 (Probably using a JavaScript array) for that activity. The same would happen for activities 2 and 3.

Activity 4 - The student inserts the passcodes from the 3 previous activities and if they are correct (This storyline would check to see if they match to any 5 of the bank) if all 3 are correct they can let the teacher know that they have completed all the activities.  

Is this possible to do in JavaScript? If so what would the code look like? Or is there away to do this using variables in Storyline already?

9 Replies
Diane Fung

Yes I'm testing locally. I'm using the story_html5.html to do my testing. Here's the code I'm using:

 

var selectFruit = ["Apple", "Orange", "Banana", "Cherry"];
var pickAFruit = function () {
var todaysFruit = selectFruit[Math.floor(Math.random() * 4)];
player.SetVar("random", todaysFruit;)
};

 

I'm by no means a Javascript expert but I found examples of what I'm looking for using just JavaScript alone. I think what I'm having problems with is to actually get the variable to actually display in a textbox when I reference the variable the Javascript creates.  

This discussion is closed. You can start a new discussion or contact Articulate Support.