Define a sequence of events, and how to respond to them.