This function will send a request to the server for information on all current challenges and will trigger a callback Social Asynchronous Event which contains the async_load map populated with the relevant key/value pairs. The id key of this DS Map is used to identify the correct callback (there can be more than one trigger function for any given asynchronous event), and will be paired with the constant achievement_challenge_list_received as well as a number of other key/value pairs for each challenge. The exact contents of the map are shown below:
NOTE: This function is for iOS only.
| Constant | Description |
|---|---|
| achievement_filter_friends_only | Get only the scores of the players friends. |
| achievement_filter_all_players | Get all scores for all players. |
achievement_get_challenges()
N/A
The following code would probably be called after the player has logged into their game account using achievement_login():
achievement_get_challenges();
This will send off a request for the current challenge information and generate an asynchronous callback with the special async_load ds_map containing the following data:
var ident = ds_map_find_value(async_load, "id");
if ident == achievement_challenge_list_received
{
var numentries = ds_map_find_value(async_load,"numchallenges");
for(var i = 0; i < numentries; i++;)
{
player_id[i] = ds_map_find_value(async_load, "Challenge" + string(i)+"playerid");
issuer_id[i] = ds_map_find_value(async_load, "Challenge" + string(i) +"issuerid");
state[i]
= ds_map_find_value(async_load, "Challenge" + string(i)+"state");
message[i] = ds_map_find_value(async_load, "Challenge" + string(i)+"message");
date_completed[i] = ds_map_find_value(async_load,
"Challenge" + string(i)+"completeddate");
date_issued[i] = ds_map_find_value(async_load, "Challenge" + string(i)+"issueddate");
ach_type[i] = ds_map_find_value(async_load, "Challenge"
+ string(i)+"type");
ach_ident[i] = ds_map_find_value(async_load, "Challenge" + string(i)+"identifier");
ach_score[i] = ds_map_find_value(async_load, "Challenge" + string(i)+"score");
}
The above code checks the returned DS Map in the Social Asynchronous Event and if its "id" matches the constant being checked, it then loops through the map storing all the different values in a number of arrays. This information can then be used, for example, to create your own, personalised, challenge pages in game.