Tip 5: Parameters (Shared Actions)

Intro

First 4 tips in this series were valid for both Advanced and Shared actions. 

This blog is only for Shared actions, which are still not very popular amongst the Captivate developers. In my workshop at the Adobe eLearning World Conference I have demonstrated their power, even for unexpected uses. For each action I develop in my projects I always take a little time to reflect on this question 'Will this be useful as Shared action'? Result is that more than half of my actions end up to be Shared, not Advanced actions. My Libraries with useful shared actions are growing all the time, and have saved me already many hours of work.

In this article I will focus on tips for choosing Parameters to make the shared actions as flexible as possible. When saving an action as Shared action, you get a dialog box where compulsory and candidate parameters will appear:

  • Compulsory parameters: include all objects, audio clips, states... which you have in the advanced action dialog box, with the exception of literals and variables. You recognize them by the appearance of a yellow exclamation sign. When you add a description to such a line and indicate something as placeholder for the parameter the yellow sign is replaced by a green checkmark.
  • Candidate parameters: are the literals and variables which you find in a condition, or in commands like Increment. They get a green checkmark, but by using the checkbox you can convert them to parameters as well. 

Here is a screenshot of the dialog box for a toggle button. You'll see the compulsory and candidate parameters.  Description for the compulsory parameters has not yet been typed:

General Tips

Using several instances of one shared action to replace duplicate advanced actions leads normally to smoother projects, less risk of choking Captivate and even lower file size. However it is important to keep the number of parameters to assign on each instance not too high. Personally my goal is to have a maximum of 6-7 parameters. If you really need more of them, but appreciate the ease of transferring shared actions to new projects, remember that you can use each shared action as template for advanced actions. You can use that knowledge to create duplicate advanced actions if the number of parameters is too high. Labeling (see Tip 1) remains very important as well, because of the filtering (Tip 2) which is possible in the dropdown lists for parameters. You'll find some more tips below for the two types of parameters.

Compulsory parameters

Depending on the action using those parameters, they are either very specific (only one type) or they can be flexible and cover more than one type. Examples:

Show/Hide actions: they can aim at lot of object types. All graphics (bitmap or SVG), video, but also audio objects (invisible objects which have audio attached), learning interactions, but also Groups! These are probably the most flexible actions, and you may consider to replace a multistate object approach by Show/Hide for that reason.

Change State: not so flexible, they need always two parameters which are the multistate object and the state. Whenever possible try to use 

Go to Next State/Go to Previous State: you only need the multistate object as parameter

Assign can be used with 0, 1 or 2 parameters. You need 0 parameters if using two variables which are not defined as parameters, 1 if you have a literal which is no parameter or one variable defined as parameter, 2 if you have both literals/variables defined as parameters. 

Toggle: can only be used for Boolean variables, better choice than Assign because you have 0 or 1 parameter (the variable which could be defined as parameter).

Play Audio: needs an audio clip as parameter.

Apply Effect: only the object or group to which you want to apply the effect can be a parameter, not the effect itself. In most cases you'll want to use a custom effect to have the correct setup parameters.

Candidate parameters

Candidate parameters are variables and literals.  They appear in conditions, both for IF and WHILE setup, but also in the commands Assign, Increment, Decrement, Expression. 

Variables

If a variable in a shared action is not defined as a parameter, it will automatically be created when you import the shared action to a new project, including its Default value and description. One of the shared actions in my actions library is meant to avoid having to create much used variables in new projects. See this screenshot:

I also use that action as template for the many Reset actions needed On Enter for slides.

When you define a variable as parameter, this automatic creation will not happen!

Before defining a variable as parameter, you need to check if that variable is used multiple times in the action. Know that when assigning a variable to the parameter, it will replace that variable wherever it has been used in the action. I will try to explain by an example. If you ever created an advanced action for 'Forced View', where the appearance of a Next button is postponed until all clickable objects on the slide have been used at least once, this action for the first clickable object will look familiar:

In this project, the first clickable object is SV_Decision.  That object has a custom state showing Info, and acts as a toggle button. On a second click the Normal state will re-appear. Its tracking variable is v_1, a Boolean, which will get the value 1 on each click. On the slide 4 of those buttons need to be clicked.  For the three other buttons both the name of the button and the tracking variable need to be edited in a duplicate advanced action. The second decision checks the 4 tracking variables, shows the Next button if all have the value 1.

In this setup you cannot convert this action to a shared action. It would need 3 parameters:  the Next button, the button itself and the tracking variable. But if you replace the first variable by the second variable, that will also happen in the second decision, thus leading to a non-functional second decision where only 3 variables are checked. Have a look at this action:

In this action 2 extra variables are used:

  • v_counter: will be incremented only on the first click; that makes the third checking decision easier, and the tracking variable v_1 which appears twice can be replaced by any other tracking variable.
  • v_max: instead of the literal '4' this new variable makes the action more flexible. It can be used for any number of clickable objects on the slide. The value of v_max (4 in this case) can be assigned either directly in the Variables dialog box, or with the On enter action of the slide. You could also define that variable as parameter if you prefer.

Literals

Be very careful with literals as parameters. My replacing it by a variable in the previous example gives you a possible workaround. Especially if you have multiple literals in an action, defining them as parameters can lead to issues.  Look at this variant on the same situation described above:

It could be possible to define the value '4' in the last decision as a parameter, so that you can use the action for any number of clickable objects (alternative for the variable v_max). However, if you should define the '1' as parameter, changing it in an instance of a shared action would lead to changing it in 3 locations of the action! 

My recommendation: avoid defining literals as parameters!




Who is afraid of ... Shared Actions - Crash course Introduction

For any Captivate user, new, intermediate or advanced.

Even if you are very new to Captivate, continue reading!

Contrary to Advanced Actions and JavaScript, Shared actions can be USED without needing to write out or edit scripts, nor to create variables. You don't need to be able to assemble an engine for your car to be able to drive, isn't it? What do you need?

  1. One or more shared actions created by a friend/colleague who is more advanced with Captivate
  2. To understand what a  'parameter' is (new term in your personal Captivate glossary)
  3. To learn how to add shared actions to your project, slides and interactive objects. Description and name of the shared action will help you (contrary to advanced actions).
  4. To choose the parameter values based on their descriptions. Automatic filtering by Captivate is a big help.

You read the introduction to a short ourse for adventurous newbies, including:

  1. A demo project with 4 useful interactions. All interactions can be realized using shared actions without having to create variables nor scripts.
  2. Explanation of the term 'parameter'

The course for newbies has TWO lessons. Each lesson comes in two 'flavors' to adapt to your taste:

  • Short video
  • Step-by-step text

To facilitate your learning/understanding, you'll get a start project  to practice the workflow.  You will also be able to use your personal project for the second lesson.  Both lessons are about one of the 4 interactions in the Demo project (see below). Depending on the 'welcome' by the community, may repeat this workflow for the other interactions or even for a game like  MatchStick game

Demo project

Watch this project, which includes 4 typical interactions:
  • Dashboard interaction (menu going to 4 chapters)
  • Slideshow
  • Click/Reveal
  • Toggle buttons

I used design elements from the new Quick Start Project ‘Diverse’. You can open the demo project using this link:

UsingSharedActions

Or watch it below  (fixed resolution):



What is a Parameter (in shared actions)?

This is my definition: a parameter is an ‘item’  replaceable by another item when you (re)use the shared action either in the same or in another project. That ‘item’ doesn’t always have a fixed type! It depends on the used command. Look at a some examples for clarification:
  1. Command Jump to slide: needs one parameter which is the slide. It is clear that you cannot change to another type of item than a slide.
  2. Command Change State of…: needs two parameters, first is the multistate object, second is the state you want to show. The first parameter has to be a multistate object of any type: shape, caption, button (for custom states), image, video, animation… Second parameter needs to be a state of that multistate object.
  3. Commands Hide/Show: need one parameter. Anything that can be shown or hidden is possible: shape, caption, button (for custom states), image, video. But also groups are possible! Look at the practice session below to see how this extends shared action functionality beyond what you are used to.

You may skip the explanation about the two types of parameters and go directly to the first lesson if you don’t like definition texts. Knowing the differences between parameters is not so important in this crash course, . BTW: the terms ‘compulsory’ and ‘candidate’ are just my personal choice, not official terms.

Compulsory parameters

All the items mentioned in the previous examples are compulsory: you will always have to choose them in any shared action.  Even though some will be the same in all instances of that shared action.

Candidate parameters

You probably know the command ‘Assign’ to store a value in a user variable or a system variable of the category ‘Movie Control’. A variable when used in a shared action can be a parameter, but it is not compulsory. If it is not a parameter, here is a rather unknown secret: importing the shared action in a new project will automatically create that variable, with the same name, description and value as designed originally. 
In some circumstances it is necessary to define the variable as parameter. You will see an example in the practice session for the toggle action.

In a conditional action you can have another candidate parameter, the ‘literal‘. Example: you want to limit a number of attempts by the learner to a maximum of 5. If you want to be able to edit that maximum number, you could define the literal as a parameter. This can be a bit tricky, but is beyond the scope of this basic blog.

Advanced to Shared Action: Step-By-Step (micro-navigation showcase)

Intro 

After the introduction to Micro-Navigation I explained how to use it for forcing the first view of a slide, and for playing an audio file on first visit. When looking at the resulting advanced actions they are pretty similar in both posts. Moreover you probably will want to use the action on multiple slides in the course, and maybe also in future courses. That sounds like a perfect scenario for conversion of the action to a Shared action. I have been blogging already several times about Shared actions. In the present article I try to explain how to reflect on the use of parameters. Static objects need to be parameters as are states and groups, I label them as 'compulsory'. But Variables and Literals are 'candidate parameters', a well-founded choice for change them in parameters,  can save you lot of time later on. Consider it a good practice example.

Analysis

When comparing the two advanced actions created in the mentioned articles, there is a small difference: the first decision (which is a standard action) has one command extra in the second advanced action (for Audio). For the ForceAct, the number of seconds to be jumped over is directly entered in the Expression command, for the SkipSlideAudio, Assign is used to store the number of seconds in the user variable v_skip. Both versions work well, but personally for a shared action I prefer the one with the extra Assign command.

What are the parameters for the shared action?

For the first decision (labeled Always in both advanced actions):

  •  'Assign v_skip with 16.5': this first command has two candidate parameters, the variable v_skip and the literal 16.5. The variable can be reused on each slide where the action is needed. Both advanced actions used the same variable in the interactive movie. There is no need to promote that variable to a parameter in that case. However the literal '16.5'  is the number of seconds to be jumped, will have a unique value on each slide, it has to be promoted to a parameter. Parameter 1 = literal. You have to be careful with literals: double-check that the same numerical value is not used anywhere else in the action. In this example there is a second literal '1' in the second decision, Increment command. It has to be different from the first parameter, which is the case.

  • 'Expression v_skip = v_skip * cpInfoFPS': the user variable v_skip is no parameter (see above). The system variable cpInfoFPS has never to be replaced by another variable, will be no parameter neither.

  • 'Increment v_visit by 1': the user variable v_visit has to be unique for each slide, as you can see in the action SkipSlideAufio where another variable has been used. This means that we have to promote that variable to a parameter, parameter 2. The literal '1' however will always be the same, no need to turn it into a parameter. We already double-checked that the literal in the first decision was different from 1.

The second decision is conditional:

  • 'IF v_visit is greater than 1': has two candidate parameters as well. We already indicated that v_visit is a parameter. The literal in this case will always be 1, will never be changed and need not to be a parameter.

  • 'Expression cpCmndGotoFrameAnd Resume = cpInfoCurrentFrame + v_skip': has 3 candidate parameters. Above was already decided that v_skip can be reused on each slide, and the system variables will always be the same.

Shared action Skip_Frames

When you choose to save any of the advanced actions used to skip frames as a Shared Action you'll see that all possible parameters are marked as OK. The reason is that there is no compulsory parameter in this action:

As a result of the analysis above, we need to mark to items as parameters: the tracking variable and the number of seconds to be jumped on later visits. The result will look like this. It is important to give a good description not only for the shared action but also for the marked parameters:

You can assign the shared action to all the slides where you want to jump frames on a later visit. You only have to define a tracking variable and estimate the number of seconds to be jumped. Here is one example setup for the slide where audio had to be jumped on later visits:

You can check in the Library for the Usage of the Shared action, much easier than for advanced actions.

Using Skip_Frames in future projects

Want to reuse this action in other projects? The workflow is described in an older blog post. Short summary:

  1. Use File, Import, External Library and point to the project where you created the shared action.
  2. Library will be opened in a floating panel. Look for 'Skip_Frames' in the Shared Actions subfolder and drag it to the Library of the new project.
  3. Because v_skip is not a parameter in the shared action, it will be created automatically, including the description.
  4. You have to create a tracking variable for each slide to which you want to assign the shared action, and define the duration in seconds to be skipped. Ready!