I am not quite sure of your application, but it sounds like you could build a loop with two separate vis running. For the first vi you could have a status output going into your next vi which would run to lower your gain until the status was cleared again. it would basically be a balancing act within the loop. You can build sub vis and have outputs and inputs which can feed each other information. Hopefully this helps and is clear enough. I can try to put together a vi to illustrate my thoughts.
