Skip to content

SavedGames

Francisco Dias edited this page Apr 9, 2024 · 3 revisions

SavedGames

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

GameCenter_SavedGames_Fetch

This function requests the Apple GameCenter API to fetch all the existing saved slots. The function will not return any value but it will create a request that will trigger a Social Async Event callback when the task is resolved.

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:

GameCenter_SavedGames_Fetch()

Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GameCenter_SavedGames_Fetch"
success Boolean Whether or not the task succeeded.
slots String A JSON formatted string with an array of SlotJSON (can be parsed into a struct using json_parse)

Example:

GameCenter_SavedGames_Fetch();



Back To Top

GameCenter_SavedGames_Save

This function requests the Apple GameCenter API to save a data string to a save slot. If the slot doesn't exist it gets created (if it exists data is overwritten). The function will not return any value but it will create a request that will trigger a Social Async Event callback when the task is resolved.

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:

GameCenter_SavedGames_Save(name, data)
Argument Type Description
name String The unique identifier of the save game slot.
data String The data string to be saved. Note that you can save complex data by using structs/arrays/maps/lists and converting them to strings.

Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GameCenter_SavedGames_Save"
success Boolean Whether or not the task succeeded.
name Real The unique identifier of the save game slot.
slots String A JSON formatted string following the SlotJSON structure. (can be parsed into a struct using json_parse)

Example:

GameCenter_SavedGames_Save(name, data);



Back To Top

GameCenter_SavedGames_Delete

This function requests the Apple GameCenter API to delete an existing save slot with the given name. The function will not return any value but it will create a request that will trigger a Social Async Event callback when the task is resolved.

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:

GameCenter_SavedGames_Delete(name)
Argument Type Description
name String The unique identifier of the save game slot.

Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GameCenter_SavedGames_Delete"
success Boolean Whether or not the task succeeded.

Example:

GameCenter_SavedGames_Delete(name);



Back To Top

GameCenter_SavedGames_GetData

This function requests the Apple GameCenter API to get the data string saved inside a given save slot. The function will not return any value but it will create a request that will trigger a Social Async Event callback when the task is resolved.

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:

GameCenter_SavedGames_GetData(name)
Argument Type Description
name String The unique identifier of the save game slot.

Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GameCenter_SavedGames_GetData"
success Boolean Whether or not the task succeeded.
data String The data stored inside the save slot.

Example:

GameCenter_SavedGames_GetData(name);



Back To Top

GameCenter_SavedGames_ResolveConflict

This function requests the Apple GameCenter API to perform a conflict resolution given a conflict id. The function will not return any value but it will create a request that will trigger a Social Async Event callback when the task is resolved.

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:

GameCenter_SavedGames_ResolveConflict(conflict_id, data)
Argument Type Description
conflict_id Real The unique identifier of the conflict.
data String A string containing the data you want to save (note that you can use a JSON formatted string to store data)

Returns:

N/A


Triggers:

Social Async Event

Key Type Description
type String "GameCenter_SavedGames_ResolveConflict"
success Boolean Whether or not the task succeeded.
conflictIndex Real The unique identification index of the resolved conflict.

Example:

GameCenter_SavedGames_ResolveConflict(conflict_id, data);



Back To Top

SlotJSON


Member Type Description
playerID String A unique identifier for a player of the game.
deviceName String The name of the device that the player used to save the game.
modificationDate Date The date when you saved the game data or modified it.
name String The name of the saved game.