Opus automatically tracks a range of scores (values, percentages or correct/incorrect) in internal score variables but these are most easily used for question and answer type interactions. Sometimes you will want to keep score differently - in a game for example.
In this tutorial, we will explore how to set and display a custom score.
Firstly you'll need somewhere for your score to go. You will need a variable where you can store it and because we want any page in the publication to be able to see the score, it will need to be a Publication variable.
Decide what your variable will be called - for example, userScore and then go to the Variables tab of Publication Properties to create it.
Click the Add button to bring up the dialog to create the variable.
Type the name of your variable in the Name box.
You may prefer to use a consistent convention for creating your variables to help remember what you called something when you come to use it later. Preset Opus variables are always in uppercase so using lower case or title case for yours helps them stand out in the list.
Select the Number option as we will need to add and subtract to this variable so we need it to be a number rather than text.
Set the Initial value to zero unless you want the user to start with a score already.
You can use a wide range of activities to record a score in Opus simply by choosing the relevant Trigger. These might include:
But whatever you use to trigger the score, the action will be the same.
To increase your score simply use the Add option on the Programming tab.
Click the drop down list to find your scoring variable and then set the value box to the value required.
To display your score to the user we simply need to create a text box and put the relevant variable in it.
tutorial on keeping score manually in Opus Creator or Opus Pro