SComputers has a lag-score mechanic that prevents lags from being called
if the computer runs the code for a long time (it takes a lot of processor time) then he is credited with a lag-score, which can lead to missing clock cycles. which actually means that you won't get control for the next tick of the game
- SComputers has excellent display optimization. however, your code can still cause lags if it uses too much CPU time
- the processor time available to your code is set in the permission tool
- if you exceed it, your computer will immediately terminate code execution with a "too long without yielding" error
- you can handle the error using pcall/xpcall/callback_error. however, if you exceed the code execution time several times in a row in a short period of time, then you will not be able to handle the error, as well as such a computer can no longer be restarted by sending a logical signal to the reboot gate or calling reboot from another computer
- a computer that crashed with a "too long without yielding" error bypassing processing is a malicious violator, and its operation can only be restored manually by pressing the reboot button in its interface or by pressing the reboot gate button E
- besides. if your code or your display causes lags, then you are awarded a lag score. if the lag score value becomes greater than or equal to 100, then your computer will shut down with a "too long without yielding" error without the possibility of processing and automated reboot
- if your computer caused lags and then stopped, then the lag points will be deducted at 1 per tick
- if the lag score value reaches 10, then there is a high probability that your computer will not receive control for the next game tick
- if your code causes lags, it may start skipping a lot of ticks at once
- also, your code can start skipping bars if the game is lagging for another reason
- you can get the lag score value using getLagScore(). you can also get the number of missed ticks using getSkippedTicks()
- if your code skipped a clock cycle/clock cycles then getUptime() will skip the value. consider this
- getTick() does not skip ticks when the computer skips them. it counts each iteration of the computer, regardless of how many ticks have passed between iterations
- the timer library makes automatic correction based on the ticks missed by the computer
if you don't need lag protection, you can turn it off in the permission tool
to do this, simply turn off "drop freq at lags" and set anti-lag to 0
also, if you want, you can increase the maximum processor time to 40 ticks or even disable the limit (with the execution time limit disabled, you can accidentally make the game freeze)
if you have disabled protection and your game is frozen by incorrect code, then close it and when entering the world, click "NO" (do not activate the mod) then remove the computer with the bad code and turn on the mod through the Permission Tool