Your conditional logic is completely flawed. What you currently have says the following:
if ( time of day is between 6 am and 6 pm ) do stuffendif
The inner DoOnce check is doing nothing, because it's simply flipping every cycle.
What you need would look more like this:
if ( time of day is between 6 am and 6 pm and DoOnce <= 0 ) do stuff Set DoOnce to 1elseif ( time of day is between 6 pm and 6 am and DoOnce >= 0 ) do stuff Set DoOnce to -1endif
This will tie your DoOnce check to your time of day check, so it only fires once each time the time of day switches.
Queue