Tip 4: Decisions (Advanced/Shared Actions)

Intro: Decision (tab)

The Advanced Actions dialog box in its default setup for a new action, shows  3 decisions with the generic names 'Untitled-1', 'Untitled-2' and 'Untitled-3'.It is possible to replace the generic names of course. In this screenshot they are marked by a red rounded rectangle. 

On top of the decisions to the left you see three buttons, which allow to Add decisions, Remove or Duplicate a decision.  There is no real limit to the number of decisions within one advanced/shared action. 

In the center above the decision names you find two buttons (blue rounded rectangle in screenshot above) which allow to change the sequence of the decisions by moving them to the right or to the left. That sequence is very important! First rule to remember when starting with Advanced/shared actions:

"All commands (actions) within an Advanced or Shared actions are always executed when the action is triggered. They are done always in the same sequence: top to bottom within a decision, left to right in the decision sequence."

Workflows which exist in most programming language to skip part of a long script do not exist. Forgetting about this first rule often leads to logical bugs!

Each decision can be converted into a conditional one by checking the option 'Conditional tab'. The word 'tab' is used there, but I largely prefer the original name 'decision' because Captivate has tabs in many locations, not only in the Advanced Actions dialog box. For a conditional decision, you have the choice between the classical 'IF-THEN-ELSE' which has two sets of commands (THEN, ELSE). One set be will chosen based on the result of the condition.
The WHILE condition leads to an infinite or finite loop. The set of commands will be executed after 1 second, based on the condition:
I would like to offer some tips now both to avoid problems and to streamline the choice of decisions taking into account the limitations mentioned before.

Tip 1: Combining standard and conditional decisions

This tip is based on my experiences with consultancy jobs and answering on the forums.

When starting to create advanced actions it often happens that too much commands are pushed into one conditional decision. I recommend to reflect: which of the commands (actions) have to be done independently of the condition? Those commands will appear in both  THEN and ELSE sections. In that case, take them out and put them in a separate non-conditional decision. 

Same recommendation when using multiple conditional decisions, if some commands appear in all of those conditions.

Example

This scenario appeared several times for debugging on the forums: 'Looping through a number of images  with their text, and showing a Next button after the first loop'.  The loop in this example is done with show/hide, not with a multistate object (which is easier however). Look at the original advanced action, meant for 3 images:

The second/third image and text are hidden in Output. The first image and text are visible. The result of this action is that the loop will not work, that each click on the button will always show the third image, while the counter will indeed loop and the Next button will appear as wanted. Reason is that the last conditional decision overrides the other decisions. Compare this with this solution:

In this action:

  • Texts and Images were grouped, to allow taking out the Hide actions from the conditional decisions.
  • A non-conditional decision was added before the conditional ones to hide the groups before the showing the text/image corresponding with a specific variable value. Moreover the (absolute) Assign command was replaced by Increment.
  • The conditional decisions show text, image. The last one needs also to show the Next button and reset the counter to its original value, which is 0. In that case you need Assign of course.


Tip 2: Multiple conditional decisions - make them mutually exclusive

When you have multiple conditions decisions in sequence (remember the sequence rule), avoid using the ELSE parts. You'll have less possible problems when using only the THEN part and write a conditional decision for each possible situation. If you use the THEN parts, there is a big chance that a later decision will overrule what has been done in the previous ones.

Eventually it is possible to use an ELSE part, but only for the last decision. You need to double-check if that THEN part will not mess up with previous decisions.

Example:

Using the same situation as for the first tip, there is no way to use the ELSE part of the decision 'Second' to replace the decision 'Third'.  The complete action would then look like this:

The result would be that the First decision would never be done, the second image/text never pops up and the Next button will appear after having viewed only the first and third image.


Tip 3: working with Tracking Variables

The first tip already showed how dangerous it is to change the value of a tracking variable within a conditional decision, if you have more than one of those decisions. In most cases it is safer to keep the value change in a non-conditional decision. You are probably aware of the three ways to attribute or change the value of a variable:

  • Assign: which I label as the 'absolute' way, and is valid for both strings and numerical values.
  • Increment/Decrement: often used when you also need a counter.
  • Toggle: typical for a Boolean variable, which is used for an On/Off situation. 

Here are two situations where you will need to have the variable value change within both parts of a conditional action (THEN and ELSE):

3.1 Toggle button action

Such an action will often have only one conditional decision and uses a Boolean variable for tracking. Have a look at this script, which will show/hide an object:

3.2 Non-eternal loop (WHILE)

Such a loop needs to have a way to stop looping. That is done with a tracking variable which needs to be changed within the actions which need repetition. Here is an example from a dice game. The dice number (random) is stored in a variable, and another variable stores the number of stairs which need to be climbed. The screenshots shows only the While decision of the action.




About State Commands and a Progress Bar

Intro

Recently a user posted a question about using the 'Go to Next State' command used in Advanced actions. You can read our discussions in this thread.

Time to write out some tips for multistate objects. This blog wants to give an answer to the user, and has its focus only on that solution. I plan to publish more about the basics of states and their commands later on.  To me personally the introduction of multistate objects is in the list of my favourite features in Captivate, closely following Shared/Advanced actions and Shape buttons.

Example movie

Watch this published rescalable interactive movie. The second slide has three shape buttons, navigating to three slides where you can read and confirm reading, or click hotspots, or answer questions. Each of your actions will result in changes to the progress bar on that second slide. Beware: whenever you have clicked an interactive object it will be disabled!


Terminology Multistate objects

InBuilt States and Custom States

You can add custom states to any object, static or interactive.  In those states you can have many object types: graphics, video, audio... but no interactive objects nor hyperlinks.  The Normal state is the default state, which will always appear unless you have changed to a custom state using a command (in a simple or an advanced/shared action). You have a lot of freedom for custom states: contrary to the InBuilt states, nothing is locked tto the default normal state. You can have objects in a custom state that are in a totally different position from the Normal state. Custom states are always controlled by commands, not by a situation. If you want a custom state to remain for future visits to the slide where the multistate object is sitting, you need to check the option 'Retain state on slide revisit'.

Inbuilt States exist for these object types:

  • All types of buttons Shape buttons, Image buttons, Transparent buttons and Text buttons.  You have four of those styles: Normal, Rollover, Down and Visited. The first three are part of the button style.  You don’t have the same freedom for location of those states, they are locked to the Normal state (look for the Lock indicator).
  • Drag sources and Drop targets on a D&D slide. For more information see: InBuilt states for D&D

I will only talk about shape buttons here. Contrary to custom states Inbuilt states appear automatically in a situation: when not hovering over button (Normal), when hovering over button (Rollover), when pressing button (Down) and when after clicking/tapping (Visited, if it has been created). You can only control Normal and Visited by a commandif necessary, not the Rollover/Down states.. 

State commands

These commands are available both in a simple action (dropdown list in Actions) and in the Advanced Actions dialog box, to be used in advanced or shared actions:

  • Change State of …. to 
  • Go to Previous State  …..
  • Go to Next State ….

When you use these commands as a simple action, from the dropdown list inthe Actions tab, they can only be applied to multistate objects on the same slide as the event triggering the action (Slide event, interactive button events) The Hypelink even thas only the first command (Change State). 

If you insert one of the commands in an advanced/shared action they seem to be able to apply also to multistate objects on other slides. That is indeed the case for the ‘Change State’ command, but is NOT functional for the commands Go to Next/Previous States. I have logged this as a bug, because you are able to choose multistate objects on other slides, however without any effect. That was the reason of the question in the forums, described in the Intro. 

You could see in the Example movie that I have a workaround. How?

Solution with variable and While loop

YOu will need one user variable v_counter,  to track the number of clicks while being on other slides than slide 2 with the Progress indicator SS_Progress (a multistate object). This progress indicator starts with a Normal state which is a shape with Alpa and Stroke = 0.

That variable starts with a default value = 0. The clicks on the OK buttons in slide 3, on the hotspots in slide 4 and on the correct answers in slide 5 do increment the variable, besides other commands. 

When returning to slide 2 (which has the progress indicator) using the shape button ‘Back to….’ (is on the used content master slide) an advanced action On Enter for that slide is launched, using the While loop:

Example: if the user has performed 3 actions on any slide, v_counter would be 3. The while loop will then be done 3 times, which means the 4th state of the progress indicator will appear. At the same time, the variable will be set back to 0 at the end of the loop. The learner can continue to visit another slide, and the variable is ready to track again.

This is just an example, many variations are possible. Maybe you want to allow visits and actions to consecutive slides before returning to the main slide, this can easily be achieved. Or have feedback appearing on the main slide after all slides have been visited, based on the obtained progress.. 

More?

I didn’t explain all actions in this post. The slide with the hotspots is based on a recent article about Hotspots in a 2D image.

Maybe you are wondering if I used the Visited state or a custom state for the OK buttons (slide 3) or the hotspots? What the quickest workflow is to create the states for the Progress bar? Did I use shared actions or advanced actions, and why did I choose that way? Why did I disable the buttons? If you are interested, I can explain… on demand. 

Timeline - Advanced Workflows

Intro

At the Adobe Learning Summit (Las Vegas - 24 October 2017) I was invited to present a session about the Timeline for advanced workflows. It is one of my favorite subjects (bit below my most preferred topic 'Advanced/Shared actions') because I see so many questions on the forum that are due to not or misunderstanding the Timeline functionality.

Tutorial

For those users who were not able to attend ALS2017, I converted my Captivate presentation into a self-paced learning tutorial.

It has been published as Scalable HTML5 project. Autoplay is turned off (not allowed in some OS), just click the triangle button to start the movie (with narration). You can watch it directly on any device from this link

Or you can watch it below:

The tutorial has at its end links to different published movies, examples using the described features of the Timeline. Several features are used in the movie itself: skipping audio on the dashboard (second slide) on later visits, Delay commands for automatically building lists on different slides. Be sure to use the circular button at the bottom to show the value of the system variable cpInfoCurrentFrame, to discover (some of) my secrets.

Feedback

I would appreciate feedback and welcome questions. Are you interested in learning more about the examples? Are the mysteries not totally clear to you? Please let me know... If you want a copy of the handouts created for this presentation, send a mail to info@lilybiri.com.