On the Captivate blog recently two tips for using advanced actions were published: Few tips on Advanced actions. If you have been watching my blog, you'll know that advanced actions is my favourite subject. And after reading the Captivate blog posting, I felt some more details about the first tip would be welcome. If that tip was perfectly clear to you, please do not continue reading this post.
The forementioned tip is about checking the possible emptiness of a variable by comparing it with an empty user variable, which is indeed the proper, even the only way. The basic reason is that in the simple Captivate scripting language a string shouldn't be included in double quotes as is the case in other scripting languages, at least not when the string is only one word. If it contains more than one word, double quotes will be automatically added by Captivate, no need to type them. Here are some examples of conditions (words starting with v_ are always user variables in my self-imposed scripting grammar):
- v_counter is equal to 12
- v_name is equal to Lieve
- v_score is greater or equal to 20
- v_name contains Lieve
- 1 is equal to 1
- Lieve is equal to Lieve
Those examples work perfect and here quotes are totally missing, there is no visible difference bewteen a string and a number. The two last (absurd) examples can be used to create a decision to simulate a standard action that has to be combined with conditional action(s) as explained in the second tip of the Captivate blog. A couple of weeks ago I published an article about this workflow:
The tip about the empty variable is illustrated by a user variable associated with a Text Entry box. For those users who did try out advanced actions in the previous version (Captivate 4) I thought it appropriate to explain the changes concerning Text Entry Boxes and associated variables. This change has been puzzling me when I started with advanced actions in Captivate 5, and maybe I'm not the only one ;)
In Captivate 4, when you create a Text Entry Box, it will be labeled by Captivate like any other object. The default label for the first created Text Entry Box is TTextEntryItem1. Immediately an associated variable is provided too, and it gets the default label TTextEntryItem1Var. That is great, because you can insert the variable later on in a Text Caption. I include a screenshot to show those default labels. Personally I will always attach a more significant label, you know me already as a labeling freak.
In Captivate 5 however, both the Text Entry Box and the associated variable will get the same label. Have a look at the second screenshot with a partial view of the Properties panel. I highllighted (in yellow) both the TEB-label and the label of its associated variable. If it is the first Text Entry Box, both object and variable will get the default label Text_Entry_Box_1. Although I'm always complaining about the fact that so many different ID's are needed in a CP-movie, I do not really like this situation where one label covers two different 'objects. When both are used in advanced actions it can be confusing. Perhaps an example can better explain my "dislike":
Three statements of an advanced action:
1. Assign Text_Entry_Box_1 with Lieve
2. Apply Effect Text_Entry_Box_1 Fly In From Bottom Left
3. Assign Text_Entry_Box_1 with "Lieve Weymeis"
In this action the first statement will give a value to the user variable Text_Entry_Box_1. If you have a Text Caption visible with this user variable inserted, you will see the content (Lieve). The second statement has the Text Entry Box flying in. Later the user will type an entry for the TEB and the variable Text_Entry_Box_1 will change to this new value. In the last statement the content is changed again, and double quotes will be inserted by Captivate because there are two words. Perhaps you'll understand now why I was confused. But luckily, in the Properties panel of the Text Entry Box you can immediately create another user variable: in the second screenshot watch the green highlighted X which will open a small dialog box where you can enter a new variable name. This workflow however is not possible in Captivate 4, where you have to create the user variable first (in the Project, Actions dialog box) before being able to associate it to a TEB.
BTW will publish shortly another article about Advanced actions, to create a game control panel. And it has some examples of standard actions combined with conditional actions. Watch this blog, I'l post the movie to play with and a link to the article.