Difference between revisions of "Watchdog"
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
'''BASIC LSL WATCHDOG FOR A SINGLE PRIMARY SCRIPT''' | '''BASIC LSL WATCHDOG FOR A SINGLE PRIMARY SCRIPT''' | ||
<lsl> | |||
// Basic LSL Watchdog Script to watch a single script | // Basic LSL Watchdog Script to watch a single script | ||
// 2012-01-17 By Tika Oberueng | // 2012-01-17 By Tika Oberueng | ||
Line 15: | Line 14: | ||
default { | default { | ||
state_entry() { | state_entry() { | ||
llSetTimerEvent(10); // Set this to desired | llSetTimerEvent(10); // Set this to desired watchdog interval. Probably best to leave quite high. | ||
} | } | ||
timer() { | timer() { | ||
Line 28: | Line 27: | ||
} | } | ||
} | } | ||
</lsl> | |||
'''BASIC LSL WATCHDOG FOR MULTIPLE SCRIPTS''' | '''BASIC LSL WATCHDOG FOR MULTIPLE SCRIPTS''' | ||
<lsl> | |||
// Basic LSL Watchdog Script to watch all other scripts | |||
// 2012-01-17 By Tika Oberueng | |||
// Released to the public domain. | |||
// You break it, you get to keep both pieces. | |||
// | |||
</lsl> |
Revision as of 02:25, 17 January 2012
LSL WATCHDOG
These are some simple scripts that watch other scripts in the same prim and restarts them if they crash.
BASIC LSL WATCHDOG FOR A SINGLE PRIMARY SCRIPT <lsl> // Basic LSL Watchdog Script to watch a single script // 2012-01-17 By Tika Oberueng // Released to the public domain. // You break it, you get to keep both pieces. // string watchee = "New Script"; // Set this to the name of a script in prim inventory to watch
default {
state_entry() { llSetTimerEvent(10); // Set this to desired watchdog interval. Probably best to leave quite high. } timer() { llSetTimerEvent(0); if (!llGetScriptState(watchee)) { llResetOtherScript(watchee); llSetScriptState(watchee, TRUE); llRegionSay(DEBUG_CHANNEL, "Watchdog Trip: The script "+watchee+" has crashed and has been restarted."); llSleep(1); llResetScript(); } }
} </lsl>
BASIC LSL WATCHDOG FOR MULTIPLE SCRIPTS <lsl> // Basic LSL Watchdog Script to watch all other scripts // 2012-01-17 By Tika Oberueng // Released to the public domain. // You break it, you get to keep both pieces. // </lsl>