You described a state machine very well. Search the forum for implementations.
Turn your numbered items into states (enum...). In each state wait for the expected events and react and proceed as described.
You described a state machine very well. Search the forum for implementations.
Turn your numbered items into states (enum...). In each state wait for the expected events and react and proceed as described.