What you want is a state machine and what you don't know you want is non-blocking task functions with built-in timers and state machines.
In C/C++ we call functions that return execution, not variables.
State is short for Process State, and it -can- be simple or tricky. State machines make a lot of coding easier.