Argument Description char The id of the person to get the image of (either from a friends list or a leaderboard)
This function will send a request to the server for the image of a player or a friend 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_pic_loaded as well as a number of other key/value pairs. The exact contents of the map are shown below:
- "id" - For this function it should be achievement_pic_loaded
- "playerid" - The id of the player or friend that we are receiving the image of.
- "spriteid" - The sprite id for the image that can then be used to draw it on-screen using any of the draw sprite functions
NOTE: This function is for iOS only.WARNING: This function creates sprites and as such, their ids should be stored in variables and then removed from memory using the sprite_delete function otherwise repeated use will give you a memory leak that will eventually slow down or crash your game.
The following code would be called after you have gotten a friends list or a leaderboards list using achievement_load_friends or achievement_load_leaderboard. Those functions will return unique "id" values for each person, which are then used in the function to retrieve the profile picture for them:
This will send off a request for the image associated with the player id stored in the global array and generate an asynchronous callback with the special async_load ds_map containing the following data:
var ident = ds_map_find_value(async_load,
if ident == achievement_pic_loaded
var picid = ds_map_find_value(async_load, "playerid");
var spriteid = ds_map_find_value(async_load, "spriteid");
if global.playerid == picid)
global.playerpic = spriteid;
The above code checks the returned ds_map in the Social Asynchronous Event and if its "id" matches the constant being checked, it then checks that the id associated with the image is the same as that being requested and if it is, it sets another global array to hold the unique id for the image (which can be used to draw the image as a sprite).