-
Notifications
You must be signed in to change notification settings - Fork 1
Home
#Welcome to the GetDotaStats wiki for StatsCollectionRPG
- Copy
statrpg/resource/flash3/StatsCollectionRPG.swf
to your addonsresource/flash3/
folder. - Add an entry for
StatsCollectionRPG.swf
in your addon'sresource/flash3/custom_ui.txt
folder. You can find an example custom_ui.txt here. - Copy
statrpg/scripts/stat_collection_rpg.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 StatsCollectionRPG 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. |
jsonData | Object | { level : 25 } | This is where you would store all your info for this save |
metaData | Object or String | { name : "Bob"} | This is where you would store the info for the user to identify which save is which |
callback | Function | functionName | This is the function that will be called when the API call is finished. |
-
jsonData
andmetaData
can be pretty much anything as long as it can fit inside json -
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 statsRPG:MovieClip = globals.Loader_StatsCollectionRPG.movieClip;
This function sets the jsonData
and metaData
of saveID
, for this user
NOTE: jsonData
and metaData
needs to be an object that can be JSON, but metaData optionally can also be a String
statsRPG.SaveData(modID, saveID, jsonData, metaData, callback);
//success is somewhat self explanatory, if this call worked, it will be true
public function callback(success:Boolean) {
if (success) {
trace("Huzzah?");
}
}
This function will delete saveID
for this user
statsRPG.DeleteSave(modID, saveID, callback);
//success is somewhat self explanatory, if this call worked, it will be true
public function callback(success:Boolean) {
if (success) {
trace("Huzzah?");
}
}
This function will retrieve the jsonData
of saveID
, for this user
statsRPG.GetSave(modID, saveID, callback);
//jsonData is the jsonData of the save you requested
//Will be null if the request failed somehow
public function callback(jsonData:Object) {
trace("##CALLBACK3");
for (var info in jsonData) {
trace("jsonData." + info + " = " + jsonData[info]);
}
trace("##END_CALLBACK3");
}
output of this will look like:
[ Scaleform ]: SF: ##CALLBACK3
[ Scaleform ]: SF: jsonData.hello = world
[ Scaleform ]: SF: ##END_CALLBACK3
This function will retrieve the 10 most recent mods metaData
as an Array for this user
statsRPG.GetList(modID, callback);
//metaArray is an array of metadata
//Will be an empty array if it failed somehow
public function callback(metaArray:Array) {
trace("##CALLBACK");
for each (var entry:Object in jsonArray) {
trace(entry.saveID);
trace("##METADATA");
for (var metaData in entry.metaData) {
trace("entry.metaData." + metaData + " = " + entry.metaData[metaData]);
}
trace("##END_METADATA");
trace(entry.dateRecorded.toString());
}
trace("##END_CALLBACK");
}
output of this will look like:
[ Scaleform ]: SF: ##CALLBACK
[ Scaleform ]: SF: 1
[ Scaleform ]: SF: ##METADATA
[ Scaleform ]: SF: entry.metaData.name = bob
[ Scaleform ]: SF: ##END_METADATA
[ Scaleform ]: SF: Thu Mar 26 17:54:18 GMT+1000 2015
[ Scaleform ]: SF: 2
[ Scaleform ]: SF: ##METADATA
[ Scaleform ]: SF: entry.metaData.name = bob
[ Scaleform ]: SF: ##END_METADATA
[ Scaleform ]: SF: Fri Mar 27 12:41:14 GMT+1000 2015
[ Scaleform ]: SF: 3
[ Scaleform ]: SF: ##METADATA
[ Scaleform ]: SF: entry.metaData.hello = world
[ Scaleform ]: SF: ##END_METADATA
[ Scaleform ]: SF: Thu Apr 23 15:44:35 GMT+1000 2015
[ Scaleform ]: SF: ##END_CALLBACK
This function will retrieve an available saveID
to be used for a new save, for this user.
statsRPG.CreateSave(modID, callback);
//saveID is the current available saveID for this user (for this mod)
//Will be null if the request failed somehow
public function callback(saveID:int) {
//saveID here will be used when you are creating a new save, and would feed this number into
//statsRPG.CreateSave(modID, saveID, jsonData, metaData);
trace(saveID.toString());
}
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