Using Javascript to update a Quiz score - Captivate 2019

Explorer ,
Mar 10, 2021 Mar 10, 2021

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

Views

115

Likes

translate

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
Adobe Community Professional ,
Mar 10, 2021 Mar 10, 2021

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

 

Likes

translate

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
Explorer ,
Mar 10, 2021 Mar 10, 2021

Copy link to clipboard

Copied

Thanks for the quick response @RodWard   - Trying that out now.

@Lilybiri- generates an error "TypeError: quizObject is undefined"

Which is weird. Just dipping my toe into the JavaScript aspects - I'm reasonably aufait with JS but the interface between the two is confusing. 
Cheers

Dave

Likes

translate

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
Most Valuable Participant ,
Mar 10, 2021 Mar 10, 2021

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.

Likes

translate

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
Explorer ,
Mar 10, 2021 Mar 10, 2021

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...

image.png

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

 

Likes

translate

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
Explorer ,
Mar 10, 2021 Mar 10, 2021

Copy link to clipboard

Copied

Following on from the above - Adding it as a LITERAL and then inserting the two parameters does actually work. 

 

image.png

Thanks Everyone,

Likes

translate

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
Adobe Community Professional ,
Mar 10, 2021 Mar 10, 2021

Copy link to clipboard

Copied

Good to see you got it to work.

Likes

translate

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
Most Valuable Participant ,
Mar 10, 2021 Mar 10, 2021

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!

Likes

translate

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