Documentation

Custom Scoring

Description

The Custom Scoring addon has been developed with a view to the needs of all teachers who prepare complex activities in their lessons. With this addon, a teacher can create both simple and complicated activities from a variety of modules available in Player.

Properties

Property name Description
Script Script that will be executed when the evaluate() command is called or the Check button is pressed.
Max Score The maximum score of an activity

Script

The code provided in a module's property is in fact a fully-functional JavaScript script. Within it, a user has access to the PlayerController object (saved in the presenter.playerController variable as in Advanced Connector), thanks to which it can gain access to all modules placed inside a page. Additionally, the presenter variable has two additional methods:

  • setScore
  • setErrors

Both are used to set the activity result. They take zero or positive integer value for the parameter. When this score is higher than the 'Max Score' property or is invalid - the score will not be saved.

Remember that after the script is evaluated, it might be necessary to do some work with Advanced Connector in order to restore the state before the evaluation (like in the example below where the mark classes have been removed).

Script example

The script used in demo presentation works with three Image Identification modules (with IDs: 'balloon', 'plain' and 'helicopter') and looks like this:

var balloon = presenter.playerController.getModule('balloon'),
    plain = presenter.playerController.getModule('plain'),
    helicopter = presenter.playerController.getModule('helicopter');

if (balloon.isSelected() && helicopter.isSelected()) {
    presenter.setScore(1);
    presenter.setErrors(0);

    balloon.markAsCorrect();
    plain.markAsCorrect();
    helicopter.markAsCorrect();
} else {
    presenter.setScore(0);
    presenter.setErrors(1);

    balloon.markAsWrong();
    plain.markAsWrong();
    helicopter.markAsWrong();
}

In addition, the Advanced Connector script (running on the Uncheck event) looks like this:

EVENTSTART
Name:Uncheck
SCRIPTSTART
    var balloon = presenter.playerController.getModule('balloon'),
        plain = presenter.playerController.getModule('plain'),
        helicopter = presenter.playerController.getModule('helicopter');

    balloon.removeMark();
    plain.removeMark();
    helicopter.removeMark();
SCRIPTEND
EVENTEND

Supported commands

Command name Params Description
evaluate --- Evaluates specified script
setScore score Sets score value for module. Score value must be a natural number
setErrors errors Sets errors value for module. Errors value must be a natural number

CSS classes

Class name Description
--- ---

Demo presentation

Demo presentation contains examples of how to use the Custom Scoring addon.