You can not place triggers in a function.
They are functions (in some sense) already, and they get called when something happens.
Timers are already dt corrected. Just feed them seconds.
If you slide that line between the conditions and the actions to the right, i can read the conditions.