achievement_load_friends()
Returns: N/A
This function will send a request to the server for information on all the logged in users friends 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_friends_info as well as a number of other key/value pairs for each friend. The exact contents of the map are shown below:
- "id" - For this function it should be achievement_friends_info
- "FriendN" - The name of the friend, where "N" is an integer value corresponding to their position within the friends list.
- "FriendidN" - The unique user id of the friend, "N".
NOTE: This function is for iOS only.
The following code would probably be called after the player has logged into their game account using achievement_login to get a list of all that users friends:
achievement_friends_info();
This will send off a request for the information on the users friends 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_friends_info
{
var numfriends = ds_map_find_value(async_load,
"numfriends");
global.numfriends = numfriends;
for(var i=0; i < numfriends; i++;)
{
global.friendname[i] =
ds_map_find_value(async_load, "Friend" + string(i));
global.friendid[i] =
ds_map_find_value(async_load, "Friendid" + string(i));
achievement_get_pic(global.friendid[i]);
}
}
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 and requests an image for each of the entries in the map (see achievement_get_pic).