I could not put the RandNum function that goes with that on the same post, here is the RandNum function that goes with the dowatch script.
Here is an example of how to call the dowatch script:
[unit, 5, 10, true,[0, 45, 90, 135, 180, 225, 270, 315]] exec "dowatch.sqs"
In this example the unit will watch each direction in the array [0, 45, 90, 135, 180, 225, 270, 315] for a minimum of 5 seconds and a maximum of 10 seconds (random amount of time in this range). Since the 4th parameter is <true> he will NOT watch the listed directions in sequence, he will instead randomly choose a direction from the list to watch. If instead of the <true> you put <false> in the 4th parameter, then he will follow the sequence in order. But the time that he watches any direction will still be random in the range of 5 to 10 seconds. You can make these numbers higher or lower, but the first number must always be less than or equal to the second. If you want him to watch each direction for the same amount of time without random time, just make the two numbers the same.