ActivePresenter Saola Animate Pricing Download

Javascript to add correct Quiz answers

Hello,
At the end of a quiz I would like to create a report displaying the score based on Topics that the user was quizzed on.

Can I create a javascript to add the score when correct for specific questions and at the end display a slide with this score ?

If yes . what would be the javascript ?

Thanks

Problem:

ActivePresenter Version:

OS:

Notes:

Hi,

Please take a look at this sample: https://drive.google.com/open?id=0B3hOg7Fkv-dvTnF1VWYteHVMV2c. You will need to store score manually in the On Correct event of each question by a small piece of javascript. Then in the last slide, you need to add script to display score in Properties > Event when selecting the slide.

Regards,

You guys rock !

Thanks !

This is a great example. Thank you for it. Could you tell me how to prevent the regular score screen from presenter to display at the end? Also how to not display the side bar?

To hide the regular score screen at the end, click Reporting tab in the Export to HTML5 Simulation dialog, clear Show report in Practice and Test mode check box.
To hide the side bar, please see the answer in this question: How to not display the sidebar with steps

I have the show report off and it still show in HTML5
see screenshots here:
https://drive.google.com/a/ednucleus.com/file/d/0B66sSICnUAt7YXVlZl9MTXE5YjQ/view?usp=sharing
https://drive.google.com/a/ednucleus.com/file/d/0B66sSICnUAt7VFV5ZTNmSHBhVXM/view?usp=sharing

I looked at this example but cannot apply it in another composition. To what I understand you add the javascript to each slide submit button on correct execute javascript and then on the score slide event. However my text remains empty.
What am I missing?

Also if I want to show the report, is there a way to customize the look so it is looking more like the style of our curriculum? Can we add CSS?

I don’t have permission to access your files. I’ve already sent the request, please approve.

Current version doesn’t support customizing the look of the report, but the next major version will.

He adds JavaScript to On Correct event of each question (not submit button), and to Event section in the Properties pane of the score slide. If you already do that but no score displays, maybe there’s typos in your code. You can debug it yourself by using the browser developer tools > Console tab (click the address bar then press F12 to open developer tools). Or share your project so that we can help.

OK. I looked at the quiz. I think I have it all and understand it. I will try and get it to work and will let you know.
In correct there is:
execute javascript/ score_quiz_1 = 3;

in the quiz page event there is:
var displayScore = Prez.GetObject(‘DisplayScore’);
if (displayScore) {
var scoreText = ‘’;
scoreText += 'Question 1: ’ + (typeof score_quiz_1 == ‘undefined’? 0: score_quiz_1) + ‘
’;
scoreText += 'Question 2: ’ + (typeof score_quiz_2 == ‘undefined’ ? 0: score_quiz_2) + ‘
’;
scoreText += 'Question 3: ’ + (typeof score_quiz_3 == ‘undefined’ ? 0: score_quiz_3) + ‘
’;
displayScore.SetText(scoreText);
} else {
alert(‘Object not found’);
}

1 Like

OK. I got it to work. I think that I may have had a problem with the style of the score text which I copied from the quiz test. After I change its properties to inherit, it worked fine.
Thanks! This is really better for me at this point to show the score in this fashion rather than the report which does not look good enough to show.
I hope you will add an option to add a style sheet for it.

I added a total score line and the code is changed as follows:

var displayScore = Prez.GetObject(‘DisplayScore’);
var scoreTotal = (typeof score_quiz_1 == ‘undefined’? 0: score_quiz_1)

  • (typeof score_quiz_2 == ‘undefined’? 0: score_quiz_2)
  • (typeof score_quiz_3 == ‘undefined’? 0: score_quiz_3)
  • (typeof score_quiz_4 == ‘undefined’? 0: score_quiz_4);
    console.log(scoreTotal );

if (displayScore) {
var scoreText = ‘’;
scoreText += 'Question 1: ’ + (typeof score_quiz_1 == ‘undefined’? 0: score_quiz_1) + ‘
’;
scoreText += 'Question 2: ’ + (typeof score_quiz_2 == ‘undefined’ ? 0: score_quiz_2) + ‘
’;
scoreText += 'Question 3: ’ + (typeof score_quiz_3 == ‘undefined’ ? 0: score_quiz_3) + ‘
’;
scoreText += 'Question 4: ’ + (typeof score_quiz_4 == ‘undefined’ ? 0: score_quiz_4) + ‘
’;
scoreText += 'Your total score is : ’ + (typeof scoreTotal == ‘undefined’ ? 0: scoreTotal)+ ‘/8’;
displayScore.SetText(scoreText);
} else {
alert(‘Object not found’);
}

2 Likes

hey sorry for digging out this old thread again, but i’m currently trying to implement something like this. I downloaded the example project and I can’t get it to output the score. I know javascript and HTML but it seems like all my window.console.log calls etc. are ignored. Is there any docs that I’ve missed?

I added an alert call in the first line. That gets executed, however my console.log calls are ignored & getting the object via Prez.GetObject seems to fail.

Hi Kevin,

This script is for ActivePresenter version 6, it’s not supported in version 7 anymore.
In version 7, you can use a report slide as described in this tutorial:

If it doesn’t suit your needs, please ask in a new thread.

Regards

thank you! I found a PDF where the differences are explained in one of the tutorial posts on the website of active presenter.