Trying to get a pause in procedure execution

I'm trying to get a delay in a procedure and adjust the delay duration with a slider.
So a on click event starts a procedure that changes the back color of a button.
then if the slider value is 1, a 1 second delay before doing the next thing.
If the slider value is 4, the delay would be 4 seconds.
can someone help with this?

Hi @Eric_Michalek
You should use a clock and set timer duration accordingly.

1 Like

Yes, Clock is what I have been attempting to get working.
I'm attaching a screen shot of

When I click the StartB, it should start the RunMe procedure.
The first step of the RunMe procedure is to start the Rotate1F procedure
(On screen the button F for the top left number 1 back color is to change to yellow.)
If the slider is = 1, I want 1 second to pass before starting the Rotate1B procedure.
The purpose is to cycle all F and B buttons back color to yellow.

Current code does not look like any button back color is changing.
So first, I need to get that working...
Then I need to add the slider in that it is 1 to 5 so if the slider is 5, I get 5 seconds before the next procedure starts.

Sorry, it will not work like this:


Like this (there is probably a better solution, but off the top of my head):

Oh, you should reset the counter to 0 in the button event.

Here is a clock Timer based approach for an exercise routine,
using deadline variables for each next event ...

Capture exercise.aia (3.4 KB) global Button1_deadline_ms global Button2_deadline_ms global Button3_deadline_ms when Button1 Click when Button2 Click when Button3 Click

Clock1.Timer controls everything, by checking for expired deadlines and rescheduling them after initiating their events.

For a lot of similar components, you can use lists of the component blocks with generic (Any component) blocks to reduce your block count.

I'm still stuck, trying to make this simple:
I want to click a button to start a procedure,
this procedure has numerous procedures inside it
and between those procedures I want an intermission
(based on the slider 1-5, so if the slider is set to 3, there will be 3 seconds before starting the next)

this is my latest change
The slider works,
the start button launches the RunMe procedure
there is no observed intermission.

This is not working because you did not take the advice given here:

Have you ever seen a piano roll, used to drive a player piano?

You need to build one for your component music, with 3 columns,

  • component name ("L2F", "L2B",...)
  • background color name ("White", "Yellow", ...)
  • end of Clock Timer cycle (true/false)
    and one or more rows per Clock Timer cycle.

I'll start you off:

Have your Clock Timer advance through the music, playing each note until it hits a "true" for end of cycle, when it releases control for the next Clock Timer cycle to resume where it left off. (you need a global index variable for this.)

1 Like

Got it to work.
Special thanks to TIMAI2!
Please note that I was listening to everyone. In fact I tried everyone's approach. But the key was:

I was improperly using a math block when I should have been using a LOGIC block. This is a screen shot if anyone wants to do something similar.

Thanks again!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.