• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

advanced action with variables to identify state of objects -> 2 correct solutions

Community Beginner ,
Jan 12, 2023 Jan 12, 2023

Copy link to clipboard

Copied

I already had help with creating a little test with objects of different states, that can be identified with variables (https://community.adobe.com/t5/captivate-discussions/bedingte-erweiterte-aktionen-mit-mehr-als-2-sta...), I hope the next step can also be done:

 

Imagine an equation like:
[A] = [B] x [C]

 

A, B, C are objects with 3 different states (each of them: state 1 = A, state 2 = B, state 3 = C). By clicking on the objects, the states change. By clicking on "Send", the object's states shall be checked ("right" oder "wrong") - for all 3 objects at the same time.

 

I have tried without success to create an advanced action that allows to have either B oder C in object 2+3. The equation is correct in both forms:
A = B x C as well as A = C x B

 

I am curious to learn how this can be fixed. Thanks for your ideas!

Views

926

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Advisor , Jan 13, 2023 Jan 13, 2023

If you are using the same setup as in the previous post that you mentioned, and you want the learner to click through the cards until the value equals 6, you should be able to perform a check for

 

myVar * myVar2 == 6

Or you need to introduce a third variable (myVar3) for the answer card and have the same setup as the other two with the incrementing variable matching the states.

Then you would check for

myVar * myVar2 == myVar3

Votes

Translate

Translate
Community Expert , Jan 14, 2023 Jan 14, 2023

To calculate in Captivate you need to use the Expression command. It has the four main mathematical operators.

Some examples:

Expression.PNG

Besides +, you have - * and /

I added the last line to show that calculation can be powerful: that command will skip 60 frames (2 seconds if the default 30FPS is kept) on the timeline. Check out the end of this thread, where I took advantage of that type of workflows:

https://community.adobe.com/t5/captivate-discussions/how-to-resume-audio-from-where-it-last-stopped/td-p/13478947

...

Votes

Translate

Translate
Advisor ,
Jan 13, 2023 Jan 13, 2023

Copy link to clipboard

Copied

If you are using the same setup as in the previous post that you mentioned, and you want the learner to click through the cards until the value equals 6, you should be able to perform a check for

 

myVar * myVar2 == 6

Or you need to introduce a third variable (myVar3) for the answer card and have the same setup as the other two with the incrementing variable matching the states.

Then you would check for

myVar * myVar2 == myVar3

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

Hi and thank you very much again for your help!

 

How can I calculate with variables? Within the advanced actions, I only have these options (see screenshot):

=

>

<

includes

 

Maybe my Version 2019 (11.5.5.553) is not capable to do this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

To calculate in Captivate you need to use the Expression command. It has the four main mathematical operators.

Some examples:

Expression.PNG

Besides +, you have - * and /

I added the last line to show that calculation can be powerful: that command will skip 60 frames (2 seconds if the default 30FPS is kept) on the timeline. Check out the end of this thread, where I took advantage of that type of workflows:

https://community.adobe.com/t5/captivate-discussions/how-to-resume-audio-from-where-it-last-stopped/...

 

You are showing only the logical operators for a condition. Bit amazed that you always ask for JS whereas you didn't yet explore the possibilities of the point-and-click actions in Captivate.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

Thank you so much! Indeed, I did not know about the "expression"-command and calculator-functions. Can you recommend a good User Guide where all these possibilities are explained? I have not found this in https://helpx.adobe.com/de/captivate/using/advanced-actions.html .

 

PS: What does "JS" mean? My English is not so good...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

You can write in German, sorry that I didn't write in Goethe's language which I understand perfectly but German grammar is bit rusty. Dutch (I am Flemish) is my mother tongue.

JS = JavaScript. Captivate's advanced and shared actions are converted to JS on runtime.

The Help documentation is very limited, that was the reason I started blogging about Advanced actions in 2009 and still continue doing that. Use the tag 'Advanced action' or 'Shared action' (much more powerful) in the Search function:

https://blog.lilybiri.com

You will find a lot of use cases, and the Expression command rarely is missing in the example scripts.

The Variables category Movie Control is something special, because changing a variable is in reality leading directly to an action. Download the descriptive table from this blog post:

https://blog.lilybiri.com/discover-slash-use-captivates-system-variables-part-1

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 15, 2023 Jan 15, 2023

Copy link to clipboard

Copied

Thank you very much! This was more help than I expected 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2023 Jan 15, 2023

Copy link to clipboard

Copied

I was hesitant because you wanted only JavaScript, and there are some good experts for JS here in the forum. Personally I only use it when Captivate cannot achieve what I want to do, reason why I specialized in Advanced/Shared actions. Multistate objects are for sure one of the best features added.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 16, 2023 Jan 16, 2023

Copy link to clipboard

Copied

I guess I missed the part where OP requested JavaScript.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2023 Jan 16, 2023

Copy link to clipboard

Copied

See reference to older post, this was meant as a follow up to that one - with JS.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Jan 16, 2023 Jan 16, 2023

Copy link to clipboard

Copied

I did look at the older post before responding to this one. It was one where I helped out as well but I did not offer a JavaScript solution nor was one requested. That is why I did not offer a JavaScript option with this thread either.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 22, 2023 Feb 22, 2023

Copy link to clipboard

Copied

Hi,

 

your answer worked fine with a simple calculation (3 buttons), so I tried the same with 4 buttons. However, I failed...

 

The variables for the 4 buttons have the value "1".

Each button has an advanced action to change state and variable, I have added the screenshot of the advanced action für button "Druck_TF".

 

There are many right answers:

A x B = C x D

or

B x A = D x C

or

C x D = A x B

...

 

If the 4 states of the 4 buttons would set the variables correctly, and the "Senden"-Button would calculate properly, both sides of the "=" should be equal to "5" (1+4 or 2+3).

 

Any idea what I got wrong? Thanks a lot for your help!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 23, 2023 Feb 23, 2023

Copy link to clipboard

Copied

LATEST

Why do you use a multiplication instead of a sum of the variables? 

1*4 = 4 and 2*3=6

Sorry, it is correct in the advanced action, will try to set up a project to find the logical bug.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Help resources