-
Notifications
You must be signed in to change notification settings - Fork 1
Home
#Welcome to the GetDotaStats wiki for StatsCollectionHighscores
- Copy
stat-highscore/resource/flash3/StatsCollectionHighscores.swf
to your addonsresource/flash3/
folder. - Add an entry for
StatsCollectionHighscores.swf
in your addon'sresource/flash3/custom_ui.txt
folder. You can find an example custom_ui.txt here. - Copy
stat-highscore/scripts/stat_collection_highscore.kv
to your addon'sscripts/
folder and modify it to be"live" "1"
- In your addons
scripts/custom_events.txt
make sure it hasstat_collection_steamID
defined, if it doesn't, copy it from here. - 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)
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:
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);
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");
}
}
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++;
}
}
}
N/A If you feel like this is required feel free to message SinZ on #getdotastats over at irc.gamesurge.net
Check the README for this
Check CourierMadness' HighscorePanel for an example implementation of this library.