This JSFX shows that the variable is reset and @slider is run when Reaper re-gains the focus (which both does not seem to make sens to me).
@init seems to be run at that point, as well ?!?!?
It did not reproduce other aspects I mentions (that it does not happen when the project once was in in run state, and that something weird happens when the JSFX is loaded (e.g. by starting Reaper) (which does happen with Midi Fade X) ).
I'm going to check with an older version of Reapers...
Seems I can't reproduce that (less weird) behavior with the version I supposedly tested with some days ago right now any more - even with Fade X.
-Michael
Code:
desc:refocus test
slider1:set1=0<0,1,1>set to 1
@init
//a = 1;
@slider
set1 ? (
a = 1;
);
@sample
a != 0 ? (
a +=1;
);
@gfx 640 400
gfx_r=gfx_g=gfx_b=0; gfx_a=1;
gfx_x=gfx_y=0;
gfx_rectto(gfx_w,gfx_h);
gfx_x=gfx_y=10;
gfx_r=gfx_g=gfx_b=1;
gfx_printf("%d", (a/10000)|0);