Using Quizzing System Variables

Intro

In my last post I mentioned that, based on the visits to my blog posts, Quizzes in Captivate seem to be one of the stumbling blocks for newbies. Most of the quizzing blog posts with focus on default quiz slides are already pretty old. More recently I have been talking about new features like Branch aware and Knowledge Check Slides. The most visited post will be updated to accommodate the changes in a near future. This article will offer you some ideas about using the specific quizzing category of system variables. If you ever downloaded the full list of system variables, you will have seen that these variables are read-only, at least if you are not a JS expert. As a bonus, you'll find a downloadable list with Quizzing System variables which include my personal comments and links to blog posts where I have used those variables.

This article is an introduction to the use of variables, the use cases are not complicated at all.

Using read-only Variables

Quizzing System variables are read only, but you can use them in two ways, which I will illustrate by a couple of use cases later on:

  1. To show information to the learner, by inserting them in a text container, which can be a shape or a text caption.
    All variables are case sensitive, for that reason I recommend strongly only to insert variables using the X button in the Character part of the Properties panel for the text container. In the dialog box you choose System variables (default is User variables), eventually the category (Quizzing) and pick the correct variable from the dropdown list. It is also possible to limit the number of characters (set to 5 in this screenshot):

    Since text containers including variables have to be generated on runtime, contrary to the static text containers, it is wise to use only websafe fonts which was not the case in the screenshot above.

  2. To use them in an advanced or shared action for multiple goals, like changing navigation, calculation, skipping slides etc.

You will see some use cases for both situations in this article.

Use case 1: add information on question slides

This use case has been explained in an older article (Buttons on question/score slide), but here you'll see a refurbished version using new features which have appeared since that old version: hyperlink, multistate object, shared action, toggle command.

The idea is to insert system variables in a text container that appears on the first question slide, is timed for the rest of the project, always on top. Since all embedded quiz objects have priority in the stacking order (z-order, order of the layers in the timeline), you have to make sure that the custom text container is not covered up by embedded objects. For that reason I edited the size of feedback messages on the quizzing master slide, to make room for the (green) text container:

This text container can remain permanently on the question slides, always available, or you can use a shape button to trigger its appearance. That button is visible in the screenshot as a green button with the label 'i'. It is also inserted on the first question slide, timed for the rest of the project. This shape button has an extra custom state 'Close', visible on the next screenshot, to turn it into a real toggle button. The action used for this shape button is the shared action described in '1 action = 5 toggle buttons', and a user variable v_visib is used in that action.

You see the inserted system variables cpQuizInfoPointsscored, cpQuizInfoPointsPerQuestionSlide and cpQuizInfoNegativePointsOnCurrentQuestionSlide. The result on runtime, when the toggle button has opened the info text can be seen in this screenshot:

To be sure that the information is closed by default On Enter for each question slide, I used an On Enter action for each question slide, which will be shown in use cas 3


Use case 2: Custom Score slide

You can turn on/off fields in the default Score slide, but you can also replace the inserted fields by your text and system/user variables. Look at this example in editing mode:

You see again a lot of embedded system quizzing variables: cpQuizInfoPointsscored, cpInfoPercentage, cpQuizInfoTotalQuizPoints,  cpQuizInfoTotalCorrectAnswers  and cpQuizInfoTotalQuestionsPerProject. Moreover there is one added user variable v_penalty, which I'll explain in use case 3.

On runtime it will look like this screenshot:

This score slide is taken from the same example file. Since both the text information container and its toggle button were timed for the rest of the project, you have to take care of hiding both On Enter for this score slide. I used this standard advanced action:


Use case 3: Calculation total Penalty

Although there is a system variable (with a very long name) cpQuizInfoNegativePointsOnCurrentQuestionSlide, no exposed system variable is available containing the total penalty of the quiz, which is the opposite of the maximum number of points , cpQuizInfoTotalQuizPoints. If the user misses all answers, he'll get a negative score equal to that total penalty. Since it is not available as an exposed quizzing variable, I will have to calculate it.

For that purpose I created a user variable v_penalty with a start value of 0. The On Enter event of each question slides was used to trigger this standard advanced action (shared action had no sense because same action is valid for each question slide):

The first 3 commands take care of resetting the toggle button (SB_Info with the variable v_visib) and hiding the text information container (Tx_Info).

The Expression command is using cpQuizInfoNegativePointsOnCurrentQuestionSlide to calculate the present amount of v_penalty. It may seem confusing that I'm using '+' as mathematical operator: reason is that the system variable always shows a negative number. You don't have to believe me: have a look at the second screenshot in use case 1. 

More use cases - download

I wanted to keep it simple in the described use cases, introduction to the use of variables. Download the pdf with description of all quizzing system variables from this link

The table has 6 columns:

  • Variable name
  • Variable type: a variable can be empty, a Boolean (only values are 0/1 or T/F), a number, text or undefined.
  • Explanation which is sometimes bit different from the explanation found in the Variables dialog box
  • Default value
  • Comments: my personal comments
  • Blog posts: here you'll find quite a lot more use cases, I mention the blog posts where the referenced variable has been used

In this screenshot you see part of the first page:

Conclusion

I'm waiting for your comments. Do you see ways of using those system variables in your projects? Do you have questions, use cases that you cannot figure out if they are possible? Fire away.