function object

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • does it always remember picked objects or how do you set this

    and do you always use a text object to set the function

    i just want to pass them to the function but dont know what else you should use

    my example:

    functiontxt set text to Function.setstartvalue(1000,1000,300,1)

  • There is an option for remember objects. just select yes remember or no dont remember.

    I really dont understand what you are talking about in the second question.

    When you are calling Function.setstartvalue(1000,1000,300,1)

    you are passing it for paramaters. so in your function you would have

    on function setStartValue

    -set myvar to function.param(1) // this will set my var to 1000 2 would also and 3 would set it to 300.

    you could also pass it variables by doing function.MyFunction( myObject('myVar'))

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is an option for remember objects. just select yes remember or no dont remember.

    I think he means does calling a function from an expression remember picked objects. Which is a good question because, well, you're calling it from an expression and there's no drop-down menu to select Remember or Forget from.

    And... I don't know the answer

  • As far as I can tell, calling a function through an expression remembers object picking.

    However, if I'm wrong(which I'm fairly certain I'm not, since I tested it), you could always use the "Add parameter" action for your parameters and call your functions using the "Call function" action to ensure proper object picking.

  • okey thanx for the replys,

    so in case i would like it set to forget i should use the add param and call function and dropdown

    and for using the text , i guess its a good way as i don't need a seperate var for setting the param

    or maybe a global var is also a good way

    so like this

    global('setstart') set var to Function.setstartvalue(1000,1000,300,1)

    i guess my question was why do you need to set something, why not just

    Function.setstartvalue(1000,1000,300,1)

  • i guess my question was why do you need to set something, why not just

    Function.setstartvalue(1000,1000,300,1)

    Because it is not implemented

    If you want to pass parameters to a function without the need of a return value (like in your example set text) you have to set the parameters seperately and then call the function. It is part of the concept - the way of calling a function with a return value directly within the expression is just a shortcut for your convenience

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