Most scripts follow this structure:
Sense environment (nearby entities, variables, timer)
Make a decision
Issue one or more commands
Update variables or timers