Functions are simply a way to re-use chunks of events. They are only run when you call the function.
Triggers can be thought of as functions. If it helps some things like input are probably checked regularly like non triggers but that check is done at some lower level point in the system. Like mouse clicks are checked in the mouse driver, which is taken by the operating system, sent to the browser, which loops over the events and sends them to the js event listeners, which in turn is handled by construct’s engine.
Other triggers come from checks in other places. For example on frame changed comes from the sprite objects tick function which updates the frames. There it calls the trigger when the frame changes.
Some things are so called fake triggers, but that’s mainly a term in the sdk. There aren’t too many examples of them, off the top of my head on collision, gamepad triggers, timer triggers, and I want to say in the Los behavior. It’s more of an exemption to the rule, and they act like a normal event with a trigger once.
In collision is interesting since it’s both a fake trigger and a real one. It’s kind of like an is overlapping and a trigger once but it’s done per instance It’s also a normal trigger because the physics behavior calls it when the physics engine has a collision.
Anyways, functions are just a way to organize and reuse code.
In general you can think of triggers as functions that don’t run every tick, and instead are called by other parts of the runtime. But like many parts of the engine there are exemptions where things may work differently.