Will this timer wait? (order of operations) - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Will this timer wait? (order of operations) (
/showthread.php?tid=663393)
Will this timer wait? (order of operations) -
ShOoBy - 30.01.2019
Hi, please help me understand pawn's order of operations by considering the following code:
Код:
stock FirstFunction() {
SecondFunction();
print("F1");
}
stock SecondFunction() {
print("F2");
SetTimer("ThirdFunction", 1, false);
}
stock ThirdFunction() {
print("F3");
}
So it's not that hard to understand that "F2" will be printed before "F1", but what about "F3"?
Will the order always be "F2 F1 F3", or maybe due to the low 1 tick value, the timer callback will RARELY be executed first, so that "F3" is printed before returning to the original function and printing "F1".
Additionally, what if instead of a single print("F1") I would do a lot more, will that delay it enough so that the timer is executed before the first function finishes?
In a nutshell, how reliable it is that the timer will always run last?