NMS Example icon NMS Example Example NMS Level #1 navigation skill showing subscription to combined scan+location data, displaying position and scan info; source code included. Try it →
Asked — Edited
Resolved Resolved by DJ Sures!

Executing Functions At A Specific Time Interaval

I am trying to write a script that does a specific function at 15 minutes, 30 minutes, and 1 hour. I cant figure out how to write it so if 15 minutes it resets that time, and continues to count until 30 minutes, and then an hour. Does anyone have an example of such a script.

Thanks.


ARC Pro

Upgrade to ARC Pro

Get access to the latest features and updates before they're released. You'll have everything that's needed to unleash your robot's potential!

Author Avatar
PRO
Synthiam
LinkedIn Thingiverse Twitter YouTube GitHub
#1  

$loopCount = 0

:loop

$loopCount++

sleep(1000 * 60 * 15)

IF ($loopCount = 1)

  say("15 minutes has expired")

ELSEIF ($loopCount = 2)

  say("30 minutes has expired")

ELSEIF ($loopCount = 3)

  say("45 minutes has expired")

ELSEIF ($loopCount = 4)

  say("60 minutes has expired")

  $loopCount = 0

ENDIF

goto(loop)
Author Avatar
PRO
USA
#2  

Very cool! Thanks.