XEngine
From OpenSimulator
The XEngine Script Engine
This is a fully functional, full featured script engine which supports persistent script states and script state serialization.
This engine is enabled by default. If you do need to enable it manually, make sure that the following line is present in your OpenSim.ini [Startup] section:
DefaultScriptEngine = "XEngine"
The XEngine will create up to 4 files for each script, these are:
- .dll, the actual executable file
- On mono, .mdb, the debug data file (necessary for resolving line numbers).
- On Windows, .pdb, the debug data file (necessary for resolving line numbers).
- .state, the saved state of the script.
Each file will have a UUID embedded which is the ID of the prim inventory item that contains the script.
If WriteScriptSourceToDebugFile = true in [XEngine] in OpenSim.ini then there will also be:
- .cs, the c# source file converted from the original script if applicable (e.g. when using LSL as the script language).
XEngine has a number of configuration options in OpenSim.ini, which are listed below, with an explanation and the default values:
WARNING! Do NOT copy the section below to your OpenSim.ini!
Use the template provided in OpenSim.ini.example. The section below contains syntactically incorrect documentation text, which is not meant to be placed in the OpenSim.ini file!
[XEngine] ; Allow the XEngine to run Enabled = true Without this, it won't run at all ; How many threads to keep alive even if nothing is happening MinThreads = 2 XEngine will keep at least this many threads waiting ; How many threads to start at maximum load MaxThreads = 100 XEngine will not start more than this many scripts, even if that means blocking script execution ; Time a thread must be idle (in seconds) before it dies IdleTimeout = 60 Threads will die when they are not used for a while. This is the amount of time they must be' idle for that to happen ; Thread priority ("Lowest", "BelowNormal", "Normal", "AboveNormal", "Highest") Priority = "BelowNormal" Script threads will run at this priority ; Maximum number of events to queue for a script (excluding timers) MaxScriptEventQueue = 300 Each script has a queue for events. This is the length of the queue, determining the number of events that will be queued up before events are dropped ; Stack size per thread created ThreadStackSize = 262144 The stack size each script thread runs with. The default also represents the minimum ; Rate to poll for asynchronous command replies (ms) AsyncLLCommandLoopms = 50 Interval between polls for asynchronous command results. Smaller values mean better response, but also more burned CPU cycles ; Save the source of all compiled scripts WriteScriptSourceToDebugFile = false Create a source file (.cs) on ScriptEngines, containing the preprocessed script ; Default language for scripts DefaultCompileLanguage = lsl The default language to compile ; List of allowed languages (lsl,vb,js,cs) AllowedCompilers = lsl,vb,js,cs The languages to allow for compiling ; Compile debug info (line numbers) into the script assemblies CompileWithDebugInformation = true Create the .mdb debug file, which allows reporting of line numbers in runtime errors ; Allow the use of os* functions (some are dangerous) AllowOSFunctions = false Allow the use if functions in the os* namespace ; Interval (s) between background save of script states SaveInterval = 120 Interval for script state persistence save. ; Interval (s) between maintenance runs (0 = disable) MaintenanceInterval = 10 Interval in seconds between maintenance runs. The maintenance run checks for long running script events and terminates the scripts ; Time a script can spend in an event handler before it is interrupted EventLimit = 30 If a script spends more time in a single event handler, it will be interrupted. This includes delays produced by llSleep() calls ; If a script overruns it's event limit, kill the script? KillTimedOutScripts = false If a script gets terminated by the above timeout, suspend it pending a recompile? ; Threat level to allow, one of None, VeryLow, Low, Moderate, High, VeryHigh, Severe OSFunctionThreatLevel = VeryLow osFunctions are rated by exploitability. This allows balancing functionality and risk
OS Functions enable/disable
For each function, you can add one line, as shown
; true is the default for all functions, and allows them if below threat level Allow_osSetRegionWaterHeight = true This allows any user to use it, if the threat level permits
or
; false disables the function completely Allow_osSetRegionWaterHeight = false Prevents anyone from using it
or
; Comma separated list of UUIDS allows the function for that list of UUIDS Allow_osSetRegionWaterHeight = 888760cb-a3cf-43ac-8ea4-8732fd3ee2bb Allows only the listed user(s) to use these functions (unconditionally)
Both engines share the same parser and LSL implementation, so any script that runs on one can be expected to run on the other, with a few notable exceptions:
- Resetting other scripts (XEngine only)
- Stopping/starting other scripts (XEngine only)
State persistence
XEngine persists state and variable values across region restarts