#Are functions supposed to activated when called as a reference?

10 messages · Page 1 of 1 (latest)

full forge
#

In this script, I'm simply trying to set a variable as a function, there's two possible problems with this.

First off, the function isn't being called, which I think is due to the function I'm trying to turn that variable into, is not in the same script as the other function.

Then also, Each time I call a function in the code like this, it just activates, is it supposed to do that?

#

What the function does is decrease a timer by 10.

#

That's the goal, but I don't want it to activate at the beginning of the scene.

dusky ember
#

Omit the parentheses (which is the syntax for calling the function). If you need it to have values for its parameters, like in this case, pass them to the bind function (which is on the callable. Kinda funky)
So _1_1.function = GS_Time_C.bind(-10)

Then, _1_1.function.call() will actually call it

full forge
#

So it shouldn't call it like _1_1.function = GS_Time_C.bind(-10), right?

dusky ember
#

Correct

full forge
#

And what if it does still?

#

actually let me ask this first, what does .bind() do?

#

Nevermind I can look it up.

#

This bit of text calls the function _1_1.function = GS_Time_C(-10), right?