Forum Discussion

jeffTaylor2's avatar
jeffTaylor2
Community Member
4 years ago

Conversion from Captivate to Storyline 360

I'm converting a Captivate course over to Storyline 360, and there is an area that requires me to have one slide randomly appear out of a set of 12 slides.  In Captivate, this was done with JavaScript, as seen below.  I need to find the alternate set of commands for Storyline 360.   The set of commands for Captivate to take action is believed to be "cpAPIInterface.setVariableValue"  and the command "cpCmndGotoSlide"  I also need to know if there is any other information I am missing to make this work in Storyline 360.

There are obviously 

function getRandomInt(min, max) {
var jsRandomNumber = Math.floor(Math.random() * (max - min + 1)) + min;

if(jsRandomNumber==1){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 26);
} else if (jsRandomNumber==2){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 27);
} else if (jsRandomNumber==3){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 28);
} else if (jsRandomNumber==4){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 29);
} else if (jsRandomNumber==5){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 30);
} else if (jsRandomNumber==6){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 31);
} else if (jsRandomNumber==7){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 32);
} else if (jsRandomNumber==8){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 33);
} else if (jsRandomNumber==9){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 34);
} else if (jsRandomNumber==10){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 35);
} else if (jsRandomNumber==11){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 36);
} else if (jsRandomNumber==12){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 37);
} else if (jsRandomNumber==13){
window.cpAPIInterface.setVariableValue('cpCmndGotoSlide', 38);
}
}

getRandomInt(1, 12);

Any help would be greatly appreciated.

  • I wonder whether there's any mileage in having a question bank linked to each of the tiles (8 question banks). You could put whatever you want on to the slides, no need to have a question, but simply use the random draw to serve up a different slide each time. 

    It's certainly possible to do it without JavaScript using Storyline triggers too, but it's quite a complex piece to build. The general jist would be:

    • Create a scene for each tile/category and add relevant slides to each scene
    • Click a tile on the main screen that generates a random number 
    • Depending on the random number generated, jump to slide XYZ. For example, click tile 1 > random number generated = 1 > jump to scene 1, slide 1

    Hopefully this gives some idea of how to solve the problem.

  • Hi Jeffery, 

    What's the context of having the slides appear at random? Just trying to understand the problem to help form the solution.

  • jeffTaylor2's avatar
    jeffTaylor2
    Community Member

    The context is to provide the (user/facilitator) with the experience of selecting a (Resource card object) shown in the below attachment. 

    1.  A random card would appear from a pool of (13 cards/slides)
    2. The participant would read through the Card
    3.  Return to the home screen via object selection. 
    4. The next participant could do the same thing and get a completely different card. 

    This was achieved in Captivate using the JavaScript provided.  If there is a way to achieve this without JS in SL360 I am open to it.  the 

    The objective is to provide the ability to click the same object and the resulting action be that the participant would see a different card/slide each time the object is selected.