Wiki

Clone wiki

ags2client / Using the plugin interface

AGS2Client isn't a plugin itself, but it does provide a common interface between plugins such as AGSteam and AGSGalaxy. The AGS2Client interface provides the following functions and properties for all supported game clients. (Note that for disjoint builds, 'AGS2Client' will be replaced with the name of the plugin.)

Functions

GetAverageRateStat

float AGS2Client.GetAverageRateStat(const string name)

Returns the value of the average rate stat with the specified name.

GetFloatStat

float AGS2Client.GetFloatStat(const string name)

Returns the value of the float stat with the specified name.

GetIntStat

int AGS2Client.GetIntStat(const string name)

Returns the value of the int stat with the specified name.

GetUserName

String AGS2Client.GetUserName()

Returns the user name registered by the client. May return a null String.

IsAchievementAchieved

bool AGS2Client.IsAchievementAchieved(const string name)

Returns whether the achievement with the specified name has been achieved.

RequestLeaderboard

void AGS2Client.RequestLeaderboard(const string leaderboardName, AGS2ClientScoresRequestType, int limit)

Requests for the client to load leaderboard data (asynchronously) for the leaderboard with the specified name. AGS2ClientScoresRequestType may be one of eAGS2ClientScoresRequestGlobal, eAGS2ClientScoresRequestAroundUser, or eAGS2ClientScoresRequestFriends.

NOTE: This call is asynchronous, so you probably won't be able to use the results right away. You can check the CurrentLeaderboardName to see if the leaderboard has been loaded (possibly from repeatedly_execute, if you need to know as soon as it's loaded to populate a GUI).

NOTE: The enum AGS2ClientScoresRequestType may be named differently on "disjoint" plugin builds, but you typically shouldn't need to reference the name of the enum in your scripts anyway.

ResetAchievement

bool AGS2Client.ResetAchievement(const string name)

Resets the achievement with the specified name. Returns false if there was an error returned by the client.

ResetStatsAndAchievements

void AGS2Client.ResetStatsAndAchievements()

Resets all stats and achievements for the currently logged in user. Be sure to take care if using this function, as it cannot be undone without manually setting the stats and achievements again.

SetAchievementAchieved

bool AGS2Client.SetAchievementAchieved(const string name)

Sets the achievement with the specified name as "achieved". Returns false if there was an error returned by the client.

SetFloatStat

bool AGS2Client.SetFloatStat(const string name, float value)

Sets the value of the float stat with the specified name. Returns false if there was an error returned by the client.

SetIntStat

bool AGS2Client.SetIntStat(const string name, int value)

Sets the value of the int stat with the specified name. Returns false if there was an error returned by the client.

UpdateAverageRateStat

bool AGS2Client.UpdateAverageRateStat(const string name, float countThisSession, float sessionLength)

Updates the average rate stat with the specified name with the specified session data. Returns false if there was an error returned by the client.

UploadScore

bool AGS2Client.UploadScore(int score)

Uploads the specified score to your game's leaderboards. Returns false if there was an error returned by the client.

Properties

CurrentLeaderboardName

readonly String AGS2Client.CurrentLeaderboardName

Returns the name of the currently loaded leaderboard, or null if no leaderboard has been loaded.

NOTE: You must call RequestLeaderboard to populate leaderboard data first.

NOTE: Do not confuse this with the LeaderboardNames array. This property refers to the name of the leaderboard itself.

Initialized

readonly bool AGS2Client.Initialized

Returns whether the client is properly initialized. No other functions will work if the client has failed to initialize.

LeaderboardCount

readonly int AGS2Client.LeaderboardCount

Returns the number of entries populated in the current leaderboard. The maximum index to LeaderboardNames and LeaderboardScores is one less than LeaderboardCount.

NOTE: You must call RequestLeaderboard to populate leaderboard data first.

LeaderboardNames

readonly String AGS2Client.LeaderboardNames[int index]

Returns the name of the specified entry from the leaderboard. Indexes are from zero to LeaderboardCount - 1.

NOTE: You must call RequestLeaderboard to populate leaderboard data first.

NOTE: Do not confuse this with the CurrentLeaderboardName property. This array refers to the names that appear as entries in the leaderboard, as associated with the LeaderboardScores.

LeaderboardScores

readonly int AGS2Client.LeaderboardScores[int index]

Returns the score of the specified entry from the leaderboard. Indexes are from zero to LeaderboardCount - 1.

NOTE: You must call RequestLeaderboard to populate leaderboard data first.

Updated