Using Javascript to update a Quiz score - Captivate 2019
Copy link to clipboard
Copied
Hi all,
I hope someone can help with this - I've created a quick which has a quirky marking system so I've generated the mark in JavaScript as none of the built in ones do exactly what I need. That bit is fine; I get the question marks in a variable called var_Quiz_Score which I can see or put on a slide with the usual $$var_Quiz_Score$$.
My question is how can I push this into the quiz score? I believe I need to update cpQuizInfoPointsscored but I cannot work out how to do this. I've read the page https://elearning.adobe.com/2017/02/custom-quiz-scoring-in-adobe-captivate/ from but this doesn't seem to do the job I need.
Any help gratefully received.
Cheers
Dave
Copy link to clipboard
Copied
The cpQuizInfoPointsscored System Variable is READ-ONLY. You would need some advanced JavaScript skills to pull off what you want to do.
Alternatively, it is possible to do this using the CpExtra HTML5 widget. Check out the details here:
https://widgetking.github.io/cpextra/variables/command.html#xcmndscore
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Understood, and I tried to explain that this expert is not accessible anymore.
The widget may inspire you to look for an easy JS solution. Personally I only use JS when Captivate's shared/advanced actions fail. Transfer of the value of a user variable to a quiz variable is something I have wished for since eons.
Copy link to clipboard
Copied
Hi Rod,
I've got the widget and it is installed but can't seem to get the xcmndScore to work.
I've tried it this way...
But (I think) xcmndScore takes two parameters and I can only use one here.
I've also tried within JavaScript setting xcmndScore = var_Quiz_Score; but obviously that's only using one parameter as well.
Can you point me in the right direction please?
Best Regards
Dave
Copy link to clipboard
Copied
Following on from the above - Adding it as a LITERAL and then inserting the two parameters does actually work.
Thanks Everyone,
Copy link to clipboard
Copied
Good to see you got it to work.
Copy link to clipboard
Copied
Bit astonished that Steven's blog post is not what you want. Besides Tristan (widget king) and some others, I had great respect for his JS skills. Too bad that he has left our community.
That was off topic, but I strongly recommend Rod's proposal. Try out that fantastic widget!

