Skip to content
Martin Noya edited this page May 23, 2015 · 3 revisions

#Welcome to the GetDotaStats wiki for StatsCollectionHighscores

Install Guide

  1. Copy stat-highscore/resource/flash3/StatsCollectionHighscores.swf to your addons resource/flash3/ folder.
  2. Add an entry for StatsCollectionHighscores.swf in your addon's resource/flash3/custom_ui.txt folder. You can find an example custom_ui.txt here.
  3. Copy stat-highscore/scripts/stat_collection_highscore.kv to your addon's scripts/ folder and modify it to be "live" "1"
  4. In your addons scripts/custom_events.txt make sure it has stat_collection_steamID defined, if it doesn't, copy it from here.
  5. When all players are fully connected (in Lua) run the code listed below
-- Stats Collection (RPG, Highscores, Achievements)
-- This is for Flash to know its steamID
j = {}
for i=0,9 do
	j[i+1] = tostring(PlayerResource:GetSteamAccountID(i))
end
local result = table.concat(j, ",")
j = {ids=result}
FireGameEvent("stat_collection_steamID", j)

Scaleform API

All the API calls to StatsCollectionHighscores have the same variable names, and will be used in this document, they are as follows:

Name Datatype Example value Explanation
modID String Get one here The unique ModID from GetDotaStats
(the example is from Test Mod #1)
saveID int 5 The unique saveID for this save
saveID's are per user, per mod.
highscoreID int 1 The ID of the highscore to save, each different highscore should use their own.
highscoreValue int 322 The highscore value, unique for each highscoreID and player.
callback Function functionName This is the function that will be called when the API call is finished.
  • callback will be explained on a per-function basis below
//This will be used in the rest of the Documentation to save time and make it look neater
var statsHighscore:MovieClip = globals.Loader_StatsCollectionRPG.movieClip;

Flash API functions:

SaveHighScore

Used to save a score of certain highscoreID of the player on the server. You can have many different highscoreID values, each one will represent a certain historic stat you want to track for the players (like Number of Kills or Fastest Time to achieve something). You can then talk to jimmydorry to get your own Highscore Leaderboard on the site.

statsHighscore.SaveHighScore(modID, highscoreID, highscoreValue);

GetPersonalLeaderboard

Get the Highscore of the player, using the SteamID acquired before. You will want to handle the case where there is no highscore.

statsHighscore.GetPersonalLeaderboard(modID, callback);

public function callback(jsonInfo:Object) {
    var i:int = 0;
    for (var highscoreID in jsonInfo) {
        i++;
        trace(highscoreID);
        var leaderboard:Array = jsonInfo[highscoreID];
	for each (var entry:Object in leaderboard) {
            trace("## Another higher score was found: ",entry.highscoreValue);
            // Check to update Highscore here
        }
    }
    if (i == 0) { 
        trace("## No score");
    }
}

GetTopLeaderboard

Gets an array of the top 20 scores, with { userName, steamID, highscoreValue, date }

statsHighscore.GetTopLeaderboard(modID, callback);

public function callback(jsonInfo:Object) {
    var i:int = 0;
    for (var highscoreID in jsonInfo) {
        trace("## Leaderboard for highscoreID ",highscoreID);
        var leaderboard:Array = jsonInfo[highscoreID];
	for each (var entry:Object in leaderboard) {
            trace("## Top "+i,entry.userName,entry.highscoreValue);
            i++;
        }
    }
}

Lua API

N/A If you feel like this is required feel free to message SinZ on #getdotastats over at irc.gamesurge.net

Protocol Specs

Check the README for this

Example

Check CourierMadness' HighscorePanel for an example implementation of this library.