This page explains how to use command variables that interact with variables.
- Uses @syntax
- Uses comma delimited lists
Assigning xcmndReset with the name of a variable will cause that variable to return to its default value.
For example, let's say you have a variable in your course named WelcomeMessage which is displayed in Caption_1. Throughout Caption_1's slide you change the value of WelcomeMessage a few times (possibly depending on how the user interacts with the slide). When exiting the slide, you want to reset WelcomeMessage's value back to its original value, so that if the user navigates back to Caption_1's slide, they will see the original welcome message.
Now of course you could just assign WelcomeMessage with whatever value you gave it initially. However, if later you change WelcomeMessage's original value, you then have to update it in two locations, which runs a higher risk of causing bugs.
Instead, you could do the following.
Assign | xcmndReset with WelcomeMessage
As another example, what if you were using variables and text entry boxes to drive an intricate interaction where you mimic the behavior of an online form. If the user exits that slide and then comes back to it at a later date, you will want to reset all those variables (including the ones linked to the text entry boxes).
Well, lets say these were the names of the variables in your interaction:
Then you could use @syntax to reset ALL those variables with the following line of code.
Assign | xcmndReset with @_form
You could also use a comma delimited list to reset multiple variables in a single line
Assign | xcmndReset with gender_form, paymentmethod_form
Note: When CpExtra is loaded it records the current value of all variables. That is the actual value it is resetting them to. So if MyVar has a default value of 'Hello', then on slide 1 you gave it a value of 'World', if CpExtra is loaded on slide 2 it will record 'World' as being MyVar's default value.
- Uses comma delimited lists
- Recognizes the following keywords (not case sensitive)
Assigning xcmndFlushStorage with the name of a storage variable will clear that variable's value from the browser's storage AND prevent that variable's value from being saved to storage (for the duration of the current project).
While this may come in useful occasionally for user interactions, we expect this feature will mostly be used by Captivate developers while they're testing their course. At some point you will want to know what a user will see the first time they view your course, but if there were no easy way to clear the values of your storage variables, then it would be extremely difficult to do so.
xcmndFlushStorage can accept a single variable name
Assign | xcmndFlushStorage with ls_localStorageVariable
A comma delimited list of variables.
Assign | xcmndFlushStorage with ls_localStorageVariable, ss_sessionStorageVariable
The keyword Local, which will flush all local storage variables in the project.
Assign | xcmndFlushStorage with Local
The keyword Session, which will flush all session storage variables in the project.
Assign | xcmndFlushStorage with Session
Or the keyword All, which will flush all local and session storage variables in the project.
Assign | xcmndFlushStorage with All