Help with a custom variable value.

I was wondering if anyone could give me a hand with a variable problem i'm having?

Basically, my game involves time travelling. In order to do so, the player uses a time travel machine, this machine can be activated with several levers and switches.

Now the problem i'm having is that my plan was to initially have a variable that changes according to the player's reactions.

Here's an example.

For this, we will call the variable "Vortex".

So initially, Vortex should equal to the value of "50".

Once a switch has been activated which begins the variable, the value of the variable "Vortex" should decrease every second. 

The player can stop this by activating a lever which increases the value of the variable Vortex.

If the Player manages to increase the variable's value so that it reaches the value of "100", they are successful.

If the player is unable to react fast enough and the variable's value drops below "20", they are unsuccessful.

In clearer terms, it should be like this.

Vortex = 50

IF SWITCH "First Vortex" Is ON THEN

Vortex - 5 ( Each Second).

IF Vortex <= 20 THEN

Player is Unsuccessful.

Else

IF Vortex => 75

Player is Successful.

Sorry for the strange post format.

I hope someone can be of help?
That seems quite tricky to set up.
I would imagine it would involve some loops and a Parrelel Process. (Maybe) or something like that.
You'd probably need a loop for this bit:

IF SWITCH "First Vortex" Is ON THEN
Vortex - 5 ( Each Second).
Player is Successful.
But I'm not sure how to do the other bits.

~Jackus
Tsukihime has a "if button pressed" switch that might be of interest to you. I recall it was meant to work in loops (where the vortex number increases/decreases)

Original thread: https://forums.rpgmakerweb.com/threads/help-with-a-custom-variable-value.38836/