If anyone is still looking for a solution that wont blow up computation times, I found this workaround using environment variables which will store values outside of the script context.
The if statement will define the Env-Variable at frame 0 and afterwards increase and use the variable each frame. Note that x
could be any value. In my case it was an audio amplitude effect slider value.
if ($.myEnvVariable == null){
$.myEnvVariable = 0
}
// x = value from slider
$.myEnvVariable = $.myEnvVariable + x
$.myEnvVariable