1
Stealth Client / Pascal: Doing something every 15 seconds, best way to do this ...
« on: August 23, 2017, 03:34:42 PM »
This is for pascal.
I have a fisher on a boat. Every 15 seconds I get to "scan the horizons" and see whether any other boats are in the vicinity. If there are, I want to go home.
Preferably, in 1 script I would scan the horizons, set a variable with a timestamp, then do my fisher functions ... and at several places in loops I would check that timestamp, and if it has been over 15 seconds, I'd perform the scan the horizons again, set the timestamp again, then continue with the script.
I saw "function Timer: Cardinal", but there's no examples and I'm not sure the syntax of setting the variable and comparing whether 15 seconds have passed.
Alternatively, I could run a 2nd script something like this ...
begin
startscan:
scanhorizons;
wait(15000);
goto startscan;
end.
The problem with this is if the 2nd script decides it needs to go home ... and it is going to cast recall, it would somehow have to pause or stop the other script (and I'm not sure if that can be done or how to do that).
So in summary ... I want to set a timestamp variable that I can check whether 15 seconds have passed since it was set, or ...
I need to know how to have one script pause another script.
Any ideas would be appreciated, thanks!
I have a fisher on a boat. Every 15 seconds I get to "scan the horizons" and see whether any other boats are in the vicinity. If there are, I want to go home.
Preferably, in 1 script I would scan the horizons, set a variable with a timestamp, then do my fisher functions ... and at several places in loops I would check that timestamp, and if it has been over 15 seconds, I'd perform the scan the horizons again, set the timestamp again, then continue with the script.
I saw "function Timer: Cardinal", but there's no examples and I'm not sure the syntax of setting the variable and comparing whether 15 seconds have passed.
Alternatively, I could run a 2nd script something like this ...
begin
startscan:
scanhorizons;
wait(15000);
goto startscan;
end.
The problem with this is if the 2nd script decides it needs to go home ... and it is going to cast recall, it would somehow have to pause or stop the other script (and I'm not sure if that can be done or how to do that).
So in summary ... I want to set a timestamp variable that I can check whether 15 seconds have passed since it was set, or ...
I need to know how to have one script pause another script.
Any ideas would be appreciated, thanks!