How do I check a new function's paramater?

0 favourites
  • 12 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • Prior to the new functions I could use System and set a global variable to the Function.Param(0).

    Now, I can't.

    So what's the new method for getting the parameter of a called function???

  • New function's parameters are treated as local variables.

  • New function's parameters are treated as local variables.

    I don't get it, you mean an instance variable? How do you get the value of one?

  • Inside your function event, you'll have access to your parameters as expressions directly under System > Global & Local variables.

  • Inside your function event, you'll have access to your parameters as expressions directly under System > Global & Local variables.

    I still don't get it. That's what I was doing before.

    If inside the function I select system.setvalue, in the variable list I get all of my global vars which I'd expect. But in the value, there's no way I see to add in either function.param(0) or anything with the function name.

    With the old way, I could set a global to function.param(0). Now, function doesn't appear in the list nor does the function name appear in the list and gives an error when trying to set it.

    What am I not seeing here???

  • Did you actually add parameters to the function ? This is an additionnal step that you did not have to do before. Right-click on the Function event, and "Add parameter".

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This video covers how the new functions work, including how parameters are handled now. In short they're treated the same as local variables - so you can compare them using system conditions and retrieve them by typing their name in an expression.

    Subscribe to Construct videos now
  • This happens to me as well. If i create a new function and set its return value to anything other than "none" then that function doesn't appear in the list, so it can't be called.

  • It seems function with return values can only be called by expression, which is unfortunate. I guess you could circumvent this limitation by using a useless expression like "Set dummyValue to Functions.myFunction", but it is rather annoying.

  • If you indicate that the function has a return value, then it can only be called as an expression and not as an action. Only functions without any return parameter can be used as an action

  • Did you actually add parameters to the function ? This is an additionnal step that you did not have to do before. Right-click on the Function event, and "Add parameter".

    That was what I was missing. Wow, ok. Thanks.

  • If you indicate that the function has a return value, then it can only be called as an expression and not as an action. Only functions without any return parameter can be used as an action

    Ah that explains it, thanks.

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