Question on Advanced actions, decision blocks, and two sequential if.
I am trying to create a shared action that I can use to: (1) skip the slide if the slide has been visited, (2) mark the slide as visited, (3) if a condition is true then change the state of an object to state 1 and increment a variable by one but if it is false then change the object to state 2 and not increment the variable.
If the slide has been visited, I want to skip it and not do anything else.
If the slide has not been visited, I want to mark it as visited, and then check a condition, depending on that condition it would do (i) change object to state one and increment a variable by one or (ii) change the object to state two and not increment the variable.
Why?
I asked the user a question, if they got it right I want to tell them that and add one to their score. If they got it wrong I also want to tell them and not add anything to their score. Either way, once I have asked the question and given the feedback, I do not want the user to be able to go back to the question or feedback slide. And I am using the skin viewer navigation. Therefore, I cannot eliminate the back button in those two slides (which would make it much easier).
In a normal programing language I could write:
10 If visited=1 then next_slide (and exit this program);
20 let visited = 1;
30 if answer=correct then xxxx else yyyy;
I cannot figure out how to do this with advanced actions and decision blocks.
Could someone help me on this?
Thanks.
Please start a new discussion because your problem may seem to be the same but it would be easier to answer your question if you could clarify more and show some screenshots. Here are some questions to start with:
- Which exact version are you using as mentioned under Help, About Captivate?
- The easiest way to do what you want is to create a Visited state for the menu button. In that State you can add the checkmark. Advantage: once the button is clicked it will go to that Visited state automatically without needing any supplementary action.
- Since you leave the menu slide, and revisit it later, you need to activate the option ‘Retain State on slide revisit’ in the Properties panel of the button.
Due to your request for an IF action, I suspect that you are using a Show/Hide workflow at this moment. If you insist on using that workflow, I need to know which events you are using to make the check mark visible. You can do that from any slide in the project provided you are doing it with an advanced or shared action. If you want to do it with the OnEnter event of the menu slide, you would need a user variable for each button, which makes it a lot more complicated.
Going two slides further is easy. Use this command:
Expression cpCmndGotoSlide = cpInfoCurrentSlide + 1
Why 1 and not 2? Because cpCmndGotoSlide has an index starting at 0 whereas cpInfoCurrentSlide starts at 1
You question slide is not the default T/F but a custom one? Not sure why…. If you had used a default T/F quiz slide you wouldn’t need to skip the question slide on second visit, because within the same Quiz attempt it would be frozen after the first visit.
The variable tfanswer has the same value as cpQuizInfoAnswerChoice? It is not a Boolean, which would make it a lot easier.
Honestly I believe you are making this all much more complicated than necessary, especially within the limited environment of a Fluid Boxes project. Why do you not use a default T/F question and its feedback messages?
About the Shared actions, and the choice of literals/variables for the candidate parameters, I have been writing several blogs and published videos. You need to be VERY careful with defining literals as parameters. You cannot expect me to give a full course about shared actions here. In the conference I got now a 2 hours workshop, for both advanced and shared actions. Content will be rather limited in such a short time, too bad.
In both questions you asked very important information was missing. You didn’t tell this was a fluid boxes project, which means immediately that there are a bunch of limitations.
Coincidence, I am just busy writing another tip for advanced/shared actions and it is about decisions and their sequence.
The big difference with any programming language – although the actions will be converted to JS on runtime – is that ALL decisions will ALWAYS be evaluated when the action is triggered. There is no way to get out of the action if a condition is met that is true. You cannot nest IFs neither. I have been creating advanced actions since over a decade, but have always found a way to overcome those limitations.
I try to figure out the situation you are laying out, but not sure to understand it at all. The fact that you still keep to the playbar which is only meant for a simple linear course, doesn’t facilitate anything. I never use that playbar, always create custom navigation buttons which give complete control.
Where is that question? Is that on a previous slide or on the slide you are talking about? Impossible to detect this from your description? If it is on the same slide, it is impossible to realize your goal with one advanced action, since you will use only the On Enter slide event. At that moment the question itself hasn’t been answered, so you are unable to use a tracking variable of check the Success/Failure situation.
If the question is on another slide which was visited before this slide, you probably have a tracking variable set up which can be a Boolean, having the value 0 for a failed question and 1 for a correct answer. In that case it would be easy to set up the On Enter slide action with a couple of decisions.
If you can answer my questions, I am 99% sure I can offer you a solution.
You talk about a Shared action (my specialty), which means I also need a full explanation about which flexibility you want for the action? In which circumstances would you use it? That is necessary to make decisions about the candidate (not the compulsory) parameters: variables and literals.
First of all, thanks for such a prompt reply.
I am using two slides. One question slide and one feedback slide. However, I am open to using one single slide.
I am also trying to use shared actions and master slides as much as possible. So that I can later do global changes easier and make the project as small as possible.
The question slide uses a master slide that already has the True False buttons in it. And those buttons have their own advanced action which sets a variable (tfanswer) with the answer given and moves to the next slide. That slide also has an on enter a shared action which checks if the question has been visited before or not and if visited it goes to the next slide. I wish it could skip one slide but do not know how to say go two slides forward. And I do not want to use absolute reference to the slide it would be jumping to because if I ever change or add slides those absolute references would fail.
The answer slide has one object which is a text with two states. Therefore, on enter, I need to use a shared action that selects the appropriate state. That is done by comparing the answer set in the question slide (tfanswer) with the correct answer (a literal that I enter in the shared action; thus, potentially different for each slide). Moreover, at that time I add one to the score and also mark the slide as visited. But I do not want to add to the score if the slide had already been visited and I also want to go to the next slide (skip) if the slide was visited.
I am using the standard skin navigational menu because I have tried using my own and it always looks awful in at least one of the different screen sizes. I am using fluid boxes and the buttons then look either too small or too big in the extremes and they might extend to more than one row. I did not have any of these problems when I was using my own navigation. But I got criticized on how they looked. I also had another problem when using my own navigation. The navigation buttons where on the master slide and I have no way of switching the play button to pause or vice versa when needed. Objects in the master slide do not have an ID and therefore I could not change their state to show play or pause.
With Shared actions I already encountered another issue which I will mention now. In the shared action definition window (where I indicate which parts change and which ones stay fixed and give for those that change a prompt text), any variable or literal appears only once. I have the same literal in three places and the same variable in two places and I wanted one of the occurrences to be “variable” while the others were fixed. But since it only asks once, I cannot do that, and I am not completely sure if the decision I make applies to only one of the occurrences or to all of the occurrences of that variable or literal.
As you can read, I need to learn a lot but I am willing to go through the process. I am not afraid of experimenting and investing time in the process. But I do not want to waste time either. I do want to be able to develop a project which is done correctly and not with patches here and there. Once I am able to do a well done project, the next one should be much easier.
Thanks.
You must be logged in to post a comment.