Adding up XP points



Is there a way to add up the number of XP points per class? 


Hi Amy,

After you talked with my colleague Mélysa, we chatted with the dev team about this possibility. They gave us a neat little code that you can use to know the total of XP for an entire class.

  1. Open the console. To do this in Chrome, follow this path: Menu > More Tools > Developer Tools.
  2. Paste this code into the console:
var totalXP = 0;players.find().forEach(function(p){totalXP += p.xp});console.log("Total XP for the class:", numeral(totalXP).format("0,0"));

 

This will give you the total of XP for the class you are in! :-)

Wow, thats cool!  I would love to see other little tricks like this for advanced users.

That is really useful - is there similar coding for things like average XP on a team, average XP overall, etc?

 

On that note, I did figure out that if you modify the code like so, you can find the average XP for the class:

I bolded and italicized the change I made (the /20 toward the end) - essentially, I just had it divide the total by the number of students in my class, which in this case was 20. Worked like a charm.

var totalXP = 0;players.find().forEach(function(p){totalXP += p.xp});console.log("Total XP for the class:", numeral(totalXP/20).format("0,0"));

 

Please sign in to leave a comment.