facebook_send_invite

Send an invite message to friends.

Syntax:

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:

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:

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.


Back: Facebook
Next: facebook_post_message
© Copyright YoYo Games Ltd. 2018 All Rights Reserved