FANDOM


Create a New Facebook ApplicationEdit

To connect your game to facebook you need to create a new facebook app by going to www.facebook.com/developers [11]. From there you can click the "Set Up New Application Button". After naming your new app, you'll be directed to the settings page. Here you will need to copy your new applications API Key. This is your unique identifier that the wild pockets plugin must know in order to make calls in your applications name.

From the settings page, the only other thing that you must do is under the Connect tab, change the Connect URL to 'www.wildpockets.com/' (Note: Be sure to include the trailing slash). This will allow the plugin to make requests from that url.


Link your Pocket with your Facebook App Edit

Now that the facebook application is set up, you'll need to store you're API Key in the pocket that you'll be using. From the builder, go to your scenes Global Properties and under the Script tab you'll find a place to enter your facebook API Key that you acquired from your facebook application settings page. Now the facebook class has everything it needs to link it to your application.


Using the Facebook Class Edit

In order to use functions that request and post data the player must first authorize your application. Calling the function Facebook.requestLogin() will open an external page where the user can log into facebook. After they have logged in Facebook.isLoggedIn() will return true.

Now you can use some of the request/publish functions freely. One example is the Facebook.getFriendsInfo() function. This function accepts 2 arguments, a string of fields to get and a callback function. The string of fields is a comma separated list of fields such as ("name,birthday,sex"). A list of all the possible fields can be found in facebooks REST API documentation for users.getInfo.

Facebook Documentation for users.getInfo : http://wiki.developers.facebook.com/index.php/Users.getInfo [12]

The callback function will be called when the request is satisfied with two arguments, the result table and an error string. If the error string is nil, the call was a success and the table should contain a list of friend tables, each with keys matching your fields.

So an example call to request friends information would look like the following:

function receiveInfo(results, err)      if err ~= nil then              print ("Error : ", err)         else            for k,v in pairs(results) do                    print (v.name .. " - " .. v.sex)                end     end end  Facebook.getFriendsInfo( "name,birthday,sex" , receiveInfo )

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.