Limit scroll until action

Hi all, I’m trying to limit scroll so it doesn’t scroll past predefined value, until action takes place, and then remove limitation so the scroll can be scrolled all the way up and down.

Basically, if layer X opacity = 0, scroll range can be 0-1000, and if layer X opacity = 100, scroll range can be 0-2000. Must be same scroll because after “layer X opacity = 100” condition is satisfied, the scroll should be available for the full length.

Is that possible?

TIA!