Problem with function's input parameter after calling another function

0 favourites
  • 3 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • I call function and give it an input parameter. Inside that function I call another function and give it same parameter. Somehow after completing second function input parameter changes to 0.

    I've added varible 'xxx' for debugging. In this situation everything is perfect and 'xxx' with every function call takes input parameter value. If I place 'xxx' after function call but before signal then it will work same way.

    Signal comes from second function. It contols if it's completed (checks values of inside variables). If I place 'xxx' after signal then on first function call 'xxx' won't get input parameter's value. On second and all next function's calls 'xxx' will be 0.

    I can solve problem easily by making global variable containing input value, but I want to understand logic behind described situation.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think I know the answer:

    Once you use a "wait" action, even if you used "wait 1 second", the function parameters will not be stored, so you will end up with "0" if you put "function.param(0)" after the wait action.

    This is fixed in C3 I believe, where "wait" actions will still remember the parameters.

    But yes, storing the value elsewhere like you said, is a fair workaround.

  • I think I know the answer:

    Once you use a "wait" action, even if you used "wait 1 second", the function parameters will not be stored, so you will end up with "0" if you put "function.param(0)" after the wait action.

    This is fixed in C3 I believe, where "wait" actions will still remember the parameters.

    But yes, storing the value elsewhere like you said, is a fair workaround.

    Thank you for your answer!

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