The Function Object in a Tick

This forum is currently in read-only mode.
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

    <img src="http://dl.dropbox.com/u/1013446/trig.PNG" border="0" />

  • 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?

  • 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?

    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)

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