Materia Score Manager
The score manager provides methods for sending score data to the server for a widget player.
Widget interactions are a catch-all category for any (logged) widget activity that isn’t categorized as an answered question or final score.
It’s up to the score module to make sense of the interaction and grade the widget appropriately.
Examples include an individual question modifier (hint used, -50%), an overall score modifier (-20% to final score), or more esoteric cases.
|QuestionId||yes||questionID the ID of the question associated with this interaction, if applicable. The score module can ignore it for cases where it doesn’t apply.|
|interactionType||yes||A string identifying what the interaction is, e.g.: ‘hint_used’, ‘attempt_penalty’, etc.|
|value||yes||The value of the interaction, if applicable.|
Materia.Score.submitInteractionForScoring(question.id, 'hint_used', 10)
A final score submission from the client. In some situations, a widget may not pass back logs for individual questions/interactions, and only pass back a final score. For example, perhaps the widget scores on the client side and only provides the score.
|questionID||yes||if the final score is being determined by an individual question, its ID can be used here. Otherwise, just use 0.|
|userAnswer||yes||if the final score is determined based on a user’s answer. Can be an empty string otherwise.|
|score||yes||the final score to return.|
Materia.Score.submitFinalScoreFromClient(0, '', 95)
An answered question submission. This is the most basic log type. Used in most ordinary responses for individual questions.
|questionID||yes||The ID of the question being answered|
|userAnswer||yes||The response the user provided. This string is matched against the widget’s QSET on the server to determine the correct answer.|
|value||no||The value isn’t by default used to determine the score of the question, however it can be used to pass an additional value to be used in scoring|
Adds a message/feedback to the overall score screen.
|- message||yes||Message to display on the score screen|
Materia.Score.addGlobalScoreFeedback('You lost your companions escaping from the dungeon.')
Adds an unspecified type of score data for processing by a custom score module.
|data||yes||Object to store in the score logs|