Forum Discussion
Results Slide Percent no Decimal Points
I found this thread while looking for a solution to the same problem.
What I did:
1. Insert a numerical variable called myScore
2. Insert a trigger on the results slide adjusting myScore to the value of the Results.ScorePercent.
3. Insert a new trigger to Execute JavaScript when the timeline starts
4. Click on the … button, and insert the code below into the panel that opens
var player = GetPlayer();
var score = player.GetVar("myScore");
player.SetVar("myScore", Math.round(score));
5. Now edit your Results slide text to display %myScore% instead of %Results.ScorePercent% as below.
Job done :)
Tony C
HI. Can you clarify--When you say edit the results slide--should it only say "%myScore% and not the info in the brackets? Or do you keep the brackets and change the text to "MyScore"? Is it a double %% at the end or a single? I assume points or percent refers to the same thing in step 5?
Also, does the trigger to send results to the LMS need to be after the Java Script trigger in the order?
- PaulyBarnes18 years agoCommunity Member
The double percent is because you actually want it to say %. So to read 80%, where 80 is the variable, it would look like this:
%Variable%%
for step 5 I would assume you leave whats in the brackets alone since those are referring to points rather than percentages. I usually delete the entire bracketed area since we do not utilize points.
Also, to answer your final question, the script to send needs to be AFTER the javascript or it will send the incorrect value.
Hope this helps!