-How to construct an reliable delayer between flooding and draining?
Any sort of repeater can function as a reliable delay. You start the repeater when you want to begin delay, and if you want delay longer than the period of the repeater, you use the repeater to drive a counter. If the repeater design you've chosen is hard to start or stop, you can always stop or start the counter instead.
Probably the simplest, most reliable way to do this is with a n-step pump repeater (
http://df.magmawiki.com/index.php/User:MrFake/NStepCyclicRepeater ), except you power one pump in the sequence from outside logic, rather than running it continuously:
^ Pressure plate1, water in this location on start-up; linked to drainage door and to gear3
%* Pump1 (north-to-south) powered by gear1; gear 1's start-up state is off, gets toggled on by same input as begins magma flood
%
^ Plate2, linked to gear4 below
%* Pump2 and gear2 (startup state on)
%
^ Plate3, linked to gear5
%* Pump3 and gear3 (startup state off, due to presence of water on plate1)
%
^ Plate4, linked to gear6
%* Pump4 and gear4 (startup state on)
%
....
For as many pumps as you need delay, with the last pump feeding plate 1
What will happen with something like that is: you trigger it at 0; drainage closes at 100 (link earlier pump to drainage if you want reset position to have drainage off); it begins travelling through the pumps, and 100 ticks*(number of pumps-1) later it shows up back at plate1, where drainage opens and stays open until the circuit is next given input.
Probably this exact design isn't exactly what you what, because you want to delay both the beginning and the ending of drainage, but it's offered just as a demonstration of water-pump based delay.