Slight tweak to Delay component

For general Flowcode discussion that does not belong in the other sections.
Post Reply
RGV250
Posts: 260
http://meble-kuchenne.info.pl
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Slight tweak to Delay component

Post by RGV250 »

Hi,
I wonder why there is a limit of 2000 milliseconds and only integers allowed for seconds in the delay command.
I would like to have a 3.5 second delay so I have to do 3 seconds and then 500ms which just seems a bit messy.
Is it possible to either allow a greater range for milliseconds or better still 3 decimal places for the seconds so 3.450 is allowed which will allow for fine tuning.

Regards,
Bob

kersing
Valued Contributor
Posts: 139
Joined: Wed Dec 02, 2020 7:28 pm
Has thanked: 59 times
Been thanked: 54 times

Re: Slight tweak to Delay component

Post by kersing »

Non integer values would require floating point math to be included in the code which is terrible inefficient if it is just included for delay. Allowing delay to use a larger ms value would be more efficient.

RGV250
Posts: 260
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Re: Slight tweak to Delay component

Post by RGV250 »

Hi,
I see your point on using FP, maybe another idea is you could do enter something like 3s 500ms and it gets handled in the background. Just a thought.

Bob

RGV250
Posts: 260
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 23 times
Been thanked: 30 times

Re: Slight tweak to Delay component

Post by RGV250 »

Just another thought, how about adding a "Hybrid" selection button. You could enter 3.500 and in the background it is treated as a string and the 3 and 500 are then seperated and used for the timebase.

Bob

Steve-Matrix
Matrix Staff
Posts: 1197
Joined: Sat Dec 05, 2020 10:32 am
Has thanked: 158 times
Been thanked: 266 times

Re: Slight tweak to Delay component

Post by Steve-Matrix »

Thanks for the suggestion, Bob. I will look into it.

But you might want to avoid long delays in your code anyway. For example, if you are waiting for a long external process to occur, a better strategy would be to use a loop with a much shorter delay. Inside the loop you can poll for the result of that long process so you can minimise the delay, and also do any other 'maintenance' (e.g. check for user input) so your running app is not blocked.

Post Reply