I’m trying to use a JavaScript event to share a score or a page to Facebook.
I’ve put this code in the event and the game just freezes when it gets there.
I think I also need to install the Facebook SDK.
Is what I’m trying to do possible? Should I just stop now?
You can refer to a ready-made example in GDevelop
It’s under the
Examples category when you try to create a new project.
1 Like
Thanks @Nilarjun .
I’ve looked at that example so many times but I can’t work out where the share component is. Could you give me a hint?
I’ve worked out how to put a simple share button within the open URL event:
“Redirecting... ”
This takes you to my FB page for Home For Dinner.
And I learned about it from: The Simplest (and Most Performant) Way to Offer Sharing Links for Social Media | CSS-Tricks - CSS-Tricks
Now, I’m going to work out how to link the variables with the Facebook Instant Game example.
1 Like
What I want to do is share a score variable or leaderboard position to a regular Facebook post with just one click.
1 Like
Hello, Baylissimo hope you can help me with how to do it
1 Like
Hello googleAlex
I don’t know how to share the score, only able to open up a URL.
Hi, @Nilarjun .
Could you show me how to share the scores to Facebook from the mentioned example?
Cheers
@Baylissimo So first of all, you need to publish the game to Facebook Instant Games.
Link: http://wiki.compilgames.net/doku.php/gdevelop5/publishing/publishing-to-facebook-instant-games
You also need to create a Leader-board to store the scores.
Once you have done that, you can easily follow that example to load and store players’ scores.
This event in the example stores the score of a particular player when the “Save_BTN”
button is clicked.
Here the name of the leader-board created was “Win”, so change the variables according to your needs.
1 Like
Hi @Nilarjun
That is really cool for working within the game.
I’m asking how to share that variable across to a Facebook post.
For example, you get a high score in a game. There is a share button and you press it.
Then it shares it to your Facebook post so all your friends can see it.
This then leads to other people playing the game.
Oh, well there is no feature in GDevelop for that, so you have to add custom code for it.
See: How to share score on facebook wall through Facebook Connect? - Stack Overflow
1 Like
Thanks. That’s why I had the code from the FB SDK in original post. Trying to work out how to get Gdevelop to work alongside all of FB’s functionalities.
Sorry, the question should have been Share scores in Facebook from Instant Games.
I have to be more specific with my questions.
So, I’m trying to work out if I can use trigger the Feed Dialog from FB.ui with a custom variable that I pluck from my Leaderboard.
Can I access the Facebook SDK from Gdevelop? Do I need to include it with my files then refer to it?
I think I’m out of my depth.
Does is have to have the good_var and error_var?
Mine does not save to the leaderboards
kiba095
February 19, 2020, 1:06pm
17
Progress? Updates? Anyone had a luck implementing this?
1 Like
I tried to do so by passing the variable into the url link when sharing on fb. so i append the score from the game as text in the url which is in the share dialog for FB and twitter. There were some issues in different devices’ compatibility though.
1 Like