Array variables and indexing in storyline
Aug 10, 2012
New to storyline and trying to figure out how to make it work for me, I am trying to create a timed quiz that gives the learner randomized tasks in an animated setting (think tetris with tasks instead of blocks falling, and the user has to solve each of them before they hit the bottom). I solved the timing and the animation, but the variables needed to display the different tasks and record the reactions multiply with each additional scenario (task & possible solutions), along with the triggers needed to handle it all. This would be so much simpler to do with indexed array-type variables, i.e.,
variable(n) instead of
variable1, variable2, variable3...
(I have about ten connected variables that I need somewhere between 20 and 100 instances of; programming all that by multiplying variables and triggers is going to be tedious and a nightmare to debug and maintain...)
I found elsewhere in this forum that the JavaScript integration is not useable in this context, but maybe I got that wrong.
Any help would be greatly appreciated, and of course I apologize if I've overlooked something that's already out there.
7 Replies
That's a brain twister. It's certainly possible to use the channel between Storyline's player and JavaScript to do some really cool things. During the beta one of the Articulate developers built a board game (Othello I think) that leveraged communication between JavaScript and Storyline. Very clever work.
I think it's possible to have some semi-randomness added to elements that appear on screen from an external configuration. For example, if you wanted to feed in your challenges via XML file, it's possible to do that.
It all depends on the mechanics you want to see. Can you describe a little bit more about what the participant would see, do, and the type of feedback they'd receive?
Thanks for your response, Steve. Actually I used your proposed solution from elsewhere to create the counter that makes my challenge tick...
I've gotten the javascript random number generator
to work thanks to a suggestions from another thread (here, found it there, too, thanks Colin and Adrian). Had to move my testing from preview and local viewing to a web server. Phew. OK.
Now, to the rest of the JS stuff...
For the time being I'm aiming at
The number of triggers has already grown (three test challenges) to a level that is difficult to maintain, so I'm really looking for a JS solution to the whole thing, otherwise I have to finish this in one session in order not to lose concentration, and then never look back, which obviously is not the cleverest thing to do.
So, approaching this from a maximum-JS perspective, I wonder whether a JS could run in the background so that variables I use there are persistent, or whether I have to pass all info back and forth every time I launch the script and have to let the script parse the "what happened so far" input every time it launches.
In the "train" mode the user would get feedback on their choice and could then either confirm their choice or go back to choose again. This should be comparably simple to add on to the challenge mode once I've got that running.
The whole thing is somewhat daunting as I haven't done any JS programming since JS first came out in the nineties...but it's exhilarating at the same time...
Looking forward to more insight and discussion!
Thanks again, Steve!
Hi Kai,
Really cool idea. I threw something together that I think might help. You can see the published output at the address below:
http://articulate.gerry.s3.amazonaws.com/falling/output/story.html
To accomplish this, I used a lot of javascript actions, variable triggers, states, and variable text references. The questions are defined in falling.js and displayed in flash using variable references. I did have to make one change to the published output to make this work. I had to copy the file falling.js to the story_content folder and modify story.html adding a reference to this file immediately before the reference to user.js. Below are links to the project file and the zipped output.
http://articulate.gerry.s3.amazonaws.com/falling/falling_output.zip
http://articulate.gerry.s3.amazonaws.com/falling/falling_src.zip
Best Regards,
Gerry
I stand in awe.
...looking through the stuff now to try and get my head around it. Then I'll try to modify it.
Thanks a lot!
This has probably saved me about two or three days worth of work.
Or a month
Now...I think I got my thick head around how it works. Found that it doesn't finish cleanly, though. When you run out of questions it seems to repeat the last question once before stopping.
I made a few changes to fix it, although I'm not completely sure why especially the first fix was necessary:
(see attached modified version of the JS; I've commented out most of the questions for easier testing, the actual number of questions has no effect it seems)
@Gerry: any thoughts?
Further I'd be extremely interested whether we might not get the question data from an XML file instead of handling it in the JS, so that translation might be easier. Anyone?
Looks great Kai. It looks like the first fix was required since you moved the location of the call to NextQuestion after the comparison. The method NextQuestion increments g_nCurrentQuestion so moving NextQuestion after the condition means the value of g_nCurrentQuestion will always be one less during the comparison.
So...tweaked things a bit and it looks like it's doing what I need it to do now...
I've
- randomized the questions
- added scoring instead of simple pass/fail
There is some more stuff happening behind the scenes I may build on later. Detailed feedback is not implemented yet.
I've attached the sources and the output.zip of my latest version. Happy about any feedback!
@Gerry: when I ran your original (shoulders of giants, thanks again!) to the very end and selected the correct answer for the last question, there was the side effect that I tried to fix in my previous post.
Next stop: import of data from xml or json. Any takers?
This discussion is closed. You can start a new discussion or contact Articulate Support.