Copy link to clipboard
Copied
Hi,
I am using Captivate 8, and trying to create an advanced action involving a hotspot question.
Currently, I have:
If (all conditions are true):
If cpQuizInfoAnswerChoice [is equal to] 0 ((literal -- as generated by Captivate)
Then:
Execute Javascript: window.cpAPIInterface.setVariableValue("cpQuizInfoAnswerChoice", "Correct");
Else:
Execute Javascript: window.cpAPIInterface.setVariableValue("cpQuizInfoAnswerChoice", "Incorrect");
(FWIW, I am confident in the "Then" Javascript, having used this script in other, similar conditional advanced actions.)
However, regardless of whether cpQuizInfoAnswerChoice is 0 (i.e., correct) or appears blank (i.e., incorrect), the advanced action always returns the If condition (whether or not the parameters are met).
I suppose one way of solving this would be to figure out what is generated by Captivate for cpQuizInfoAnswer when the question is incorrect, but cannot seem to find it; another way would be to create a conditional advanced action based on whether the question was marked as Correct or Incorrect, but this does not seem to be a readily available option.
I would appreciate any suggestions on how to get around this issue!
I haven't tried custom hotspots, but will for future projects -- this has been more trouble than it's been worth.
I did end up creating multiple hotspots, with the first one (=0) being a "dummy" and the second one (=1) being the correct answer. Then, I created my conditional Advanced Action to return "Incorrect" if the answer is 0 or null (since the system finds them equivalent), and "correct" if the answer is 1.
Thank you for all of your assistance with this, Lilybiri!
Copy link to clipboard
Copied
Could you explain in normal sentences what you want to achieve? Quizzing system variables are normally read only, I doubt very much that you were ever able to change the value of such a variable using conditional advanced actions. I didn't check if it is possible with JS however. The variable cpQuizInfoAnswerChoice is reused after each question slide. I blogged once about this variable:
Secrets of cpQuizInfoAnswerChoice and.... - Captivate blog
Sorry, I didn't treat it for Hotspot question slides, because personally I will never use the default Hotspot type included with Captivate, but create a custom hotspot slide. The default one is too limited for my taste.
Tried to find out how that system variable is populated when using a hotspot question slide: it remains empty for an incorrect answer, and indeed gets the number '0' for a correct answer (pretty weird). I suspect you are bumping on the fact that Captivate doesn't see the difference between an empty value and the number 0. Did you try to create a dummy empty variable v_null to check instead of checking the number '0'? It is a workaround that I often use when I have this type of issues. Look at this very old post:
Copy link to clipboard
Copied
Hi, and thanks for your ongoing help!
I left out some details in my post above - there is another step, that you have already helped me with greatly! - in which cpQuizInfoAnswerChoice is assigned to a user-made variable before proceeding to the next question. So it really is my user variables that I'm trying to recast in the Advanced Action. (Mentioning this didn't seem relevant to the question about 0 being "misunderstood" in the conditional Advanced Action...though maybe it was?) Anyway, so far I have been successful in other question types in using Javascript to recast the system generated answers associated with these new variables (e.g., 0,1, etc.) in terms that are more useful to my learners.
I think you are correct with the Null issue, this is the root of the problem. However, I made a null variable (v_null, with nothing in the Value line), but the system is still interpreting it as identical to literal 0 or even a variable v_0, with 0 in the Value line...am I overlooking the obvious?
Thank you!
Copy link to clipboard
Copied
Did you look at the article? Instead of checking the condition 'is equal to 0', you should reverse the condition and check if 'is equal to v_null'. That way you check if the variable is left empty, which means in this case that the answer was incorrect.
Sorry, cannot remember all the names and the answers I offered in the past.
Copy link to clipboard
Copied
Yes, this is how I have it set up -- checking if it is equal to v_null, running the script if true, else running a different script.
However, what I am seeing is that *even when the answer is 0* (i.e., not equal to v_null), it is still being interpreted as being equal to v_null. It is seeming like the system is reading 0 as the same as my null variable (with nothing specified in the value line).
Thanks for your ongoing support!
Copy link to clipboard
Copied
OK, why not repeat that workaround for '0', create a user var with value '0'?
Meanwhile I've got another reason why I never will use a default Hotspot type of question. The way that cpQuizInfoAnswerChoice is populated for this question type is really strange. I should have expected at least a Boolean (0 for incorrect, 1 for correct).
Copy link to clipboard
Copied
I tried this and encountered the same problem -- the system is treating v_0 and v_null as equivalent. Though interestingly the order of the action matters -- if v_null is first, it overtakes v_0, and vice versa.
Something I'm considering now is creating a "hidden" hotspot that is the first correct answer (i.e., 0), which would bump my actual correct answer up to 1. Seems like there should be a better way...I'll report back if this works though.
Copy link to clipboard
Copied
Did you never try to use a custom hotspot question? I use shape buttons for hotspots, they can have a free form, they can have a score attached to them (which allows partial scoring for hotspot slides).
When you have multiple hotspots, the value of cpQuizInfoAnswerChoice changes to
x,y,z,... where x, y, z stand for the number of the hotspot. First indicated hotspot = 0, second = 1 etc. It is not incrementing. In that case you should need the 'contain' operator.
Copy link to clipboard
Copied
I haven't tried custom hotspots, but will for future projects -- this has been more trouble than it's been worth.
I did end up creating multiple hotspots, with the first one (=0) being a "dummy" and the second one (=1) being the correct answer. Then, I created my conditional Advanced Action to return "Incorrect" if the answer is 0 or null (since the system finds them equivalent), and "correct" if the answer is 1.
Thank you for all of your assistance with this, Lilybiri!