Support Home Scripting Use Cases Scoring

Scoring

Scoring in Task Builder 2 and Game Builder allows you to control whether a response should be considered correct or incorrect. The built-in scoring components Scorer and Scorer Multi work on the basis of simply matching the given response with a particular string (or one of a list of strings).

But what if you wanted to write your own scoring logic? Perhaps you're collecting numeric responses, and want to mark something as correct if it's above or below a certain value, or within a certain range. Or maybe you want to tie the correct answer to the time of day - some responses are correct in the morning but incorrect in the afternoon. For any of these types of scenarios, you can create your own scorer.


Start by creating a new component with the Screen Component template:

New script panel showing the Screen Component template selected and the name MyScorer in the name box

You can now implement your logic in the scoreResponse() lifecycle method:

// in your component body public scoreResponse(response: ProcessedResponse) { let isCorrect = false; // add your logic here to decide if the response should be correct // // access the response itself: // const response = response.response; // // access the reactio time: // const rt = response.reactionTime; response.correct = isCorrect; }

The response object that is passed in contains lots of information about the response that is being processed. You can find a full reference of all the properties here:

Scripting Types Reference


Scripting Sample

For a worked example of a new scoring component see our Custom Scoring Example.