[Unsupported] Facebook Mobile Extension - OpenFL

zohaibhisam

  • Posts: 67
David,
getting the following error when i try to compile with only the facebook id and keyhash call (no post called yet).

Unexpected problem on thread Thread-13: String index out of range: -2
java.lang.StringIndexOutOfBoundsException: String index out of range: -2
   at java.lang.String.substring(Unknown Source)
   at stencyl.sw.io.write.resource.HXWriter.parseErrors(HXWriter.java:2677)
   at stencyl.sw.io.write.resource.HXWriter.parseForErrors(HXWriter.java:2639)
   at stencyl.sw.io.write.resource.HXWriter$9.run(HXWriter.java:3434)
   at stencyl.sw.util.StreamGobbler.run(StreamGobbler.java:102)

 - neko 2.0 updated
 - inthebox macros 1.04 installed.
- android - using stencyl 3.2 7598.

i think i wasnt supposed to test yet, the fix is still partial. Still, just wanted droid readers to know the current status.
help appreciated, thanks. Please confirm on thread once it works, so i can update my builds.

z
Games (Droid)

zohaibhisam

  • Posts: 67
After copying the intheboxmacros 1.4 files directly into the facebook extension folder ( i copied them into plaf/haxe folder as well), the game compiles properly, generated a keyhash too. but on the dialogue call, the dialogue box (for posting) is not displayed. debug key generated and submitted to FB, id etc. generated properly as well.

logs generate the following:

Level:     INFO
When:      2014-08-09 17:45:48
From:      stencyl.sw.util.StreamGobbler

I/trace   (28135): HypFacebook.hx:73: bSessionValid ::: false

hope this helps.

z
Games (Droid)

RedEvo

  • Posts: 325
Thanks a lot, will be very helpful.
Nowadays I've no time to check this extension, I've a vertical commitment to making visual effects.
Hope to have time about a full check of this extension really soon.

David.
Launching RedemptionTCG Android Alpha. If you are interested contact us at info@redevogames.com

andyvene

  • *
  • Posts: 123
Hi David and Z,
Please,  can you tell me how to take as an attribute text the TOKEN from your extension after login. 
I think this is the most important thing to do.
Would be great to have a stencyl block named token. 
After that with Http GET and POST can do anything.
Thanks.
A

andyvene

  • *
  • Posts: 123
After a couple days, I've managed to modify the extension to allow my games to 'LIKE' a URL link and post it to a user's timeline.

Start by modifying the FacebookExtension.hx file found in:
"[Stencyl Install Location]\plaf\haxe\extensions\facebook\FacebookExtension.hx"

Add:
Code: [Select]
public static var _likeActionInstance: String;
public static var _error: String;

public static function facebookLikeUrl(URL: String){
//Add a listener to run after the data is retreived
fb.addEventListener( HypFacebookRequestEvent.GRAPH_REQUEST_RESULTS, _onLikeComplete );

var arr:Array<String> = ["publish_actions"];
fb.requestNew_publish_permissions(arr);

var h = new Map<String,String>( );
h.set( 'object', URL ); //Set the URL to like


fb.call( GRAPH_REQUEST("/v2.0/me/og.likes", h , POST) );
}
public static function _onLikeComplete( event : HypFacebookRequestEvent ) : Void {
_likeActionInstance = event.sResult;
_error = event.sError;
    }
    public static function getLikeStatusInstance (): String{ return _likeActionInstance; }
  public static function getLastErrorMessage (): String { return _error; }

Then add the following code to the blocks.xml file located:
"[Stencyl Install Location]\plaf\haxe\extensions\facebook\blocks.xml"

Code: [Select]
<block tag="fb-like" spec="Facebook User Likes URL: %0" code="FacebokExtension.facebookLikeUrl(~);" type="action" color="blue" returns="void">
<fields>
<text order="0"></text>
</fields>
</block>
<block tag="fb-like-instance" spec="Get Like Action Instance" code="FacebokExtension.getLikeStatusInstance()" type="normal" color="gray" returns="text">
<fields></fields>
</block>

<block tag="fb-last-error" spec="Get Last Error" code="FacebokExtension.getLastErrorMessage()" type="normal" color="gray" returns="text">
<fields></fields>
</block>

Close any existing game and reopen.  New blocks will be available in the Custom block location.
After a couple days, I've managed to modify the extension to allow my games to 'LIKE' a URL link and post it to a user's timeline.

Start by modifying the FacebookExtension.hx file found in:
"[Stencyl Install Location]\plaf\haxe\extensions\facebook\FacebookExtension.hx"

Add:
Code: [Select]
public static var _likeActionInstance: String;
public static var _error: String;

public static function facebookLikeUrl(URL: String){
//Add a listener to run after the data is retreived
fb.addEventListener( HypFacebookRequestEvent.GRAPH_REQUEST_RESULTS, _onLikeComplete );

var arr:Array<String> = ["publish_actions"];
fb.requestNew_publish_permissions(arr);

var h = new Map<String,String>( );
h.set( 'object', URL ); //Set the URL to like


fb.call( GRAPH_REQUEST("/v2.0/me/og.likes", h , POST) );
}
public static function _onLikeComplete( event : HypFacebookRequestEvent ) : Void {
_likeActionInstance = event.sResult;
_error = event.sError;
    }
    public static function getLikeStatusInstance (): String{ return _likeActionInstance; }
  public static function getLastErrorMessage (): String { return _error; }

Then add the following code to the blocks.xml file located:
"[Stencyl Install Location]\plaf\haxe\extensions\facebook\blocks.xml"

Code: [Select]
<block tag="fb-like" spec="Facebook User Likes URL: %0" code="FacebokExtension.facebookLikeUrl(~);" type="action" color="blue" returns="void">
<fields>
<text order="0"></text>
</fields>
</block>
<block tag="fb-like-instance" spec="Get Like Action Instance" code="FacebokExtension.getLikeStatusInstance()" type="normal" color="gray" returns="text">
<fields></fields>
</block>

<block tag="fb-last-error" spec="Get Last Error" code="FacebokExtension.getLastErrorMessage()" type="normal" color="gray" returns="text">
<fields></fields>
</block>

Close any existing game and reopen.  New blocks will be available in the Custom block location.
After a couple days, I've managed to modify the extension to allow my games to 'LIKE' a URL link and post it to a user's timeline.

Start by modifying the FacebookExtension.hx file found in:
"[Stencyl Install Location]\plaf\haxe\extensions\facebook\FacebookExtension.hx"

Add:
Code: [Select]
public static var _likeActionInstance: String;
public static var _error: String;

public static function facebookLikeUrl(URL: String){
//Add a listener to run after the data is retreived
fb.addEventListener( HypFacebookRequestEvent.GRAPH_REQUEST_RESULTS, _onLikeComplete );

var arr:Array<String> = ["publish_actions"];
fb.requestNew_publish_permissions(arr);

var h = new Map<String,String>( );
h.set( 'object', URL ); //Set the URL to like


fb.call( GRAPH_REQUEST("/v2.0/me/og.likes", h , POST) );
}
public static function _onLikeComplete( event : HypFacebookRequestEvent ) : Void {
_likeActionInstance = event.sResult;
_error = event.sError;
    }
    public static function getLikeStatusInstance (): String{ return _likeActionInstance; }
  public static function getLastErrorMessage (): String { return _error; }

Then add the following code to the blocks.xml file located:
"[Stencyl Install Location]\plaf\haxe\extensions\facebook\blocks.xml"

Code: [Select]
<block tag="fb-like" spec="Facebook User Likes URL: %0" code="FacebokExtension.facebookLikeUrl(~);" type="action" color="blue" returns="void">
<fields>
<text order="0"></text>
</fields>
</block>
<block tag="fb-like-instance" spec="Get Like Action Instance" code="FacebokExtension.getLikeStatusInstance()" type="normal" color="gray" returns="text">
<fields></fields>
</block>

<block tag="fb-last-error" spec="Get Last Error" code="FacebokExtension.getLastErrorMessage()" type="normal" color="gray" returns="text">
<fields></fields>
</block>

Close any existing game and reopen.  New blocks will be available in the Custom block location.

Hello.
I saw you made a block for posting to fb timeline.
Please can you make one to define the access token. So to have it in stencyl as global attribute.
Actually this is the only thing important cause inside stencyl I just made with http post get , everything.: Token validity , leaderboard design of friends , login, posting to fb timeline  and works really well. Just with hTTP POST GET.
BUT I use my php site response to retreive the token.
Would be really nice.
Thanks.

QkyGames

  • Posts: 125
Hi guys,

new news about sending and reading scores?

Regards.
Maxi.

zohaibhisam

  • Posts: 67
David
I have a build coming up in 10 days, would really appreciate an update for 3.2 , dont wanna release without it. Willing to help anyway i can. All the best,

Z
Games (Droid)

andyvene

  • *
  • Posts: 123
David
I have a build coming up in 10 days, would really appreciate an update for 3.2 , dont wanna release without it. Willing to help anyway i can. All the best,

Z

Hello Z,
please can you tell me if you can make work a GRAPH REQUEST /ME and have the response back with the listener ?
For me doesn't work.
The response in stencil works if i give a variable of mine like "HELLO". But it doesn't work with      _myvar = event.sResult.
Is always null. So i think the GRAPH response or actually POST is doing nothing.
I am working on iOS.
Maybe there is a problem with the hypfacebook and Facebook sdk etc......
I mean the Haxe code in facebookextension.hx works really great and gives results back in stencil.
I would appreciate your help. I followed all the steps as you said before to install macros etc. No compile errors.

Thanks
Andrew

andyvene

  • *
  • Posts: 123
David
I have a build coming up in 10 days, would really appreciate an update for 3.2 , dont wanna release without it. Willing to help anyway i can. All the best,

Z


Hello Z,
please can you tell me if you can make work a GRAPH REQUEST /ME and have the response back with the listener ?
For me doesn't work.
The response in stencil works if i give a variable of mine like "HELLO". But it doesn't work with      _myvar = event.sResult.
Is always null. So i think the GRAPH response or actually POST is doing nothing.
I am working on iOS.
Maybe there is a problem with the hypfacebook and Facebook sdk etc......
I mean the Haxe code in facebookextension.hx works really great and gives results back in stencil.
I would appreciate your help. I followed all the steps as you said before to install macros etc. No compile errors.

Thanks
Andrew

One other thing for ios. in the file Hypfacebook.hx
I saw that for iOS the all the @CPPs        are defined       @CPP("HypFacebook") for all functions.
instead for android is defined @JNI("fr.hyperfiction.HypFacebook","connect") for each function different.

This must be wrong for iOS.  How application understand which function is for which ?

Please if you can help me David or Z.
Thanks

zohaibhisam

  • Posts: 67
Andrew, david is the guy who made the plugin. Im just using it and im not exactly sure how it works. The plugin was working perfectly for stencyl 3.0, due to the new admob sdk all of us have had to move to stencyl 3.2 and now there are some compatibility issues. The only progress ive made so far for 3.2 is that there are no compile errors, but the facebook post dialogue doesnt appear when the post block is called within stencyl.

David is the only guy who can help out ATM. Lets hope he finds time to get this up n running.
Games (Droid)

andyvene

  • *
  • Posts: 123
Andrew, david is the guy who made the plugin. Im just using it and im not exactly sure how it works. The plugin was working perfectly for stencyl 3.0, due to the new admob sdk all of us have had to move to stencyl 3.2 and now there are some compatibility issues. The only progress ive made so far for 3.2 is that there are no compile errors, but the facebook post dialogue doesnt appear when the post block is called within stencyl.

David is the only guy who can help out ATM. Lets hope he finds time to get this up n running.


Hello Z.  Thanks for you reply.  Actually the post block works for me.  I am with Stencyl 3.1. 
The thing that doesn't work is when you make a direct request lets say post score or graph/Me. 
There is no response.  Either  method I use Post or Get. 

As far as I understood is that there is a problem not with the modules other guys have created in this forum like GET PLAYER DATA OR GET FRIENDS DATA  from a user like us in this forum or post score from another user also , But I think there is no communication with FB sdk. Or other module.
  The POST dialog that works is BECAUSE the login and the post is made within the browser dialog that appears.   The dialog that appears is a real browser.  actually you can navigate in pages.
So I think we have to search deeper. 
I mean between hypfacebook.hx and actually where the actions go. 
@cpp and @inij are the connections direct to facebook sdk commands like Fbaccesstoken etc of the facebook sdk.

Hope to make it work.  Actually I only need to take the token. 
Cause inside stencyl I just created a fully working post a share score ,challenge and full leaderboard design like candy crash.  The only thing is that I take my token and  with a php site automatic to stencyl and all is working really great. 
But I won't to get rid of the site for the token. 

Thanks
Andrew. 

Eriko

  • Posts: 159
Please, somebody help! This is what i get when using the extension on Android 2.3.4. The title, caption or description won't show. What should i do?

QkyGames

  • Posts: 125
Hi there,

someone managed to use the functions to read data from the player data and friends?
lists always return with null.

sorry for my English.
Maxi.

zohaibhisam

  • Posts: 67
still not working for 3.2 (build 7598) - Request the stencyl team to turn this to a built in feature, please.
Games (Droid)

zohaibhisam

  • Posts: 67
Guys, ive put up a feature request at the stencyl update forums for this plugin to be made an official part of all stencyl releases, so all of us including david can benefit from it without version issues each time core stencyl upgrades.

Please show your support for this feature request here:
http://community.stencyl.com/index.php/topic,34671.0.html
Games (Droid)