This event can only be triggered by the various specific
Functions and will return a ds_map
stored in the variable async_load, containing different
key/value pairs depending on the callback from the function that
has triggered the event.
The ds_map will contain a number of keys, the most important of which is the "id" key. This will return a constant which can then be checked in code to determine which of the many callbacks the event has received. Once you have parsed this key and compared the value returned with the available constants, you can then continue to extract the rest of the information from the map.
The function pages on Social Gaming - Achievements and Leaderboards in the Reference section detail the functions and callbacks as well as the constants used to trigger this event, but there are also certain circumstances in which it will be triggered without a function call from the game that is running:
- when your game is launched from the OS dashboard
- when you complete a challenge
- when another player completes a challenge
- when the game is started from the OS dashboard by selecting a challenge
Any of the above callbacks will trigger the Social Event and an async_load map will be generated with the following details (note that there is a different "id" key value to define each of the different reasons that the event was called, but all other contents of the map are the same):
- "id" - The value of this key will depend on the type of callback triggering the event. it can be one of these constants:
- achievement_challenge_received - A challenge has been received
- achievement_challenge_completed - A challenge has been completed.
- achievement_challenge_completed_by_remote - A challenge has been completed by the other player.
- achievement_challenge_launched - The game was launched from the OS dashboard with the given challenge.
- "playerid" - The player id for the challenge.
- "issuerid" - The id of the person that issued the challenge.
- "state" - The state of the challenge, which will have a value of 0 - 3 (as a string) for invalid, pending, completed or declined.
- "message" - The text message for challenge.
- "issueddate" - The issue date for challenge
- "completeddate" - The completion date for challenge.
- "type" - The type of challenge given. Can be one of two constants:
- achievement_type_score_challenge - A challenge based on the score value.
- achievement_type_achievement_challenge - A challenge based on an achievement.
- "identifier" - The identifying string for the challenge.
- "score" - The score tied in with the challenge.
var ident = ds_map_find_value(async_load, "id"
if ident == achievement_challenge_completed;
player_id = ds_map_find_value(async_load, "playerid");
issuer_id = ds_map_find_value(async_load, "issuerid");
state = ds_map_find_value(async_load, "state");
date_completed = ds_map_find_value(async_load, "completeddate");
date_issued = ds_map_find_value(async_load, "issueddate");
ach_type = ds_map_find_value(async_load, "type");
ach_ident = ds_map_find_value(async_load, "identifier");
ach_score = ds_map_find_value(async_load, "score");
NOTE: The variable async_load is only valid
in the asynchronous events, as the ds_map that is points
to is created at the start of the event, then deleted again at the
end, with this variable being reset to a value of -1. However, all
further data-structures created from the event must be cleaned
up using the appropriate functions.
Some of the Facebook functions will trigger a social asynchronous event and create a ds_map with some specific information. The information returned will depend on the "type" of event that has been called. You can check this by reading the "type" key from the ds_map, which will be the following string for a Facebook event:
When the event is triggered and is of this type, there will also be additional keys that can be checked:
- "requestId" - The request ID value returned by the facebook_request_xxx_permission() function that triggered the event
- "result" - This will be one of the following strings:
- "granted" â€“ permission(s) were accepted by the user
- "denied" â€“ one or more permissions were not accepted by user
- "error" â€“ an error occurred
- "error" - This will contain a description of the error, but is only present when "result" = "error".