edit global variable using Execute javascript action(SOLVED)

0 favourites
From the Asset Store
Globals 2.0
$3.60 USD
10% off
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Aphrodite

    I really would prefer the method that you mentioned since it seems to be the most cleanest way of doing what I'm trying to accomplish. But it seems I can't call the function on C2 using the execute javascript(), or I think I'm doing it wrong, which is probably the case if it is possible.

    Here's an image of what I just tried:

    deadlink[/img]

    EDIT***** I did put a semicolon in the execute javascript command for the function, I foregot to update image.

    I think this is what the function is doing:

    does a function call to receive two functions, "success and failure" which is linked to two buttons in the sdk ("yes button" and "no button". When yes is clicked it does a call to the success function. The same success function sent to the fgl.inApp.initiateUnlockFunction(). When no is clicked it does a call to the failure function.

    Here's the pseudo:

    fgl.inApp.initiateUnlockFunction(function onSuccess,function onFailure)

    R0J0hound

    It does work in general but I can't seem to get it working with fgl's function calls. Could be due to my lack of javascript knowledge. Which wasn't that great to begin with.

    Here's an image of what I just tried:

    deadlink[/img]

    Is it not working because it can't find this.premium? since it was executing from fgl's sdk? I could post the error I get from google chrome from both examples, if it helps anyone understand the problem.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Aphrodite

    I really would prefer the method that you mentioned since it seems to be the most cleanest way of doing what I'm trying to accomplish. But it seems I can't call the function on C2 using the execute javascript(), or I think I'm doing it wrong, which is probably the case if it is possible.

    Here's an image of what I just tried:

    EDIT***** I did put a semicolon in the execute javascript command for the function, I foregot to update image.

    I think this is what the function is doing:

    does a function call to receive two functions, "success and failure" which is linked to two buttons in the sdk ("yes button" and "no button". When yes is clicked it does a call to the success function. The same success function sent to the fgl.inApp.initiateUnlockFunction(). When no is clicked it does a call to the failure function.

    Here's the pseudo:

    fgl.inApp.initiateUnlockFunction(function onSuccess,function onFailure)

    R0J0hound

    It does work in general but I can't seem to get it working with fgl's function calls. Could be due to my lack of javascript knowledge. Which wasn't that great to begin with.

    Here's an image of what I just tried:

    Is it not working because it can't find this.premium? since it was executing from fgl's sdk? I could post the error I get from google chrome from both examples, if it helps anyone understand the problem.

    I am wrong I think concerning the function calling, It doesn t seems to be as easy as that(we would have to know if it is possible to call a function in execute javascript), but I still think that if it is possible, it would be the best way to do it (it could help in that kind of case when people have to use a execute javascript for the API)

    Sadly I don t know how to do this

  • Aphrodite

    "Sadly I don t know how to do this"

    That's alright, I appreciate the input though. I'm trying to edit the javascript variable through a function in the script tag, hopefully that works.

  • Got it working using a script tag so this thread can die peacefully. I appreciate all the help and suggestions.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)