![]() |
|
Real use of resident 0 script? - Printable Version +- LogicMachine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Real use of resident 0 script? (/showthread.php?tid=6212) |
Real use of resident 0 script? - rbourgeon - 11.12.2025 A key feature of the resident scripts with 0 second pause is that their global variables are memorized from one execution to the next one. Knowing this, if we want to have a script that always does the same thing over and over, we have two options: Option 1 - Each execution of the script terminates and then passes the values of the global variables to the next execution Code: if MY_SCRIPT == nil thenOption 2 - There is only one execution of the script, it runs forever Code: -- initializationCan you explain to me which of the two options is the most efficient and the most CPU-friendly, and tell me why? RE: Real use of resident 0 script? - admin - 11.12.2025 The second option is a tiny bit better but it does not really matter. Previously "while true" loops were prohibited in resident scripts, because scripts were reloaded on the fly after saving changes. Now scripts are fully restarted so infinite loops are allowed. |