This is the role of triggers. There's a wide range of them.I don't mean the if clause. Instead of checking the condition(s) once it will wait until the condition(s) are met and only then will it perform the actions.
Does the Wait Until Trigger action not do what you need?