The Function Object in a Tick

For questions about using Classic.

Post » Tue Jan 10, 2012 3:19 am

Am I right with my observation of the behaviour of the Function Object?

Let's say further down our list of events we have a "Call Function" Action next to an event.
But we check for the Function before that Event. We check "On Function" in our Event List above "Call Function".

Now in one Tick, we check the Event List from top to bottom.
The first time the Event "On Function" is checked, it is ignored.
Now when the Event (containing the "Call Function) itself is actually checked, it will first perform all Actions for that Event, until the Action "Call Function" is encountered. If it encounters "Call Function" in the Actions list of an Event, it will stop reading Actions after this and instead check all Events from top to bottom again for "On Function" with the same name. And it will execute all of the Actions for those Events first.
When it is finished doing so, it will continue reading the Actions from the Event in which "Call Function" was just executed.

Am I right?

I think this checking behaviour is pretty important to know to use the Function Object properly and avoid unwanted results. It should be noted in the documentation. I only noticed this because something strange was happening, and I am constantly running with a very low Fixed Framerate to check what my code is doing, how exactly it is being checked and run. But I imagine if it runs faster, and things are harder to see, the processes going on, and their order are often harder to understand, if something is just seen for 16ms (in the case of 60 FPS). That could lead to bugs, that You later can't understand.

The way the Events are checked in one Tick should always be clear to the user to avoid confusion.Shindoh2012-01-10 03:40:05
Posts: 70
Reputation: 765

Post » Tue Jan 10, 2012 4:50 am

the On Function condition, like most conditions that begin with the word On, is a triggered condition. this means it is not executed or evaluated based on it's location in the event sheet. Only when triggered conditions are triggered are they evaluated. Triggered conditions are marked in the event sheet with a green arrow before the condition name
lucid2012-01-10 04:52:44
Spriter Dev
Posts: 3,285
Reputation: 17,151

Post » Tue Jan 10, 2012 8:27 am

Does that mean that any "On trigger" condition are effectively placed at the top of the event sheet, since you said their location doesn't matter in the event sheet?
Posts: 1,815
Reputation: 24,857

Post » Tue Jan 10, 2012 8:56 am

[QUOTE=alspal] Does that mean that any "On trigger" condition are effectively placed at the top of the event sheet, since you said their location doesn't matter in the event sheet?[/QUOTE]
It means that it isn't any more effective than placing them at the end of the event sheet, or somewhere in between. It simply doesn't matter. They will be executed as soon as the trigger is true. (just like "Start of layout" gets executed before anything else, even if you place it at the end of an embedded event sheet, that you embed at the end of your actual event sheet)
Posts: 1,821
Reputation: 8,289

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest