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!