Be a Captivate Ecologist: reuse variables!

Intro

In a former blog post I explained my work flow when preparing advanced actions for a Captivate project: Look Before you Leap. I inserted an explanation of this work flow in the DevLearn presentation as well, and offered a worksheet.
One of the steps is the choice of user variables, and the way you can save a lot of time later on by this choice, more specifically when trying to reuse variables. On the user forums I do see that often users just create variables on the fly and end up with so many variables that they are difficult to manage and cause a lot of unnecessary editing work. I was happy to get a rather simple use case by which I can explain this step another time.
 
Another user, an Emergency Nurse Educator inspired me for this use case, with this question:
"I have developed an MCQ captivate project that presents the emergency nurse with randomised scenarios of patients that they have to assign the correct level of urgency.  The levels of urgency are 1 through to 5, were 1 is the most urgent and 5 the least.  Captivate produces an accuracy %, but I would also like the percentage of over or under assignment of urgency category."

The user provided me with a small example with 3 MCQ slides and allowed me to publish this file here ... on the condition that I offered a solution of course.

 

Example SWF

Play this SWF to see the result. On the score slide the number of incorrect answers that were too high or too low. It is not a percentage - for 3 slides it is a bit ridiculous - but calculating the percentage as well is possible of course.

 

Variables - actions & triggers

No one will doubt that at least one counter is needed, which will be incremented with each incorrect answer. Although I could achieve it with one counter, found it easier to create two:

  • v_low  will store the number of incorrect answers that were under assignment of urgency category
  • v_high  will store the number of incorrect answers that were under assignment of urgency category
If you want to try it with one counter, you'll use the system variables cpQuizInfoTotalCorrectAnswers and cpQuizInfoTotalQuestionsPerProject together with the single counter to calculate the inverse counter. Bit cumbersome, not?
 
To check the answer I have to compare the given answer with the correct answer. The given answer is stored in the system variable cpQuizInfoAnswerChoice. The value will be the 'numbering' of the answer. This means in the default setting assumed here, where answers are indicated by characters A, B, C, D, E it is the character that will be stored. This is great news, because operators like 'is greater then' can be used to check if the answer was 'higher' than the correct one.
 
As I explained in the  DevLearn Presentation you have two possible actions on exiting a question slide:
  1. one that will be executed after a correct answer; in this case this can be left at Continue or eventually Go to Next Slide
  2. one that will be done after last attempt (on question level) for a wrong answer, which we will have to turn into an advanced conditional action
Since the wrong answers can only be too high or too low, this advanced action can be limited to one decision:
  • either the answer was too high, then the v_high counter has to be incremented, will be the THEN part
  • or it was too low and the v_low counter increments, the ELSE part
The most annoying work when using advanced actions is to duplicate and edit similar actions, because of the need to point to a unique ID. In this use case: the correct answer is different on each Question. At first sight I couldI create the advanced action for the first question slide this way:
IF cpQuizInfoAnswerChoice is greater than B       (B is the correct answer)
THEN   Expression  v_high = v_high + 1
ELSE    Expression v_low = v_low + 1
In that case I have to create a similar advanced action for each Question slide, in which I have to change the correct answer indicator. To avoid this cumbersome work, I created a reusable variable v_correct. This variable will get the correct answer indicator (B for the first question slide) on entering that slide, by a simple Assign action.
 
And the advanced action will be changed to:
IF cpQuizInfoAnswerChoice is greater than v_correct
THEN   Expression  v_high = v_high + 1
ELSE    Expression v_low = v_low + 1 
And this unique advanced action can now be used on any question slide!
 
 

More tips to save time

I would recommend creating a template with one question slide and the score slide. The question slide can have a regular question instead of a placeholder. Attach both the assignment action (on Enter) and the advanced action (After last attempt) to this question slide.

When using this template: duplicate the question slide as many times as needed. They will all have the same Text Captions, that you can export, edit and import again to change the question texts. In Captivate indicate the correct answer, and at the same time assign the correct answer indicator in the Properties panel for the slide, On Enter.
 

 

5 responses
Nice technique! I can uses beyond the quiz, too. Thanks for sharing!
Thanks for your nice comment! Indeed, this was only an example to illustrate how some reflection about variables and actions can save you a lot of time later on. And this kind of variable that stores a current situation I'm using a lot in all my projects.
Your easy to follow instructions are brilliant, your blog is like having you on my shoulder whenever i hit a rough patch in a Captivate build. Thank you
2 visitors upvoted this post.