Forum Discussion

CameronHallo868's avatar
CameronHallo868
Community Member
2 years ago

GetScore from Moodle

I am trying to have when students retry an activity they have their current best score displayed as an incentive.

I am struggling to get the GetScore(); value to return the previous highest score attempt from Moodle. The console shows a blank result and the storyline variable keeps coming back blank when I set as text or NaN when I set as a number. 

I have tried varaiations of the following without success, (yes there is a score recorded on the LMS to access).

var lmsAPI = parent;
var player = GetPlayer();
var myScore = GetScore();
console.log("test "+myScore);
player.SetVar("pastscore", myScore);

Does anyone have a simple working version they can share so I can learn from?