@alexandre-buisson setTimeout isn't supported. If you're going to do that you can put delays in-between using
RuntimeManager.sleep( time in milliseconds)

Also note scripts can be ran forever at whatever rate you like. For more control use the cron timer option for "run every" rates.
Scripts and meta points work in two ways. They can "fire" after a datapoint attached to the context point list is updated which causes a triggered update. Or, they can run routinely at set intervals. If needs be, you can always explain what you're wanting to achieve and we can work through it to help you obtain the desired outcome.

EDIT: please refrain from double posting, if you put the post in the wrong place the mods can move it for you. Double posting won't earn you any brownie points.

Fox