Allen Partridge in a comment on a post suggested that I should blog about the work flow, the logic when setting up advanced actions. I find this a very difficult subject for a blog post, much easier when teaching face to face or online teaching. But this new question on the forum, that I tried to work out is a fine example to give you some tips, about shortening developing time by sitting down a while to reflect about the situations you want to create. And you'll not believe it but I do sit down, take a pencil and paper at that moment, or start to scribble in Evernote if I can't find those venerable tools immediately.
I will not explain the advanced actions in detail (some screenshots in the Gallery), but focus on the work flow and offer some timesaver tips.
"Is there anyway of taking a series of variable controlled numbers say 0-9 that have been punched into a keypad, and formatting them so that the ones that are clicked on the keypad are displayed in sequence. E.g. if you click 1,5,8 and 9 on the keypad, then in the next slide I want 1,5,8 and 9 to be displayed as the keypad code so to speak." The complete thread can be found here: Push button lock theory
Those of you who visit the Captivate user forums frequently, will not be astonished that I asked more questions to have a clear idea about the goal. And the user kindly provided me with the image of that push lock. So I got these details:
- the user chooses the code
- the lock has 13 possible digits: numbers 0-9 and letters X,Y,Z
- a C-button allows the user to reset the total code
- the code has 5 digits
- the code must not be validated but only shown on the next slide, and navigation to that slide is by a button Next
Have a look at this movie to understand better what I tried to achieve. It has only 3 slides: Intro, EnterCode and ShowCode.
For this particular (simple) use case, what did I write down? And you'll see that I mostly define labels for everything as well.
Situations - slides - events
Which situations will be possible and will I solve this in one slide or in multiple slides?
- User 'pushes' one of the buttons to enter a digit: which means I'll have 13 events that can trigger an action - all those actions will be similar
- User wants to change the code and clicks the C-button: event that is different from the 13 previous ones
- User has entered 5 digits and tries to push another button: has to be taken care off for each of the 13 actions described in 1.
- User clicks Next to confirm his code: special event, which will cause navigation IF the user has entered exactly 5 digits
- User clicks Next but has not entered 5 digits: should be taken care off, no navigation in that case
In this case I decided to have only one slide EnterCode with all the events/actions and a second slide ShowCode to navigate to with the Next button (situation 4).
There are 15 events to trigger actions by interactive objects:
- 13 click boxes, each covering up a digit (0-9 and X,Y,Z), decided to label them as CB_0, CB_1..... CB_X, CB_Y, CB_Z
- 1 click box covering the C-button CB_C
- 1 button But_Next
If I want to make it possible to restart the process of entering the code on the slide EnterCode it is a good idea to use the event 'On Enter' for this slide to re-initialise everything.
Mostly I make a list of the variables I will need and create them separately from the advanced actions. This is only a personal preference, I do see a lot of tutorials where the possibility to open the Variables dialog box from the Advanced Actions box is used to create variables on the fly.
- Since the goal is to show the entered code in ShowSlide I need 5 variables that will store the entered digits. This seems logical, but I did see that the user started by creating one variable for each digit? I suspect this is the result of just starting right away in Captivate before reflecting on the goal :-). Those five variables will be used on the second slide to show the code in a Text Caption.
Variables will be labeled: v_one, v_two, v_three, v_four, v_five
To use the C-button to reset the code, I'll need my favourite variable that is totally empty:
To track the number of entered digits for situations 3-5 I need a counter:
The last variable I didn't add immediately, but saved me a lot of editing time when creating the 13 similar advanced actions for the click boxes (see Actions).
v_current will store the digit of the current Click box (1 if the user clicked on the 1, X if he clicked on X..); and for all those genius-programmers here I really appreciate the fact that the Advanced Actions do not request me to make a difference between a number and a string when defining a variable :-)
On the slide EnterCode, with the image of the push lock, I'll need (see Timeline in Gallery):
- 13 click boxes on the 13 digits: do not create them all at once! Create one click box, configure it (inc. the attached advanced actions), and test it thoroughly. Only after that process duplicate it as many times as you need (and use my shortcut keys for aligning without a mouse Moving and Resizing Objects); believe me: that will save you a lot of clicks.
- 1 click box over the C-button
- 1 button Next
- Text Caption Instruction explaining how to enter and confirm the code
- Text Caption Warning to show up when the user enters more than 5 digits (in the same location as the previous caption)
- Text Caption TooLess to show up when the user tries to confirm with the Next button and didn't enter 5 digits, also in the same location; in this text caption the user variable v_counter is embedded
On the slide ShowCode there is only a text caption to show the code. Beware: when embedding the user variables v_one....v_five be sure to set the length of each variable to 1 and no spaces between the variables in order to show the code as a sequence.
Tip: you can use the same label for an advanced action as the label for the object it is attached to, provided that you first label the object! If you try to label the object after you attributed the same label to an advanced action you'll get an error message! I forgot about this for the button Next, that is why you'll see there a different label for the action and the button, because I labeled the button after creating the action.
CB_1 and similar actions triggered by click box with same label (screenshots in Gallery)
Will need a combination of a standard action and a conditional action with multiple decisions:
- increment v_counter and store the digit (1 for CB_1) in v_current (standard action) in decision Counter
- store the digit in the appropriate variable v_one, v_two...., v_five (conditional with 5 decisions First, Second, Third, Fourth, Fifth)
- checks if the user didn't enter more than 5 digits, decision TooMuch
CB_Reset (triggered by click box CB_C and eventually on Entering the slide EnterCode)
This is a standard action (see Gallery)
- resets v_counter to 0
- clears the variables v_one....v_five by using the variable v_void
- shows text caption Instruction (that could have been made invisible by a previous advanced action)
- hides text captions Warning and TooLess (that could have been made visible by a previous advanced action)
Bt_Next (triggered by button But_Next)
This is a conditional action, one decision with a Then/Next section (see Gallery)
- checks if v_counter
- if Yes the text caption Instruction is hidden and TooLess is made visible
- if No the user is navigated to the next slide ShowCode
My work flow (had 2 slides with background and image on first slide), sequential:
- created all the user variables and added comment to each variable
- created click box CB_1, CB_C, button But_Next,
- created text caption Instruction and formatted it, used Duplicate to create captions Warning and TooLess on slide EnterCode
- created text caption on slide ShowCode with the embedded variables (set each to length 1)
- added a testing Text Caption on first slide that shows the variables v_counter, v_current, v_one......v_five; it helps when testing to see those variables change in real time; this caption will be deleted later on
- created advanced action CB_1 from Properties panel for click box CB_1: started with first 2 decisions (Counter and First), tested, then added decisions Second...Fifth, at last added TooMuch; here it was possible to test everything because the user can select the code "11111".
- created advanced action CB_Reset from Properties panel click box CB_C and tested it in combination with CB_1
- attached this action CB_Reset also to 'On Enter' for the slide EnterCode
- created advanced action Bt_Next from Properties panel for button But_Next and tested it (still with only 1 as possible digit)
The following steps are the tedious, annoying ones because all the creative work is done. That is why often bugs will enter in this process, perhaps my tips will help to avoid some:
- duplicate click box CB_1 as many times as needed (here 12), label and position each click box over the appropriate digit
- open Advanced actions dialog box; duplicate action CB_1, change the label to CB_2
- because I used the variable v_current you only have to edit the first decision (Counter): change the statement "Assign v_current with 1" to "Assign v_current with 2" and that is it
- repeat that process (2-3) to create all the advanced actions CB_3....CB_Z; close Advanced Actions
- in the properties panel of the click boxes, change the attached action: because labels of the click box and the action are the same this would be easy.
- test again in all situations to detect possible bugs
This is the first time I tried to explain the way my 'advanced actions' brain is tackling the process, and I do not have any idea if this could help. That is why I really would appreciate if you take a minute to post your comment and suggestions. What do you think about a YouTube video to show how the extra user variable v_current did save me a lot of time while editing the similar duplicate actions for the 13 buttons.