h1k3's Forum Posts

  • I do realize there is some cleaning up to do. Such as removing those multiple calls to facebooklogout..... But I don't see how that would be making the currentstatus variable both true and false at the same time. Anyone?

  • I've got a condition for is logged in but every 5 seconds(When I call the action) it literally cycles through both true and inverted references.I'm completely stumped as to why this problem is occuring. Can someone please help me figure out what exactly I'm doing wrong here? I have a condition in the edittime as such:

    AddCondition(6,     0, "Is user logged in", "Login/Logout", "Is user logged in", "True if currently being viewed inside Facebook by a logged in user.", "IsLoggedIn");

    The condition in runtime is this:

    Cnds.prototype.IsLoggedIn = function ()

         {

              if(currentstatus == "Validated User"){return true;}

              else if(currentstatus == "Logged In No Install"){return false;}

              else if(currentstatus == "Not On Facebook"){return false;}

              else return false;

         };

    The declaration for currentstatus is at the very top:

    // ECMAScript 5 strict mode

    "use strict";

    assert2(cr, "cr namespace not created");

    assert2(cr.plugins_, "cr.plugins_ not created");

    var currentstatus = "unknown";

    The changing point for this currently is run from two spots, one is under the FB init function, and the second is a called action. Both are identical copies of each other. And here it is:

    FB.getLoginStatus(function(response) {

         if (response["status"] == 'connected') {

          // the user is logged in and has authenticated your

          // app, and response.authResponse supplies

          // the user's ID, a valid access token, a signed

          // request, and the time the access token

          // and signed request each expire

          fbStatus = "Validated User";

          fblogoutcheck = true;

           fbUserID = response["authResponse"]["userID"];

           UserAccessToken = response["authResponse"]["accessToken"];

           UserAccessTokenExpiresIn = response["authResponse"]["expiresIn"];

           UserSignedRequest = response["authResponse"]["signedRequest"];

           if(currentstatus != "Validated User"){currentstatus = "Validated User";fblogoutcheck = true;fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnLoggedIn, fbInst);}       

          fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnLoggedIn, fbInst);

          fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnAPILoaded, fbInst);

          }

          else if (response["status"] == 'not_authorized') {

         fblogoutcheck = false;

           fbStatus = "Logged In No Install";

           fbUserID = 0;

           UserAccessToken = "";

           UserAccessTokenExpiresIn = 0;

           UserSignedRequest = "";

           if(currentstatus != "Logged In No Install"){currentstatus = "Logged In No Install";fblogoutcheck = false;fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnNotInstalled, fbInst);}

           fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnNotInstalled, fbInst);

           fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnAPILoaded, fbInst);

           // the user is logged in to Facebook,

           // but has not authenticated your app

          } else if (response["status"] == 'unknown') {

         fbStatus = "Not On Facebook";

         fblogoutcheck = false;

         fbUserID = 0;

           UserAccessToken = "";

           UserAccessTokenExpiresIn = 0;

           UserSignedRequest = "";

           if(currentstatus != "Not On Facebook"){currentstatus = "Not On Facebook";fblogoutcheck = false;fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnFacebookOut, fbInst);}

           fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnFacebookOut, fbInst);

           fbRuntime.trigger(cr.plugins_.FBComplete.prototype.cnds.OnAPILoaded, fbInst);

        // the user isn't logged in to Facebook.

    }

    }, true);

  • That seems like a waste of processor using every tick. Do something like is explosion onscreen trigger once move to top.

  • Have you tested this plugin so far Joannesalfa

  • Joannesalfa ohhhhhhhhhhhh you mean before you fire a dialog you want a condition to verify login like

    Is player logged in

    On f key pressed

    Post message to wall

    Ill add that to tonight's upload.

  • Joannesalfa

    I just retread what you said. The event your looking for is there. On app user logged in is what your looking for. It fires once the user is "logged in"

  • The most important about event is "non-trigger; Is user logged in" it means you already logged in before the game starts, it won't work to share some stuff on wall.   

    Joannesalfa the three triggers on there will work to check for API load in the meantime but I am testing an update right now with API loaded and name available conditions. So it should be posted in a couple more hours.

  • New version 0.18:

    Includes three new trigger conditions:

    On App User Logged In: This will trigger whenever a user first accepts permissions(installs your app) or when their status changes to reflect this(user accepted permission on a different browser/machine) Note you need to use the update status action to fetch the users current status.

    On App Not Installed This will trigger whenever a user first removes/denies permissions(uninstalls/rejects your app permissions) or when their status changes to reflect this(user rejected/uninstalled permissions on a different browser/machine) Note you need to use the update status action to fetch the users current status.

    On Facebook Logged Out This will trigger whenever a user is not logged into Facebook in this specific browser window. Users can log out of other Browsers and this will not trigger until the user logs out of Facebook in the current window. Note you need to use the update status action to fetch the users current status.

  • Ashley,

    I'm working on rebuilding the facebook plugin and would gladly add an onfocus/unfocus condition. Can you point me to information on checking for focus or do you have an idea on what to add? I'm thinking it should be a trigger event so when it loses focus it fires the condition(onfocus). Is this in the browser plugin for me to look at by any chance?

    My plugin link

  • Never mind, I figured it out :) goofball moment

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • What would be the best way to tie a variable change to a conditional event trigger? IE the window.addeventlistener which doesnt accept variable changes. How can I trigger an event on variable changes. So

    var a = '1'

    when var a changes to '2' trigger the condition.

  • Don't you plan to integrate official facebook plugin conditions and actions?

    Joannesalfa Yes thats why scores and wall posting are first on the list for actions. So that along with the app requests will bring me past the point of the official for actions. As far as conditions. I'll see about adding those first because you are right, they are sorely lagging in this plugin.:) There just not as much fun for me to code. :(

  • I plan on adding everything Facebook. I had just considered dropping the javascript login though because from what I can see its not compatible with the new requirement that you need to catch and handle denied permissions at login. Other then that if Facebook allows it ill eventually be adding it.

  • Index

    It should all work fine ATM. I'm working on the scores next, then app requests, followed by wall posting. That should bring this up to par with the official plugin and avoid using the app secret. As well as work with all the pesky breaking changes Facebook keeps rolling out. Ill probably add the javascript(non redirect) login as well but I can't seem to find info on how you use it to handle revoked permissions like Facebook requires now. So I'd recommend avoiding that way for the time being.

  • Ahhhhhhhhhh omg lol that was way to easy. Thanks :)