SetTimersRunning stopping?

Hi all! I created this basic script that is supposed to just send a sysex message at a constant rate and never stop to be used as a keep alive message in a redundant rig. Oddly though, the timer seems to stop (seemingly randomly, but nothing is random), and also it doesn’t start when I open up the GP4 file, I have to recompile the scriptlet. What am I doing wrong?

// Display a message at the bottom of the scriptlet window
var prevMS : double = 0
    sysexString : String = "F01F01F7"    


Initialization
   SetDisplayMessage("Starting timer")
   SetTimersRunning(true)

End



On TimerTick(ms : double)
  If prevMS == 0 || ms > prevMS + 500 then
    Print(ms)
    prevMS = ms
   SendSysexNow(sysexString)
  End
end // On TimerTick

You might indeed need a little trickery to get it going. Suggestions:

  • use “On Activate”
  • use “On Rackspace” (not sure if this is the exact name”
  • use the systemactions plugin and trigger on an appropriate parameter

Btw: the timer also stops when you open the options dialog

Where is the script - global rackspace?

Btw: For the global rackspace, I needed a different workaround. I will lookup the sample gig demonstrating a possible workaround for the normal rackspaces and the global rackspace as well. I can upload it tomorrow evening

As promised. I don’t know if it helps with the issue you encounter, but it mitigates some issues anyway.

TimerIssue.gig (96.1 KB)

As suggested by @Frank1119, you should add an On Activation callback to start you timers again there.

I don’t remember what the TimerTick parameter stands for, but in order to be sure, you could perhaps replace your ms variable by TimeSinceStartup()? And you should use your GPScript as a Global GPScript.

Thank you all so much for the replies! This is in the global rack space. I’ll have to check out franks script shortly and will let you know if that has any issues.