Wow, thanks for the diligent thoughts
. That's adding functionality to what was a mere environmental moderator / monitor. Keep in mind that the main script should be very low overhead, as it is not certain what load the events themselves will put on th CPU. That is why (thanks to your wonderful idea) I'm now looking at the staggering of multiple script delays by use of the array, as well as staggering the use of functions inside each script.. rough example:
Say I have 3 scripts, all spawing and monitoring the 'damage' value of 100 objects apiece. In this example, lets allow that the objects are expected to spawn out of sight of the player. The three scripts have independant reasons for existing, so each must operate at about the same capacity.
When the scripts start up, they register with the main program as stated before. But, now included in Psy's array, a value that is at least the number of scripts run plus the order number of the script run, minus one (in this example 3, 4, and 5, could be higher of course, but this is just an example). This value is built and passed from the array to each of the script's delay variable, allowing 3 independant seconds for the 3 scripts to run in, before the first repeats again. This would be done in the startup of each script as it is called. It would lower CPU load, and the lag that results (Nogova Virus ring a bell?)
Now, this may be of more common use, especially in large scripts that don't need real-time scanning. But would really help in this event-ridden situation.
I'll give this to you up front and then explain my madness.
------------------------------------------------------------------------------------------------------
_TotalNumOfObjects
;self-explanitory
_NoLagNumber
;a number of evals per scan, witnessed to give reasonable effect and no script lag
_PerScanCounter
;counts per scan up to the _NoLagNumber, It's all relative.
_TotalCounter
;counts up to _TotalNumOfObjects
#evaluate
? _PerScanCounter > _NoLagNumber : goto "delay"
? _TotalCounter > _TotalNumOfObjects : _TotalCounter = 0 ; goto "delay"
(Evaluation code, the number in the array or list to be evaluated is found by _TotalCounter)
? _EndCondition == true : (remove registered vars with main pgm); exit
_PerScanCounter = _PerScanCounter + 1
_TotalCounter = _TotalCounter + 1
goto "evaluate"
#delay
~_PassedValue
_PerScanCounter = 0
goto "evaluate"
------------------------------------------------------------------------------------------------------
A simple math function to break-up evaluations of large amounts of data. Inside the scripts, the number of objects to be spawned or monitored is often done by groups. However in this example, lets say the objects are seperately evaluated (numbers of groups could be broken up). The number of objects (100) is divided by an experienced number (a number that causes no script-lag), and limits the number of items to be evaluated in a single scan, spreading the work across several, again decreasing CPU load.
Thanks Psy, this is really helping me to understand what needs to be done.
Scrub