FoozleCC's Recent Forum Activity

  • Thanks for the quick reply!

    I was attempting to implement something similar to this. I have what is needed on the event sheet but what I run into is that "runtime" is not defined. I am not positive on what the best way is to ensure it is defined, any suggestions?

    Below is current callback function:

    var LoginCallback = function (result, error) {
     if (result !== null) {
    		console.log("It worked! Log");
    		var sessionTicket = result.data.SessionTicket;
    		runtime.callFunction("LoginWithCustomID_Results",sessionTicket)
    		//return "TESTING" //this doesn't work
     } else if (error !== null) {
    		console.log("It didn't worked! Log");
     return "Something went wrong with your first API call.\n" +
     "Here's some debug information:\n" +
     PlayFab.GenerateErrorReport(error);
     }
    }
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello all - new to Construct 3 but have been enjoying the engine so far. I was working through some examples and successfully used the PlayFab javascript SDK for LoginWithCustomID. What I am not sure however, is what the best way within construct to pass the results from a javascript file back into event sheets.

    My initial thought was to use the runtime.callFunction to an eventsheet function that accepted the results as an argument but runtime is not defined. The line below generates a promise but I am not sure how best to await / get the results back from the call back:

    PlayFabClientSDK.LoginWithCustomID(loginRequest, LoginCallback)
    

    full .js example (this is called by an event sheet function and in dev tools I can see the results, just don't know how to appropriately return it):

    function DoExampleLoginWithCustomID(f_Title_ID,f_Custom_ID){
     PlayFab.settings.titleId = f_Title_ID;
     var loginRequest = {
     // Currently, you need to look up the correct format for this object in the API-docs:
     // https://api.playfab.com/documentation/Client/method/LoginWithCustomID
     TitleId: PlayFab.settings.titleId,
     CustomId: f_Custom_ID,
     CreateAccount: true
     };
    
    
    	PlayFabClientSDK.LoginWithCustomID(loginRequest, LoginCallback)
    	
    }
    
    var LoginCallback = function (result, error) {
     if (result !== null) {
    		console.log("It worked! Log");
    		
    		return result //this doesn't work
    		
     } else if (error !== null) {
    		console.log("It didn't worked! Log");
     return "Something went wrong with your first API call.\n" +
     "Here's some debug information:\n" +
     PlayFab.GenerateErrorReport(error);
     }
    }
    

    Thanks for any help you can offer!

    Tagged:

FoozleCC's avatar

FoozleCC

Member since 4 Dec, 2019

Twitter
FoozleCC has 4 followers

Connect with FoozleCC

Trophy Case

  • 5-Year Club
  • Entrepreneur Sold something in the asset store
  • Jupiter Mission Supports Gordon's mission to Jupiter
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

10/44
How to earn trophies