I use this at the moment for that check to give the first shot without loading timeBSO wrote: ↑11 Mar 2019, 09:54 Hi, in your case the main function will be executed not once but a lot of time so I think you need to declare a variable that will not be reset every time like this :But I don't know how you can know if it's the first time this main is call so you can set the default valueCode: Select all
Void main() { declare Integer TimeToAddFragment for This; // Will keep its previous value
Code: Select all
main() {
declare FirstRun for This = True;
if (FirstRun == True) { // check if its the first yield of script
Energy = EnergyMax;
FirstRun = False;
if (FirstRun == False) {
if (Energy < EnergyMax) { // energy reload workaround
Energy += 1; // every ms
if (Energy > EnergyMax) {
Energy = EnergyMax;
}
}
}
}
}
Testing with the logging fuction i took a look at which timestamps (NOW) the script would catchBSO wrote:TimeToAddFragment = Now + Delay;
For example 2 runs trying to catch = 9010,9020,9040,9050,9060,9070,9080,9090,10000:
Code: Select all
9010 9010
9040 9040
9060 9070
10000 10000
As far as i can judge by this to catch a value of 1 to 9 ms would be impossible.
In the above example if the Now + Delay (or TimeToAddFragment) would never be executed.
Logging and trying to catch designated values showed me that the value has to be at least 30+ ms in order for the script catch every stamp.
I do not know if this is the same on a server with players. (when multiple actions are executed at the same time)