Skip to content
YYBartT edited this page Aug 28, 2024 · 4 revisions

User

This is a module for handling the user account.

Functions

This module offers a collection of functions designed to address specific tasks and provide utilities for various purposes. Explore the available functions to make the most of the functionalities provided by this module.

Structs

This module offers a collection of structs, which serve as custom data models for organizing and structuring data. Explore the provided structs to better understand the relationships between data elements and simplify your data manipulation tasks.



Back To Top

GOG_User_DeleteUserData

This function clears a property of user data storage. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

Warning

REQUIREMENT Retrieve the user data first by calling GOG_User_RequestUserData.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_DeleteUserData(key)
Argument Type Description
key String The name of the property of the user data storage.



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_DeleteUserData"
error String The error message; only if request failed ✴️ OPTIONAL

Example:

GOG_User_DeleteUserData("weapon");

The code sample above starts a task for deleting user data, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_DeleteUserData")
{
    if (ds_map_exists(async_load, "error"))
    {
        show_debug_message(async_load[?"error"]);
        exit;
    }
    show_debug_message("DeleteUserData SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_GetAccessToken

This function returns the access token for current session.


Syntax:

GOG_User_GetAccessToken()



Returns:

String


Example:

var _accessToken = GOG_User_GetAccessToken();

The code above provides a simple usage example.




Back To Top

GOG_User_GetGalaxyID

This function returns the ID of the user, provided that the user is signed in.


Syntax:

GOG_User_GetGalaxyID()



Returns:

GalaxyID


Example:

var _myUsedID = GOG_User_GetGalaxyID();

The code above provides a simple usage example.




Back To Top

GOG_User_GetSessionID

This function returns the ID of current session.


Syntax:

GOG_User_GetSessionID()



Returns:

Real


Example:

var _sessionID = GOG_User_GetSessionID();

The code above provides a simple usage example.




Back To Top

GOG_User_GetRefreshToken

This function returns the refresh token for the current version.


Syntax:

GOG_User_GetRefreshToken()



Returns:

String


Example:

var _refreshToken = GOG_User_GetRefreshToken();

The code above provides a simple usage example.




Back To Top

GOG_User_GetUserData

This function returns an entry from the data storage of current user.

Warning

REQUIREMENT Retrieve the user data first by calling GOG_User_RequestUserData.


Syntax:

GOG_User_GetUserData(key, userID=undefined)
Argument Type Description
key String The name of the property of the user data storage.
userID GalaxyID The ID of the user. It can be omitted when reading own data.



Returns:

String


Example:

var _data = GOG_User_GetUserData("data", GOG_User_GetGalaxyID());

The code above provides a simple usage example.




Back To Top

GOG_User_GetUserDataByIndex

This function returns a property from the user data storage by index.

Warning

REQUIREMENT Retrieve the user data first by calling GOG_User_RequestUserData.


Syntax:

GOG_User_GetUserDataByIndex(index, userID=undefined)
Argument Type Description
index Real Index as an integer in the range of [0, number of entries].
userID GalaxyID The ID of the user. It can be omitted when reading own data.



Returns:

KeyValuePair


Example:

for(var a = 0 ; a < GOG_User_GetUserDataCount(GOG_User_GetGalaxyID()) ; a ++ )
    draw_text(100, 220 + a*30, GOG_User_GetUserDataByIndex(a, GOG_User_GetGalaxyID()));

The code above provides a simple usage example.




Back To Top

GOG_User_GetUserDataCount

This function returns the number of entries in the user data storage.

Warning

REQUIREMENT Retrieve the user data first by calling GOG_User_RequestUserData.


Syntax:

GOG_User_GetUserDataCount(userID=undefined)
Argument Type Description
userID GalaxyID The ID of the user. It can be omitted when reading own data.



Returns:

Real


Example:

for(var a = 0 ; a < GOG_User_GetUserDataCount(GOG_User_GetGalaxyID()) ; a ++ )
    draw_text(100, 220 + a*30, GOG_User_GetUserDataByIndex(a, GOG_User_GetGalaxyID()));

The code above provides a simple usage example.




Back To Top

GOG_User_IsLoggedOn

This function checks if the user is logged on to Galaxy backend services.


Syntax:

GOG_User_IsLoggedOn()



Returns:

Boolean


Example:

if(GOG_User_IsLoggedOn())
{
   //User is logged, do something...
}

The code above provides a simple usage example.




Back To Top

GOG_User_IsUserDataAvailable

This function checks if user data exists.

Warning

REQUIREMENT Retrieve the user data first by calling GOG_User_RequestUserData.


Syntax:

GOG_User_IsUserDataAvailable(userID=undefined)
Argument Type Description
userID GalaxyID The ID of the user. It can be omitted when reading own data.



Returns:

Boolean


Example:

if(GOG_User_IsUserDataAvailable())
{
   //User data is available, do something
}

The code above provides a simple usage example.




Back To Top

GOG_User_ReportInvalidAccessToken

This function reports the current access token as no longer working.


Syntax:

GOG_User_ReportInvalidAccessToken(accessToken, info)
Argument Type Description
accessToken String The invalid access token.
info String Additional information.



Returns:

N/A


Example:

GOG_User_ReportInvalidAccessToken(accessToken, "A hacker wanna be...");

The code above provides a simple usage example.




Back To Top

GOG_User_RequestUserData

This function retrieves/refreshes user data storage. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_RequestUserData(userID=undefined)
Argument Type Description
userID GalaxyID The ID of the user. It can be omitted when reading own data.



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_RequestUserData"
error String The error message; only if request failed ✴️ OPTIONAL

Example:

GOG_User_RequestUserData("BestScoresLeaderboard");

The code sample above starts a task for requesting user data, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_RequestUserData")
{
    show_debug_message("RequestUserData SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SetUserData

This function creates or updates an entry in the user data storage.

Warning

REQUIREMENT Retrieve the user data first by calling GOG_User_RequestUserData.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_SetUserData(key, value)
Argument Type Description
key String The name of the property of the user data storage with the limit of 1023 bytes.
value String The value of the property to set with the limit of 4095 bytes.



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_SetUserData"
userID GalaxyID The ID of the user.

Example:

GOG_User_SetUserData("weapon", "sword");

The code sample above starts a task for setting user data, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_SetUserData")
{
    show_debug_message("User data was set for user {0}", async_load[? "userID"]);
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SignedIn

This function checks if the user is signed in to Galaxy. The user should be reported as signed in as soon as the authentication process is finished. If the user is not able to sign in or gets signed out, there might be either a networking issue or a limited availability of Galaxy backend services. After loosing authentication the user needs to sign in again in order for the Galaxy Peer to operate.


Syntax:

GOG_User_SignedIn()



Returns:

Boolean


Example:

if(GOG_User_SignedIn())
{
   //user signed in, do something
}

The code above provides a simple usage example.




Back To Top

GOG_User_SignInAnonymous

This function authenticates the Galaxy Game Server anonymously. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_SignInAnonymous()



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_SignInAnonymous"
error String The error message; only if request failed ✴️ OPTIONAL

Example:

GOG_User_SignInAnonymous();

The code sample above starts a task for signing in anonymously, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_SignInAnonymous")
{
    if (ds_map_exists(async_load, "error"))
    {
        show_debug_message(async_load[?"error"]);
        exit;
    }

    show_debug_message("SignInAnonymous SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SignInAnonymousTelemetry

This function authenticates the Galaxy Peer anonymously. This authentication method enables the peer to send anonymous telemetry events. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_SignInAnonymousTelemetry()



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_SignInAnonymousTelemetry"
error String The error message; only if the request failed ✴️ OPTIONAL

Example:

GOG_User_SignInAnonymousTelemetry();

The code sample above starts a task for signing in anonymously (with anonymous telemetry), which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_SignInAnonymousTelemetry")
{
    if (ds_map_exists(async_load, "error"))
    {
        show_debug_message(async_load[?"error"]);
        exit;
    }

    show_debug_message("SignInAnonymousTelemetry SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SignInCredentials

This function authenticates the Galaxy Peer with specified user credentials. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_SignInCredentials(login, password)
Argument Type Description
login String The user's login.
password String The user's password.



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_SignInCredentials"
error String The error message; only if request failed ✴️ OPTIONAL

Example:

GOG_User_SignInServerKey(refreshToken);

The code sample above starts a task for signing in with credentials, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_SignInCredentials")
{
    if (ds_map_exists(async_load, "error"))
    {
        show_debug_message(async_load[?"error"]);
        exit;
    }

    show_debug_message("SignInToken SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SignInGalaxy

This function authenticates the Galaxy Peer based on Galaxy Client authentication. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_SignInGalaxy(requireOnline=undefined, timeout=undefined)
Argument Type Description
requireOnline Boolean OPTIONAL: Indicates if sing in with Galaxy backend is required.
timeout Real OPTIONAL: How much time to wait until giving up the login process



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_SignInGalaxy"
error String The error message; only if request failed ✴️ OPTIONAL

Example:

GOG_User_SignInGalaxy(false, 4); // don't require online, wait at least 4 seconds before giving up

The code sample above starts a task for signing in with galaxy client authentication, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_SignInGalaxy")
{
    if (ds_map_exists(async_load, "error"))
    {
        show_debug_message(async_load[?"error"]);
        exit;
    }

    show_debug_message("SignInGalaxy SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SignInLauncher

This function authenticates the Galaxy Peer based on launcher authentication. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_SignInLauncher()



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_SignInLauncher"
error String The error message; only if request failed ✴️ OPTIONAL

Example:

GOG_User_SignInLauncher();

The code sample above starts a task for signing in with launcher authentication, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_SignInLauncher")
{
    if (ds_map_exists(async_load, "error"))
    {
        show_debug_message(async_load[?"error"]);
        exit;
    }

    show_debug_message("SignInLauncher SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SignInServerKey

This function authenticates the Galaxy Peer with a specified server key. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_SignInServerKey(key)
Argument Type Description
key String The server key.



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_SignInServerKey"
error String The error message; only if request failed ✴️ OPTIONAL

Example:

GOG_User_SignInServerKey(key);

The code sample above starts a task for signing in using a server key, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_SignInServerKey")
{
    if (ds_map_exists(async_load, "error"))
    {
        show_debug_message(async_load[?"error"]);
        exit;
    }

    show_debug_message("SignInServerKey SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SignInToken

This function authenticates the Galaxy Peer with refresh token. This is an asynchronous function that will trigger a Social Async Event when the task is finished.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Social Async Event.


Syntax:

GOG_User_SignInToken(refreshToken)
Argument Type Description
refreshToken String The refresh token obtained from Galaxy login page.



Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GOG_User_SignInToken"
error String The error message; only if request failed ✴️ OPTIONAL

Example:

GOG_User_SignInToken(refreshToken);

The code sample above starts a task for signing in using a refresh token, which results can be caught inside a Social Async Event.

if (async_load[? "type"] == "GOG_User_SignInToken")
{
    if (ds_map_exists(async_load, "error"))
    {
        show_debug_message(async_load[?"error"]);
        exit;
    }

    show_debug_message("SignInToken SUCCESS");
}

This code sample provides an example of handling the returned callback data.




Back To Top

GOG_User_SignOut

This function signs the Galaxy Peer out.


Syntax:

GOG_User_SignOut()



Returns:

N/A


Example:

GOG_User_SignOut();

The code above provides a simple usage example.




Back To Top

GalaxyID

This structure represents a GOG ID (User or Lobby) and is used all across the GOG API as either a return value or function argument.

Warning

These values shouldn't be used or changed and are to be passed back into the extension to perform the desired actions.

This struct is referenced by the following functions:

This struct is referenced by the following structs:


Member Type Description
ID Real The real ID value.
IDType Real The type of the ID.


Back To Top

KeyValuePair

A struct containing a key-value pair.

This struct is referenced by the following functions:


Member Type Description
key String The name of the property of the user data storage.
value String The value of the property of the user data storage.