Any chance have command setdelay(eg800)

There is no delay function in nsb app studio.though I can creat my own,but the delay greatly differs in different os, different device;which performs really bad.is there any chance to have a new command , something like: setdelay(800).I have a for loop,I wanted to set some delay in the for loop…,tst

I can set my beloved delay in android 15,but it is a very very very slow delay in android 11.

Have look at the SetTImeout() function:

Can u help to code a for loop using settimeout function.what I know is settimeout jumps to other function;so ,in this case,can’t use in a for loop.it isn’t something like goto,which can use to jump within a for loop.best rdgs, tst

Seems,setinterval can jumps to a loop,which helps in my case. Am I right?, tst

What is it that you are trying to do? A loop may not be the best way to do this.

Hi,first,a few random pick tone,me do fa re mi,each with some delay.that the user have to memerise these few tone,and key in the exact few tone to win.i am on the mid way to achieve with a for loop;but I want show me pic,then back pic,then do pic,then back pic,so on and so forth,each with delay.but I haven’t have the luck to see it flipping in action.in between the tone,I use my delay function to slow down each piece of tone.but the delay function differs in each phone ,each android os.best rdgs,tst

If you are willing to use javascript and if you are ok with async, you can do this by

  1. Create a “delay” function

async function delay(mw) {

return new Promise(resolve => setTimeout(resolve, ms));

  1. Then do your loop within a function declared as async as follows

While(whatever){

–pre delay code–

await delay(–ms–)

–post-delay code–

}

I don’t know how to translate this into Basic, I’m afraid.

Thanks for posting this!I can use JavaScript,end JavaScript.anyway,what is an async function,hope it isn’t something that deal with server code,tst

Search online and found this is a handy tips

Hi,doing some tweak to the given function,search online,using convert to JavaScript,using JavaScript end JavaScript.now,mission accomplished.thanks a lot to @slm.sweet dreams,tst

Glad it worked. I saw you comment on async so I think you might need the following short explanation.

A function marked “async” doesn’t cause the rest of the code to wait until its done. So it you have a function like “async function someFunction()” and you call it in another function like this

X(){

someFunction();

someOtherFunction();

}

the function “someOthterFunction will run immediately after the call to someFunction, even if someFunction hasn’t finished yet.

The “await” keyword, tells the function X not to do someOtherFunction until someFunction if finished.

Hope that was helpful.

That’s very informative of u,thanks a great deal.glad ,this part of my app finally work.its great u could help others! Thanks again,tst