Economics: Cheaper always has a price

I was driving through our neighborhood recently  with my son on the way back from soccer practice.  It was one of the first really warm days of Spring, so many of the local shopkeepers were busy outside their stores cleaning windows, sweeping sidewalks and putting out colourful chalkboard signs that promised great deals and upcoming sales.  It was one of these signs that caught my son’s eye, outside the local Pet store.  The sign’s proclamation was simple, if not devastating.  Printed in a bold black font,

“Going out of Business Sale”

Reading the sign took only a second, but I knew the impact would last far longer.  Ask most parents in our neighbourhood (any neighbourhood I suppose) and they will say the same thing. The local pet store is more than just a place to buy food for their cherished family member…. it’s a mini zoo, where they can spend an hour on a Sunday afternoon… a place that in their children’s eyes, is filled with wondrous creatures great and small.

As a proud Canadian business owner myself, I am always saddened to see a local business fail, but this particular closing was especially troubling.

My son knows all too well, the sacrifices a family endures when they own their own business…. the weekends spent working…. the late nights… the endless “give me second” references, signalling that he should come back to talk to me later.  These are all too familiar, but made worthwhile when we succeed, which thankfully my company has been able to do.  But I do not think until that very moment, he had realized that sometimes a business can fail, even one as wonderful and joyous as our local pet store.

Naturally he asked ‘why’?

“Could be any number of reasons,” I said. “But, most likely, it’s because they couldn’t compete with the bigger pet stores”.

“What do you mean, they couldn’t compete; because they are small?” “Does that mean your company will go out of business too?”

“No, we’re just fine. What I mean by ‘compete’, is that some companies (large companies) can buy the things they sell to customers much cheaper than smaller stores can, because they paid less to get them. So their customers are happy, because they save money when they shop there.”

“Yes,” he said jumping in… “but the people working in the small companies aren’t happy, because now they don’t have a job.”

“Yah,” I sighed. “That’s economics; cheaper, always has a price.”

Naturally this conversation, got me thinking about my business. Pathways is a learning technology company. We are by all accounts successful. Growing, employing Canadians. But we don’t sell widgets. We sell services that become products. eLearning, gaming, animations, simulations etc. Our cheaper options would come in the form of people. We could outsource. Many in our industry do. It’s easy. In most cases, no one has to be the any the wiser. We could pass the savings on to our customers. Then everybody wins, right?

I know that ‘cheaper always has a price’. I know that local talent must be fostered and supported for our customers to really enjoy what we’re selling. I also know that you can outsource yourself right out of a job. It all comes around eventually.

Before writing this entry, I asked one of my colleagues what he believed our competitive advantage was. He paused for a moment and said, “We care. All of us. We all care. We may not always be perfect, but we care about what we do – because we see the direct impact of our work on our clients. If you don’t know your customers, how can you care about them?

He was right.

Small business owners know how much each and every client matters. They have to, because their livelihoods depend upon each and every one of them. People often talk about small business being the life-blood of our economy, but the real measure of those words comes when we make choices to buy our pet food somewhere cheaper.

Economics: Cheaper always has a price

Intrinsic Learning Motivation and Gaming

Verbs

I started out playing adventure and platforming games on PC. One of the things I have always enjoyed about games is trying to find all the available and/or secret content the programmers managed to put in. With adventure games, sometimes getting stuck on a puzzle meant you had to click on every possible thing on the screen or try every possible combination of inventory item you could think of. The programmers sometimes made something unusual and fun happen when you tried one of those things even if it didn’t do anything to help you progress. These days, I am sometimes actively disappointed when I make a choice in a game that advances the plot instead of taking me to an new sidequest. There was a time I even learned how to use glitches in some games that let me look at places or do things the developers didn’t intentionally want the player to do or look at.

The proliferation of game articles and videos documenting game Easter eggs shows that I’m not the only one who wants to experience everything that a particular game could possibly give a player. It’s the thrill of finding out whether a darker texture on a wall is actually a secret doorway, or if you’re allowed to interact with another character in a non-scripted way, and then finding out if the developer had made anything for you to experience once you’ve tried it.

Now, that motivation to explore, to find out more, if only we could apply that to workplace learning today.

MOTIVATING YOUR LEARNERS

Games can appeal to both types of learners (the extrinsically motivated and the intrinsically motivated), and gamification can make your material exciting and interesting to both types of learners as well. There are a lot of learners who are motivated by competition or rewards to do a task, otherwise known as extrinsic motivation. Learners who are motivated to do a task because they find it fun, exciting or enjoyable are intrinsically motivated.

In most cases, it’s easy to appeal to the extrinsic learner by adding awards, badges, leaderboards and other rewards that can be counted and compared to other learners. Ways to appeal to an intrinsic learner could include giving them options and avenues of exploration.  A lot of material is presented as a single avenue – railroading the learner through an infodump. A better way to present your information is to think of it as a choose-your-own-adventure novel, with many choices that take the learner to different information paths. An intrinsic learner will want to reread a choose-your-own-adventure to find all the possible endings.

So think about who your learners are, how people enjoy different aspects of gaming, and you can make your training engrossing and fun for all your learners!

Intrinsic Learning Motivation and Gaming

Creating a Custom Hotspot Activity for eLearning using Flash

Here’s a quick look at how to create a cool Storyline-compatible hotspot interaction in Flash for an eLearning module. I recently wanted to make a pick-many activity where the user could select multiple keys on a keyboard. In Storyline, hotspot activities are weakened by the fact that only selectable objects have a hand cursor over them. I got around this by making a huge hotspot that covered the entire keyboard, and then putting the ‘correct’ hotspots on top of that one. This solved the hand problem, but made it impossible to have any hover/selected effects on individual keys. The user would have no idea which keys they had selected.

I know when to stop beating my head against a wall; Storyline just isn’t made for this type of complexity. This is a job for the Flash! The Adobe Flash, that is. I’m not going to go through the whole ActionScript3 code here, but I want to talk about the important part – the communication between Storyline, and the keyboard, which is a SWF movie.

For my purposes, I want the activity to be marked correct when the user has selected both ‘Ctrl’, and ‘O.’ The activity should be marked incorrect if any other buttons are marked as ‘selected’ when the user submits the interaction. To accomplish this, I placed three buttons off-screen, and assigned them to be the hotspot targets – two correct buttons, one each for ‘Ctrl’ and ‘O’, and one incorrect button, which gets selected whenever there are incorrect keys selected.

These buttons are triggered by Storyline variables (in this case, True/False variables named ‘correct1’, ‘correct2’, ‘incorrect’). There are triggers which change the state of these three buttons, based on the state of the associated variables. When the user hits ‘Submit’ the state of these three off-screen buttons is what determines if the interaction is marked correct or incorrect. Here’s an example of what the slide looks like in Storyline:

capture.png

Okay, simple! So how do we adjust Storyline variables from a SWF movie? The answer can be found in this great article by Julio Ordonez. Here’s the short version, though. In your ActionScript3 code, call the following function to change a variable (in this case, we’re setting the variable ‘correct2’ to True):

ExternalInterface.call(‘GetPlayer().SetVar’,’correct2′, true);

The internal logic of deciding when to set each of your Storyline variables as True or False will be largely dependent on your particular circumstance. In my case, for example, I wanted my interaction to be marked correct only if two specific keys were selected, out of a possible 40 or so. I created an array to track all of the currently selected keys, and then iterated over the array on each mouse click, changing the Storyline variables depending on which keys in my SWF movie were selected.

The basic setup will remain largely unchanged, however. Simply hide your hotspots offscreen, and set their states via Storyline variable which are in turn set from within your Flash movie.

Here’s a working demo of the keyboard interaction.

 

Creating a Custom Hotspot Activity for eLearning using Flash

USER EXPERIENCE

AN INTRODUCTION

User Experience (UX) refers to a person’s attitudes and emotions when using a particular product or service, which in this case is Web-Based Training. Sadly, the experience can be construed as somewhat neutral or even negative because the perception is that training means going through the motions. However, we constantly look for ways to break through that layer of perception and make something that inspires a more positive outlook.

HOW DO YOU SOLVE THAT?

In today’s world, the biggest challenge is finding a user experience that suits the content, but also delivers a positive experience. Many times, you’ll find that even if you’ve got a great and innovative approach to a set of material, the experience can appear to trivialize the subject. This is certainly an idea that most approach with caution. But why is this the case?

The landscape is the way it is because there are two players in the sandbox and each of them is looking for something different. One side is the group that wants to push for a more gamified experience, and the other is the set of people who are pushing more for the learning objectives to be clear and concise. A perfect example is how a client may want a course on, say, money laundering and a concept has been submitted for a game show look & feel. The receiving end of that concept may get it and view it as trivial, and come back with a strong reaction. The challenge is finding the solution, and establishing what the view is of the material and designing an experience around that versus viewing it from only one angle.

Once you have that holistic view, it’s much easier to develop a course that the end user feels does justice to the subject while also approaching it from a fresh angle. With this in mind, it’s possible to maintain the focus of your development efforts and concentrate on the end user, because ultimately they’re the best gauge for how well it works.

WRAPPING UP

If you would like to explore more about gamification, mobile learning and eLearning, take a peek at our company website: Pathways Training and eLearning, at http://www.pathwaystrainingandelearning.com/. We always look for fresh ways to engage learners and to make the learning experience as fun as possible!

USER EXPERIENCE

WHAT GAME-BASED LEARNING AND GAMIFICATION CAN (AND CAN’T) DO

Man hand playing a computer games
Games and gamification are not magic bullets.

Lumos Labs, the maker of a suite of so-called brain-training games called Luminosity, has recently been ordered by the Federal Trade Commission (U.S.A.) to pay $2 million in damages. The reason? Lumos Labs’ aggressive marketing strategy is built around the false claim that its games promote brain health and can reduce or delay the impact of brain diseases such as dementia. There is no valid or reliable evidence – qualitative or quantitative – to support the claim that Luminosity causes improved brain health. And anecdotes, as compelling as they may be in advertising, are not evidence.

So what can game-based learning and gamification actually do?

Multitasking

There is some evidence to support the claim that gaming may improve our ability to multitask.

Researchers at the University of California, San Francisco have studied the cognitive ability of older adults, aged 60 – 85, as they complete sessions in a driving simulator called NeuroRacer. The complexity of the simulation increases as gameplay continues thus forcing players to multitask the more they play. The study has demonstrated that with practice, players can improve their ability to multitask and the effects can be felt in subsequent NeuroRacer sessions months after game-play.

It is unclear if these skills can be transferred to the real world.

Strategizing

A European study of 152 participants (of which 80 were female, 72 were male and the average age was 14) found a “robust positive association” between gameplay and physiological changes in the brain – these changes are related to higher-order activities such as decision-making, prioritizing and strategizing.

What does this mean? We may be able to leverage games and game elements to promote the development of complex decision-making processes that involve sorting through and prioritizing mass amounts of information.

Focus

Flying in the face of popular and often vocal alarm about video games and shrinking attention spans, a Bristol University study used neuroimaging to see gaming brains at work and found they remained focused throughout gameplay. How did they do this? Researchers had participants study in the conventional way (reading notes and reviewing sample questions) while viewing their brain activity. Then they had participants complete a gamified, competitive study session while viewing brain activity as before. The result? Learners were much more focused when study was gamified.

Implications for adult learning

So what does all this mean for Instructional Design and adult learning?

Do, not tell: Science does support the claim that we retain information better if we’re able to apply it immediately. Games and gamified learning, if designed well, can provide learners with genuine opportunities for application and feedback that would support the retention of new information and set learners up for knowledge transfer.

Remember your audience: Digital natives are, obviously, more familiar with games and game elements than those of us who were introduced to digital life via the Commodore 64 or the Atari. Using games and game elements for digital natives means you can streamline or dispense with cumbersome text-based instructions.

Design a fun experience: Learning solutions that incorporate game elements or adopt the game form should be fun. And if the learning is fun, odds are, you’ll find higher engagement, retention and completion rates. Capture and interpret the data and share the results.

If Luminosity has taught us anything, it’s that we must learn to be critical of grand claims about the effects of games on the brain. Yet despite the abundance of misinformation about the cognitive effects of gaming, it’s clear that games and game elements can be used to support learning. They’re powerful tools, not magic bullets.

WHAT GAME-BASED LEARNING AND GAMIFICATION CAN (AND CAN’T) DO

Programming tips: Modifying Storyline eLearning modules’ variables from Adobe Flash

As part of our series of tutorials, regarding extended functionality in Storyline by using Javascript and/or assets created in external tools, I want to jump in to a more advanced topic that will ultimately take our eLearning modules to the next level.

Let’s say you created in Adobe Flash a very fancy navigation bar with play, next slide and previous slide buttons, with some beautiful animations and states for the buttons that could hardly be done directly in Storyline, and now you are wondering how you will be able to actually control the module with that externally developed asset.

One option, and probably the simplest, is to import the flash object into your Storyline project and then cover the clickable areas with hotspots. While effective, because they will easily trigger the actions you want, this hotspots will also interfere with the states of your buttons, like the hover and clicked states. This happens because your hotspots are basically covering your Flash object and, in consequence, this object is not receiving any mouse inputs.

Another option is to have variables in Storyline that, modified by the Flash object, will drive the eLearning module, pausing and resuming the timeline, and going to the next or previous slide. In this tutorial, I want to show you how to achieve this by only using 2 variables in Storyline, that way we can also explore a bit more about triggers on the slides.

Just a heads up, since we will be using ActionScript 3 in Flash, we will have to do a bit more with coding compared to the first 2 tutorials.

Setting up the environment in Storyline

Let’s start by setting up the environment within Storyline, that way when we jump to coding in Flash, we will already know what to modify in our eLearning module.

The first step is to create 2 variables in Storyline that, as I mentioned before, will affect our module, pausing it or resuming it, and making it navigate to different slides. This variables could be as follows:

  • pauseModule: This variable is a Boolean or True/False and its default value is set to False.
  • navigateTo: This variable is Text variable and it’s default value is set to blank.

The second step is to create the triggers on the slide that will actually affect it. This triggers could be as follows:

  1. The first trigger should pause the timeline when ‘pauseModule’ changes to True.
  2. The second trigger should resume the timeline when ‘pauseModule’ changes to False.
  3. The third trigger should make the module jump to the next slide if ‘navigateTo’ changes to the value “next”.
  4. The fourth trigger should make the module jump to the previous slide if ‘navigateTo’ changes to the value “prev”.
  5. The fifth trigger should reset the value of ‘navigateTo’ to blank when the timeline of the slide starts.

Note: On the third and fourth triggers, the comparison to the values “next” and “prev” shouldn’t be case sensitive, that way we can ensure that inputs like “Next” or “PREV” have the same effect on the module.

Extending a bit further our work in Storyline, we can easily create a Master slide and implement this triggers in there, that way we don’t have to repeat this process n-times throughout our module.

Controlling our eLearning module with AS3

Now that we have set our variables and triggers in Storyline, it is time to go to Flash and create the code that will activate those triggers.

Let’s assume we have created 3 buttons and they are as follows:

  • A play/pause button called ‘playPauseBtn’
  • A next button called ‘nextBtn’
  • A previous button called ‘prevBtn’

With that in mind, let’s create our code in AS3. In this part, I will explain each line of code so that we all have a clear understanding of what they do.

The first step is to import the libraries related to the events of the mouse (e.g. Click event) and related to the communication of our Flash object with Storyline.

import flash.events.MouseEvent;

import flash.external.ExternalInterface;

The ExternalInterface library will allow us to call Javascript functions that are external to our Flash object, and the MouseEvent library, will capture the mouse input on our buttons.

var playPause:Boolean = false;

var navigateTo:String = “”;

In the lines of code above we are defining the same two variables we defined in Storyline, the ‘playPause’ variable relates to the ‘pauseModule’ variable and will indicate whether to play or pause the timeline of our eLearning module; the ‘navigateTo’ variable will determine if the module has to navigate to the next or previous slide from the current slide. These variables will be modified by the functions linked to the following event listeners:

playPauseBtn.addEventListener(MouseEvent.CLICK, controlTimeline);

nextBtn.addEventListener(MouseEvent.CLICK, navigateNext);

prevBtn.addEventListener(MouseEvent.CLICK, navigatePrev);

In essence, an event listener, is a function that will be executed when an event happens, in this case, the controlTimeline function will be executed when the playPauseBtn is clicked, and the navigateNext and navigatePrev functions will be executed when the next or previous buttons are clicked, respectively.

Now let’s see how these 3 functions are defined, starting with the controlTimeline function:

 

function controlTimeline(evt:MouseEvent):void{

                playPause = !playPause;

                ExternalInterface.call(“GetPlayer.SetVar”, “pauseModule”, playPause);

}

We will take a more in-depth look at the structure of AS3 in a future tutorial, in the meantime, let’s understand what the previous function is doing.

Basically, what the contolTimeline function does is to toggle the value of the variable playPause between True and False, as explained on a previous tutorial (link to the first programming tips article), and then it executes our beloved Javascript function “SetVar” (please refer to the first programming tips article for a better understanding of this function) by passing the two necessary parameters.

 

function navigateNext(evt:MouseEvent):void{

                navigateTo = “next”;

                ExternalInterface.call(“GetPlayer.SetVar”, “navigateTo”, navigateTo);

}

 

function navigatePrev(evt:MouseEvent):void{

                navigateTo = “prev”;

                ExternalInterface.call(“GetPlayer.SetVar”, “navigateTo”, navigateTo);

}

And finally, the previous functions will indicate the eLearning module to navigate forward or backwards by changing the value of the variable ‘navigateTo’ to “next” or “prev”.

Before finishing the tutorial, let’s remember that this interaction can’t be tested locally within storyline and, as indicated on the first programming tips tutorial, we would need to make use of other tools to verify if our customized code is working.

If you want to know more about Javascript and ActionsScript 3 applied to eLearning or about how to use other tools, such as software for 2D or 3D animation to enrich the outcome of your products, don’t forget to visit our blog or our website at www.pathwaystrainingandelearning.ca.

Programming tips: Modifying Storyline eLearning modules’ variables from Adobe Flash

Programming tips: Accessing LMS functions using the Javascript API in Storyline for eLearning modules

Continuing with the programming tips we started in the previous post, regarding how to write code in Storyline for eLearning modules, let’s continue this time with a little bit more of an advanced coding.

To summarize, we now know that our eLearning modules, when published from Storyline, come with a set of Javascript libraries that allows assets developed in external tools (e.g. Adobe Flash) to communicate with our modules and modify variables.

We also know about the reporting capabilities Storyline has, meaning that all the quiz questions you create in the modules, have the option to be graded and then reported to the LMS.

However, learning may not be as simple as creating slide questions with multiple answer questions, drag and drops or matching sequences, and sometimes we are required to develop this interactions somewhere else, so what happens when you want those interactions to be part of your eLearning module’s grade?

Well, thankfully we are able to manually report that score to our LMS, using Storyline’s Javascript functionality.

Storing the activities’ points and converting it to a percentage

Let’s say we have developed 6 interactivities in Adobe Flash and all of them send a point value to Storyline after they have been completed by the learner (This will be covered in another tutorial). To store this value in Storyline, let’s create 6 Number variables as follows:

  • Activity1
  • Activity2
  • Activity3
  • Activity4
  • Activity5
  • Activity6

And set all of them to a default value of 0.

Now, after all the slides with the activities, let’s create another slide that will work as our results slide, calculating the percentage achieved by the learner on the previous activities. On this slide, we can use a Javascript code that looks something similar to this:

var player = GetPlayer();

var act1 = player.GetVar(“Activity1”);

var act2 = player.GetVar(“Activity2”);

var act3 = player.GetVar(“Activity3”);

var act4 = player.GetVar(“Activity4”);

var act5 = player.GetVar(“Activity5”);

var act6 = player.GetVar(“Activity6”);

var scoreTotal = act1 + act2 + act3 + act4 + act5 + act6;

var percentage = scoreTotal * 100 /60;

 

Looks a little bit complicated? Well, let me explain it.

On the first 7 lines of code, we first get the Javascript API from the player and then get and store all the six variables containing the values reported by the activities. Then we have the following line of code:

var scoreTotal = act1 + act2 + act3 + act4 + act5 + act6;

In this line, we are only finding the total achieved by the learner after going through all the 6 interactions. Finally, we see this:

var percentage = scoreTotal * 100 /60;

This is just a simple ratio that allows us to translate the achieved points by the learner into a percentage. Let’s assume we have only 6 of these interactions and each one of them awards the learner 10 points if completed correctly, thus the value of 60.

If we do the math, let’s say the learner scored a total of 40 points, then percentage will be 66.7% (rounding up to the nearest decimal).

Reporting the score to the LMS

Now that we have the percentage we want to report, we can now report it to our LMS. Thankfully, Storyline allows us to communicate manually by providing a set of functions that we can use to report score or completion.

We achieve that by adding the following lines of code after calculating the percentage:

var lmsAPI = parent;

lmsAPI.SetScore(percentage, 100, 0);

What the previous 2 lines of code do, is that first, we get the LMS API provided by Storyline, and then we use the “SetScore” function to report the percentage to our LMS. If you notice, this function takes 3 parameters:

  • The first value is the percentage achieved by the learner
  • The second value is the maximum score that can be reported, 100 in this case, because we are talking about percentages
  • And the third value is the minimum score that can be reported, 0 in this case.

After adding this Javascript code to your project, you can now rest assured that your elearning module will report a score, even if those values don’t come directly from Storyline, but they come from activities or interactions you developed in an external tool.

If you want to know more about Javascript applied to eLearning or about how to use other tools, such as software for 2D or 3D animation to enrich the outcome of your products, don’t forget to visit our blog or our website at www.pathwaystrainingandelearning.ca.

Programming tips: Accessing LMS functions using the Javascript API in Storyline for eLearning modules

COMPATIBILITY ISSUES

AN INTRODUCTION

With the news that browsers are going to phase out support for flash-based material, we’re not at a point where we’re hitting a crossroads on what platforms are usable for eLearning. The web, being the most obvious answer, only scratches the surface of the problem. What’s getting overlooked is the software platforms we use to deliver those learning packages.

WHY DOES THIS MATTER?

A vast majority of eLearning is actually Flash-based. A fact that flies largely under the radar. However, with a closer look, we find It everywhere like with Storyline, most animations, banners, and games. It served as a flexible way to deliver games to people without the prohibitive size of complexity of a game engine. The woefully unstable and insecure plug-in will be making its way out, and only now is software coming out to fill in the void.

A perfect example is Adobe Edge Animate. A software platform that takes animations and makes them entirely web-based, and in the process, gives them better responsiveness and creates a more flexible cross-platform solution. Find out more here: https://helpx.adobe.com/edge-animate/tutorials.html

EFFECTS ON LEARNING

Aside from the obvious answer of not being able to run it, we get into the programs being more versatile when they’re in HTML5. The embedding is much simpler, and the implementation can be more widespread than the desktop and without any middleware such as the Articulate Mobile Player, for example. Without which, people will be more secure in knowing they can take their learning experience with them and not have to worry about installing anything new on their phones or tablets. The issue of SCORM also gets simplified with a simple web wrapper and not supplemental programming, and again, middleware in order for it to work properly.

WRAPPING UP

If you would like to explore more about gamification, mobile learning and eLearning, take a peek at our company website: Pathways Training and eLearning, at http://www.pathwaystrainingandelearning.com/. We always look for fresh ways to engage learners and to make the learning experience as fun as possible!

COMPATIBILITY ISSUES

EDUCATIONAL GAMES

AN INTRODUCTION

This segment of gaming is something that’s stayed relatively untouched since the 90’s. It’s a demographic that has tried very hard to fit educational elements into games but hasn’t come very far. As well, the highly successful games have all been targeted at younger children. The question then becomes: Where do we go from there?

HOW ARE GAMES EDUCATIONAL?

I went into some detail about this in my last post, but giving a more realistic example, we have the Carmen Sandiego series, or Reader Rabbit. These games provided a supplemental education tool for children in the primary grades for the most part. It was an easy way of giving children the enjoyment of a game’s objectives while also relaying valuable information. The experience was no longer about sitting in front of a teacher and listening, but rather tracking down Carmen Sandiego (for example) and learning about geography and history at the same time with the clues provided.

MOVING FORWARD

The main thing we’re missing now is more games that achieve the same goals, but with more alignment to current technology. There’s a niche to be filled with the advent of things like VR, social integration, improved graphics, access to information via the internet, and mobile computing… all things that were in their infancy during time of Reader Rabbit and Carmen Sandiego. It’s up to us to find a way to not only bridge that gap, but also create a new market where a more mature audience can get the same experiences from their games.

Adults love games, and the same gaming concepts that are used in children’s games can often be applied to help adults learn. In the future, the prediction is more corporate training departments will be adding gamification into their eLearning to help adults grasp key concepts.

WRAPPING UP

If you would like to explore more about gamification, mobile learning and eLearning, take a peek at our company website: Pathways Training and eLearning, at http://www.pathwaystrainingandelearning.com/. We always look for fresh ways to engage learners and to make the learning experience as fun as possible!

EDUCATIONAL GAMES

Programming tips: Writing code in Storyline for eLearning

There is always a time in our development phase where we need to add some extra fancy elements or interactions to our eLearning projects. Even though Storyline usually provides us with all the tools we need to produce our eLearning modules, sometimes it falls short on some of the things we want to do and then, we need to make use of other software, such as Adobe Flash.

However, and unfortunately for non-programming people, communication between those external tools and Storyline is not as straight forward as we would like it to be.

On the other hand, Storyline offers an API (Application Programming Interface) to help us while integrating interactions made on other software into our modules. This API consists of a group of Javascript functions that will let us retrieve and modify objects, usually Storyline variables.

I am aware that thinking about coding something in Javascript (or any other programming language) may be scary for some people, but I like to believe that regardless of the language, we can all code something, given that one of the most important things is logic, and as far as I am concerned, all human beings are logical, too.

In this article, I describe several tips that may help you use the Storyline API and even, introduce you to the coding world.

Avoid writing code whenever possible

As much as I love programming, I also love to avoid it when it is not necessary. It may sound contradictory, but before jumping into writing code and scratch your head for hours, make sure you have a legitimate reason to do it.

Usually, when you have to develop a module in Storyline, you have a reference, like a script or a storyboard describing all the interactions on screen (If you don’t have this, I strongly recommend you create a storyboard before developing a module), evaluate them and figure out if what you have to do is possible through the tools offered by Storyline.

There is a specific situation that I have experienced, in which I definitely use the Javascript API to enable my interaction, and this is, adding a button on the player to show a layer with closed captions when there is audio present.

Understanding the API

If you have decided to use Javascript on your project because you deem it necessary, or, well, because you want to try it, you need to understand how the API works, or at least have an overview of the things you can accomplish with it.

As I mentioned before, the API is a group of functions (provided by Storyline when you publish your module) that you can use to modify objects within the project, i.e variables. Yes, you can modify the value of variables using Javascript and (Spoiler alert) you can have triggers of actions happening when the value of those variables changes.

01

On the picture above, we can see a simplified version of how the API works. First, your Javascript code, will ask the API to retrieve the value of a specific variable from the Storyline module. Then, when that value becomes available to your code, you can modify it, changing its value to a different one or even making math operations if your variable is a number. Remember that Storyline works with 3 types of variables: Text, numbers and Booleans (true or false).

Once you have done everything you needed with that value, you can post or submit your results to the same or another variable that matches the type of your new value. To do that, you just ask the API to send that value to a specific variable within your Storyline module.

Creating the Javascript code

Now it’s time to actually write the Javascript code within Storyline to execute the desire actions.

Let’s say you have a layer that will show up when you click a button on the player (Like the resources button you can add). When you create this button on the player window, you have fewer options under the “Action” drop down menu as if you were creating an object directly on one slide. One of the options is to “Execute Javascript”. Once you create the action, you can edit the Javascript code linked to this button on a pop-up window that looks like a notepad.

The advantage of the API is that it is available right away when you create the action, meaning that you don’t have to “include” or “import” any programming libraries, like you would do with ActionScript 3 or C#, for example.

Let’s also say, that you have already setup a variable that will toggle the visibility of your layer, and it is called “myToggle” and it is a Boolean variable with a False value by default. The idea is that the layer becomes visible when myToggle changes to True and hides again when it changes to False (This is the logic you would use to create the triggers on the slide).

The first thing you have to do, is to make sure the variables are accessible from your Javascript code, and this is done by adding the following line of code:

var player = GetPlayer();

This line of code is simply creating a temporary variable that will retrieve and store all the functions that will help you modify variables within Storyline.

You can change a variable’s value by using the following line of code, if it’s a text:

player.SetVar(“myVariable”, “Lorem Ipsum”);

or if it’s a number:

player.SetVar(“myVariable”, 25);

The sintax of the “SetVar” function is very simple, the first parameter refers to the variable you created in Storyline and that you want to modify (This parameter should always be inside quotation marks), and the second parameter is the actual value you want to assign to that variable; if it is a text, the text should always be inside quotation marks, otherwise, if it’s a number or a Boolean, the quotation marks are discarded.

However, in the example we are following to create the Javascript code, we can’t really assign a value right away, since we first want to know if myToggle is true or false (if the layer is visible or not). To achieve this, we can use the following code to know the current value of myToggle:

var toggleValue = player.GetVar(“myToggle”);

The sintax of the “GetVar” function is even simpler than the “SetVar” function, it only needs one paremeter and it is the name of the variable you want to retrieve, always using quotation marks, and it is assigned to a temporary variable created in our Javascript code because, well, since we are retrieving a value, we need to store it somewhere.

Please note that this function, retrieves the value of the specified variable and not the variable itself, meaning that whatever we do with this value, doesn’t necessarily affect the variable within Storyline, unless we tell the API to do so (which is done with the “SetVar” function).

Now that we have the current value of myToggle, we can decide whether to change it to False or to True. We could use a conditional here, but in my experience it doesn’t work as well as the following code:

toggleValue = !toggleValue;

Wow, the previous line of code looks a bit scary, doesn’t it? Let me explain it (or a least try) so that it is clearer.

Since the value we just retrieved is a Boolean, meaning that we have either True or False, we can apply something called Boolean Operators, and in this case in particular, the exclamation mark preceding “toggleValue” is a negation of the value stored within that variable. This negation, simply changes the value between True or False depending on the current value, so if you say that something is NOT False, then it is true, and if something is NOT True, then it is false.

Looking at the line of code, without the name of the variable on the second half of the equation, and assuming that the current value is False, we would see something like this:

toggleValue = !False;

Which in common tongue, that line of code is read “toggleValue equals to NOT False”, so as a consequence, we are instructing Javascript to assign the value of True, because saying NOT False is the same as saying True.

With the line of code “toggleValue = !toggleValue;” we are ensuring that whatever the value we retrieved (true or false), it will always assign the contrary value.

Finally, after modifying the value, we need to send it back to Storyline and assign it the the “myToggle” variable. This can be done by using the function we reviewed earlier:

player.SetVar(“myToggle”, toggleValue);

The previous code is asking the API to assign the value stored in the variable “toggleValue”, to our variable in Storyline “myToggle”.

And with this, our layer should be showing up and hiding when we click on the button we added to the player.

Testing your interaction

Unfortunately, all the code we created on the previous section, is not available on preview within Storyline, because all the Javascript is blocked for security reasons.

In consequence, we have 2 different options (that I can think of) to test our customized Javascript code:

  1. We can actually publish our module and upload it either to our LMS or our webserver, that way it is possible to test our interaction live.
  2. Another option, if you don’t have a web server available nor a LMS, is to install a local server, like Xampp, and test it locally.

It could be a bit time consuming, but it is worth since the interactions created this way can improve the engagement of our modules.

I know using Javascript at first could be somewhat confusing or it could terrify you, if you are not used to code, but in the end it is rewarding to give it a shot when producing your eLearning modules.

Programming tips: Writing code in Storyline for eLearning