Copy link to clipboard
Copied
Hi all! Long story short, I'm trying to increase the learner's score without increasing the quiz score maximum. I've tried adding a button with a point value, which increased the score when "Add To Total" was selected, but also increased the point maximum (so reflects poorly on learners who did not click what was supposed to be essentially "bonus" points). I also tried unchecking "Add To Total" like pictured below, but in that case the button doesn't grant any points whatsoever.
It seemed like the best way to accomplish this was with some simple JavaScript, but the script I tried below doesn't work to change the score. It does, however, work to produce the alert message, so I know JavaScript can run.
var oldScore = window.cpAPIInterface.getVariableValue("cpQuizInfoPointsscored");
var newScore = oldScore + 10;
alert("Old score: " + oldScore +"; New score: " + newScore);
window.cpAPIInterface.setVariableValue("cpQuizInfoPointsscored", newScore);
I know generally this variable is probably not meant to be edited manually; however my specific use case here is not even so much to create "bonus points" as to counteract an issue we're having with questions not always loading correctly, which I posted about earlier this month. I wanted to use this as a workaround for learners to be able to say "hey this question didn't load correctly" and to give them points for that question anyway so they're not penalized for it. So if my JavaScript question is a case of the "XY problem" and you have a better solution to report, I'll gladly accept that too.
Thanks in Advance!
Copy link to clipboard
Copied
Most system variables are read only with the exception of the Movie Control category.
I use CpExtra - an external widget - to change scores. It is based on JS, but I don't think it is as simple as using the setVariableValue. More info about that widget in:
https://www.infosemantics.com.au/about-cpextra/
It has a lot of features, not only this possibility to edit quiz scores. But it is not compatible with version 12, where the deprecation for JS extensions and the disappearance of lot of useful system variablles are at the core.
Copy link to clipboard
Copied
That CpExtra looks kind of neat! Hate that it's losing compatibility with other versions but maybe it will be worth looking into anyway for my current version
Copy link to clipboard
Copied
Know that it is the only widget which I recommend, and I have used it for years.
Not sure when the NEW version will ever be able to have all the features of the present version 11.5... For sure at this moment I am unable to use it because the requests by my clients cannot be realized with it.