Use Set Command for Multiple Delays

I have a script that depends on multiple delays and depending on the speed of the system I was wondering how I would go about setting multiple delay values at the top of a script that could be quickly changed for all delays in a script.

I know I of course could do a find and replace but since I do this often this would be a little faster approach to change things globally.

set delay1 to delay 1
set delay2 to delay 2
set delay3 to delay 3
set delay4 to delay 4

delay1
say "Delay One just happened"

delay2
say "Delay two just happened"

delay3
say "Delay Three just happened"

delay4
say "Delay Four just happened"

Hi Skillet,

Interesting question. I seem to remember that this question was deeper than it seemed.

Later,
kel

Here’s a simple example:

property n : 0

repeat 3 times
	say n
	set n to n + 1
end repeat

gl,
kel

Hi,

something like this, you can change the duration of the delays proportionally with the factor value


property factor : 1.5

property delay1 : 1 * factor
property delay2 : 2 * factor
property delay3 : 3 * factor
property delay4 : 4 * factor

delay delay1
say "Delay One just happened"

delay delay2
say "Delay two just happened"

delay delay3
say "Delay Three just happened"

delay delay4
say "Delay Four just happened"

Hi,

Still not sure what you’re trying to do, but maybe something like this:

property delay_vals : {1.5, 2.5, 3.5, 4.5}

delay 1
say "Delay One just happened"

delay 2
say "Delay two just happened"

delay 3
say "Delay Three just happened"

delay 4
say "Delay Four just happened"

on delay n
	set this_delay to item n of delay_vals
	say this_delay
	continue delay this_delay
	return
end delay

It might be better to test with something other than a delay. Something where you can actually notice what is happening.

gl,
kel

This is great thanks Stephan and Kel, that does the trick! Different then I was expecting but it works none-the-less.

Hi Skillet,

As I remember it, the version I used, was for someone who wanted to change all delays throughout the script. For example, if someone wanted to change all 'delay 1’s to something else instead of changinging each ‘delay 1’. This would lessen the work just by adding the property and the handler.

gl,
kel