Look before you Leap - in Advanced Actions

Intro

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. 

Question

 "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

Example

Have a look at this movie to understand better what I tried to achieve. It has only 3 slides: Intro, EnterCode and ShowCode.


Look before...


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?
  1. 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
  2. User wants to change the code and clicks the C-button: event that is different from the 13 previous ones
  3. 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.
  4. User clicks Next to confirm his code: special event, which will cause navigation IF the user has entered exactly 5 digits
  5. 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.

Variables

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:
    v_void

  • To track the number of entered digits for situations 3-5 I need a counter:
    v_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  :-)

Objects

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.

$$v_one$$$$v_two$$$$v_three$$$$v_four$$$$v_five$$

Actions

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

...you Leap


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:
  1. duplicate click box CB_1 as many times as needed (here 12), label and position each click box over the appropriate digit
  2. open Advanced actions dialog box; duplicate action CB_1, change the label to CB_2
  3. 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
  4. repeat that process (2-3) to create all the advanced actions CB_3....CB_Z; close Advanced Actions
  5. 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.
  6. test again in all situations to detect possible bugs

Conclusion

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.




 


9 responses
Lieve:

This is incredibly helpful. Although I already understand how to fumble my way through getting Advanced Actions to do what I want most of the time, I've often wondered how I could reverse-engineer what I've done so I could create a working template - pencil and paper process - for producing a blueprint / flowchart / list of the tasks needed to accomplish my objectives. Your well-thought out brain dump has done just that and I can't wait to incorporate your efforts into my own planning.

Thanks!

Charlie

Charlie, you made my day! I was wondering if what I tried to explain would be understood. I like blogging but this kind of messages is so difficult to transfer because there is no direct contact between me and the reader. Hoping that more readers will follow your example because I'm worried about this post.
Lieve:

You might recall that I was the one who lost all his work because I foolishly cleared my cache before I recovered the data after Cp5 crashed. I suspect the cause of the problem had to do with the way I was constructing an Advanced Action and wanted to know what you thought about this.

I had to associate each click box in the project with an Advanced Action. Nothing too fancy except that the project is a custom-built quiz with four click boxes on each of the forty slide. My clever idea was to build out and Advance Action script using 40 tabs where each tab included a condition that checked for the slide label. I noticed, though, that with that many tabs filled in, the script itself took more than a minute to Save / Update, which made me nervous. And sure enough, it all eventually crashed.

When I re-built my entire project, I limited the number of tabs I used to 10 per script. Each of the 16 scripts then saved fine and the project works well.

In your experience, is it indeed better to limit the the number of tabs used in a conditional script, since Cp5 seems to have trouble with it, and instead, just build more scripts?

It makes sense to me that the logic for handling too many conditional statements could cause problems but I wanted to see what you thought.

Thanks!

Charlie, your last paragraph already answers your question. As a woman, I often trust my intuition :-) And having so many decisions in a conditional advanced actions, seems to me that I'm asking CP to leap up many stair flights every time the action is executed, going up and down several times before arriving at the destination....out of breath. When possible I try to limit the decisions to avoid choking it at runtime. Re-using extra user variables (like the example with v_current which I also used in the Game example) can help reducing editing time for duplicate actions. And you know I'm a labeling freak for the same reason?
I perfectly understand why you tried the action with many decisions, it allowed to apply the same action everywhere, thus avoiding a lot of editing work, duplicating actions, changing ID's... Really hope that in the next release, the developing team will try to make that editing a lot more easier. It would be great if more advanced actions users (and I feel that that user group is expanding) did take the time to introduce feature requests to increment the pressure on the Adobe team.
BTW: did you activate the Generate Project Backup option?
Many many thanks for your tips.Best regards!
4 visitors upvoted this post.