Please Select Your Location
Australia
Österreich
België
Canada
Canada - Français
中国
Česká republika
Denmark
Deutschland
France
HongKong
Iceland
Ireland
Italia
日本
Korea
Latvija
Lietuva
Lëtzebuerg
Malta
المملكة العربية السعودية (Arabic)
Nederland
New Zealand
Norge
Polska
Portugal
Russia
Saudi Arabia
Southeast Asia
España
Suisse
Suomi
Sverige
台灣
Ukraine
United Kingdom
United States
Please Select Your Location
België
Česká republika
Denmark
Iceland
Ireland
Italia
Latvija
Lietuva
Lëtzebuerg
Malta
Nederland
Norge
Polska
Portugal
España
Suisse
Suomi
Sverige

Function usage

IsReady()

int IsReady(StatusCallback callback);
Name Type Description
callback StatusCallback Callback function

Returns: int . A value of 1 means the function has completed without error.

Initializes the Stats and Achievements API. The callback will provide a code when initialization completes, with either 0 for success or an error code . Call this function before calling other Stats and Achievements API functions.

DownloadStats()

int DownloadStats(StatusCallback callback);

Returns: int . A value of 1 means the function has completed without error.

Call this function to download all stats and achievements from the VIVEPORT backend for the current end user. This data is cached by the SDK and can be retrieved with the GetStat() , GetAchievement() , and GetAchievementUnlockTime() . The callback will provide a code when complete, with either 0 for success or an error code .

UploadStats()

int UploadStats(StatusCallback callback);
Name Type Description
callback StatusCallback Callback function

Returns: int . Returns 1 when completed successfully.

Call this function to upload stats and achievements stored locally to the VIVEPORT backend. Make sure that your title has called the SetStat() or SetAchievement() functions first before upload. The callback will provide a code when complete, with either 0 for success or an error code .

int GetStat()

int GetStat(string name, int defaultValue);
Name Type Description
name string The API name of the stat, as specified in the VIVEPORT Developer Console
defaultValue int The default value of the stat if none available

Returns: int . Returns the value of the stat specified by name . If no stat is available, returns defaultValue .

float GetStat()

float GetStat(string name, float defaultValue);
Name Type Description
name string The API name of the stat, as specified in the VIVEPORT Developer Console
defaultValue float The default value of the stat if none available

Returns: float . Returns the value of the stat specified by name . If no stat is available, returns defaultValue .

void SetStat(string, int)

void SetStat(string name, int value);
Name Type Description
name string The API name of the stat, as specified in the VIVEPORT Developer Console
value int Stat value

Sets an integer stat by name . Stats and achievements are cached locally by the VIVEPORT SDK. Make sure to upload these stats with UploadStats() before the title quits to upload the stat to the VIVEPORT backend. Note that if a minimum or maximum change has been set in the VIVEPORT Developer Console , stats not meeting these parameters will be discarded without error.

void SetStat(string, float)

void SetStat(string name, int value);
Name Type Description
name string The API name of the stat, as specified in the VIVEPORT Developer Console
value float Stat value

Sets a float stat by name . Stats and achievements are cached locally by the VIVEPORT SDK. Make sure to upload these stats with UploadStats() before the title quits to upload the stat to the VIVEPORT backend.

GetAchievement()

bool GetAchievement(string pchName);
Name Type Description
name string The API name of the achievement, as specified in the VIVEPORT Developer Console

Returns: bool . TRUE if the achievement has been unlocked, otherwise FALSE .

Checks the VIVEPORT SDK cache for achievement status by achievement name.

GetAchievementUnlockTime()

int GetAchievementUnlockTime(string pchName);
Name Type Description
pchName string The API name of the achievement, as specified in the VIVEPORT Developer Console

Returns: int . Achievement unlock time in Unix Time.

SetAchievement()

int SetAchievement(string pchName);
Name Type Description
pchName string The API name of the achievement, as specified in the VIVEPORT Developer Console

Returns: int . A value of 1 means the function has completed without error.

Unlocks an achievement by name .

ClearAchievement()

int ClearAchievement(string pchName);
Name Type Description
pchName string The API name of the achievement, as specified in the VIVEPORT Developer Console

Returns: int . A value of 1 means the function has completed without error.

Resets an achievement by name .