Help with sketch structure

Hello Reader!
The best way to explain my end goal is probably best to explain the overall process in real life terms

Process:
A sensor in the bottom of a tank detects that the fluid level is low (setting say Pin-D3 to High), initiating a relay to a valve that starts to fill the tank, the water level surpasses the level which tripped the sensor but doesn't stop the valve, the valve only stops after a sensor at the top of tank detects a (High on say Pin D4).

It needs to get a bit more complicated because when the tank is full it needs to start filling another tank and then another, going in a loop until the devices are filled.

I'm not scrounging for completed coded here, but maybe some sample code i could tweak for my use, or a bit of guidance in the right structure to start building my own

Many thanks for reading this!
NBS-ONE

A sensor in the bottom of a tank detects that the fluid level is low

Stop right there. Stop waving your arms around with generalities. What kind of sensor is it? A link?

or a bit of guidance in the right structure to start building my own

You seem to already know the structure. You read the "tank is low" sensor. If it is saying that the tank IS low, you have some stuff to do. Otherwise, you don't.

The stuff to do involves setting a pin high, waiting in a while loop until the "Hey, that's enough; I'm frowning here" sensor indicates that it is time to stop. When that happens, set the pin low again.

Get this working before you even consider adding complexity.

As for the added complexity, it really isn't. The Hey, that's enough; I'm frowning here" sensor indicates that the first tank is full, so you know whether or not to consider doing step two (which you'd put in a another function that you might, or might not, call).

I think you would serve yourself well if you looked at Nick Gammon's tut on state machines. Wikipedia has a good article here.