Pause commands in one script

I have a preset for executing multiple commands , but I was wondering if there is a way to pause in between commands within just one button press, for example:

set(“CommandA”, 0)
pause 5ms
set(“CommandB”, 1)
pause 5ms
set(“CommandC”, 8)
pause 5ms
set(“CommandD”, 2)

is this possible?

you can use settimeout in the script property
example here...

Note that in open stage control, setTimeout is slightly different from its vanilla version:

OH this is so cool! thanks!

I’m stuck at one point, there I’m trying to trigger 2 things after one another… maybe you could have a look and guide me in the right way?

set(“Command_1”, 0)
set(“Command_2”, 0)
set(“Command_3”, 0)
set(“Command_4”, 0)
set(“Command_5”, 0)
setTimeout(()=> {set(“Command_1”, 1)}, 10)
setTimeout(()=> {set(“Command_3”, 1)}, 20)

This snippet of code Executes all set commands simultaniously but only executes the LAST setTimeout command and ignores the firs tone :frowning:

any advice? thank you!!

ps. I’m still on 1.0.3 if that helps.

As per the link I gave, you can’t run 2 setTimeout with the same id (or no id) simultaneously, you’ll need to give these calls a different id as first argument

setTimeout(1, ()=> {set("Command_1", 1)}, 10)
setTimeout(2, ()=> {set("Command_3", 1)}, 20)

Also the delay is expressed in milliseconds, you won’t get that precise (o-s-c is not real-time and doesn’t aim to be).

perfect! thank you! Yes I saw you cannot have the same ID, but I kept placing the ID in the wrong place, so thats why it never worked! thank you!
I’m only trying to delay these commands a little bit, not as precisely as 10ms, so at the moment I have them in 50ms differences.

thank you again!

Hi. I wish I had a better grasp of these functions. I'm basically trying to insert a brief pause, (1 second is plenty), in between 2 commands that are triggered by 1 button.

Scripting onValue:

send( 'midi:OSC', '/control', 15, 122, 127 )
send( 'midi:OSC', '/control', 15, 124, 127)

Works, sort of, but not 100% reliable in all instances.


This should do:

send('midi:OSC', '/control', 15, 122, 127 )
  send('midi:OSC', '/control', 15, 124, 127)
}, 1000) // 1s