Skip to main content
Inspiring
April 14, 2018
Question

Shared Action confusing two variables

  • April 14, 2018
  • 3 replies
  • 470 views

First of all, I'm new to using shared actions.

 

I created a multiple choice quiz using advanced actions. The quiz allows two tries to give the correct a response.  The correct response is the selection of 2 out of 4 possible options.   The correct response is calculated by adding up points that increment a Score value when you select the right options.  If you select a wrong option or deselect a right option the Score value is decremented.  When the quiz is judged  (by clicking a s Submit button) a correct response will have a score equals 2.  After the first try a feedback caption tells you to try again. If after the 2nd try the score is still not equal to 2  you are given a final feedback message.  The judging is done with conditionals and decision blocks.

 

This works fine as an advanced action but breaks as a shared action.  What's happening is that the Tries variable seems to be using the Score values for the number of tries.  In other words if I set the correct score to 3 and make sure that the appropriate selections increment the score correctly, if I get it wrong on the first try and right on the second try it is judged incorrect until I click the submit button a 3rd time.   If I set the score to 4, it will take me 4 tries and so on.

 

This is my shared action. I'm assuming if you don't check off a parameter it will use what was in the original advanced action.  You can see Score Value is set to received a new value per quiz. In the image it is 2 but when I set it to something else, the Tries seems to take on the same value.  What's up with that?

This topic has been closed for replies.

3 replies

Inspiring
April 15, 2018

Problem solved.  As Lilibyri pointed out, my mistake was in using a literal as a variable.  Since I need to change the target score by which the quiz is judged as correct from one quiz to another, the fix was to create a variable TargetScore and assign it a value with a slide action  (must be assigned outside of the advanced and shared action). Then in inside the Submit action I compare the accrued score to the value of TargetScore  So far it works the way it should.

Lilybiri
Legend
April 15, 2018

Sorry, you are repeating the same answer, whicch solves your problem but is not an answer to the question about confusion between the two variables. A literal is a literal, not a variable, it can be defined as a parameter, same wya as a variable can be defined as a parameter. The problem is that you the value of the lteral which you wanted to define as parameter has to be UNIQUE in the adction, and that was not the case in your example.  the value of the leterals was 2 and it was used at least twice in different situations. I will lock this thread.

When another user looks for a similar problem, your answer will not help them. For that reason it cannot be a 'correct answer'. What you did is simplifying the logic, which solved your problem, but is not answering the original question about confusion.

sabre123
Participating Frequently
April 14, 2018

You say, "the Tries variable seems to be using the Score values for the number of tries."

You should be able to determine if that's happening or not by performing some simple debugging techniques. For instance, add some debug text boxes on your question page and set them to display your counter and other variables that you suspect are not working correctly. You should be able to see right away what's going on once you start selecting an de-selecting answers and the submit button.

Lilybiri
Legend
April 14, 2018

I would need to see the original advanced action because the screenshot you show is not sufficient, moreover I suspect more parameters are not visible. The problem you could have is that you used the same literal twice in the advanced action from which you created the shared action. That is one of the problems I mentioned in my webinar, and recently also gave as feedback to one of the users contacting me for a similar problem.

I also see a Next Graphic and a Next button? Can you explain? In my webinar I explained that a shared action is only efficient when you don't have too much parameters. It those two items are meant to result in one Next button, please replace them by a shape button filled with the graphic.

Inspiring
April 14, 2018

Thanks for your reply.  Here is the shared action with new parameters and following that are the 5 decisions making up the original advanced action used to make the shared action.

Lilybiri
Legend
April 14, 2018

I am on a small screen, bit fuzzy when I zoom in. Next time, can you please use the Preview button (first button top right of the AA box) to give a complete view of all decisions?  That Preview button looks like an arrow. Have a look at my blog post:

Advanced Actions Dialog box in Captivate 2017 - Captivate blog

I see indeed that you use the literal '2' which is defined as a parameter in the shared action, at least once for checking two variables. That is the problem. Captivate cannot 'guess' which one you changed, when you change the value that is a parameter to another value. You will have to rethink the logic of this action. I am not sure it will be appropriate for a shared action. It is too hard for me to screen the full action due to those tiny screenshots, but be sure, have a lot of experience with shared actions, the cause of your problems is not in the variables but in the literal defined as parameter.

This is the shorter interactive version of the presentation I used during the webinar:

SharedActions