facebook_send_invite

Send an invite message to friends.

Syntax:

GML Code Example

facebook_send_invite(titlestring, msg, picture_url, redirect_url, ds_map_response);


Argument Description
titlestring The title of the dialog (a string)
msg The message which appears in the dialog (a string).
picture_url the url of the image to include in the dialog.
redirect_url The “SiteURL” of your app on the Facebook Developers app settings page.
ds_map_response A pre-created ds_map that is used to store the response details.


Returns: N/A


Description

With this function you can get your game to display a facebook “apprequests” dialog, which will allow your player to select friends from a list and send them a game invite message. The function requires that you supply a previously created ds_map which will then be populated with the relevant user details. This map should be polled every step after calling this function as the response could come through at any time, and when it does the map will should have a key "to" which will return a ds_list containing all the Facebook user IDs of those people invited (se extended example below for further details).

NOTE: The "SiteURL" is ignored on the iOS and Android modules and is only required on the HTML5 module if you are not hosting the application on the "SiteURL" (ie: you are testing locally).
NOTE: The user does not need to be logged in to use this function as the log in dialogue will be shown as part of the invite request.


Extended Example:

You can send a friends invite in the following way:

GML Code Example

if mouse_check_button_pressed(mb_left)
    {
    map = ds_map_create();
    facebook_send_invite("Catch The Haggis!", "Come and play Catch The Haggis with me...", "http://MacSweeneygames.com/Clown.jpg", "", map);
    }
 

The above code will display an "apprequest" dialogue where you can select friends to invite to play the game, and it also creates a ds_map to hold the Facebook IDs of the users that are invited. This then needs to be polled in the Step event of an instance to receive the results, like this:

GML Code Example

if ds_map_exists(map, "to")
    {
    var list = ds_map_find_value(map, "to");
    var size = ds_list_size(list);
    for(var i = 0; i < size; i++;)
       {
       fb_uid[i] = ds_list_find_value(list, i);
       }
    ds_map_clear(map);
    }
 

This code checks the ds_map for the key "to" and when it's added, it then accesses the ds-list that "to" contains and loops through it, setting the "fb_uid" array to hold the user IDs that have been returned.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here