To facilitate the debugging of MiceOnABeam-generated scripts within your virtual world environment several capabilities are provided.
Conditional compilation directives can be used to to control the inclusion of blocks of LSL code within the generated code. This is very useful during the development of a model whereby certain code is included (for example for debug purposes) which ultimately must be excluded in the production version of the model. See Compiler Directives for details.
Various traces can be enabled in MiceOnABeam which will instrument the generated code with extra LSL statements to output various trace messages as the script executes.
These traces can be enabled via the Options menu item within the Tools menu of the main program window. Please see Code Generation Options for further details.
Each such message always indicates the qualified name of the enclosing state in which the action occurred. In this way the script's execution can be monitored as events are received, states are entered and exited, and transitions fired.
The generated code also includes several utility functions* which can be called within user code segments in the model in order to output the value of a variable.
- MSGOUT(string aString): Outputs the value of the string parameter aString on the channel selected in the Code Generation Options panel.
- TRACE_INT(string name, integer anInt): Outputs the string value of the integer parameter anInt prefixed by it's name.
- TRACE_FLT(string name, float aFloat): Outputs the string value of the float parameter aFloat prefixed by it's name.
- TRACE_STR(string name, string aStr): Outputs the string value of the string parameter aStr prefixed by it's name.
- TRACE_KEY(string name, key aKey): Outputs the string value of the key parameter aKey prefixed by it's name.
- TRACE_VEC(string name, vector aVector): Outputs the string value of the vector parameter aVector prefixed by it's name.
- TRACE_ROT(string name, rotation aRot): Outputs the string value of the rotation parameter aRot prefixed by it's name.
- TRACE_LST(string name, list aList): Outputs the string value of the list parameter aList by it's name.
* Aside from MSGOUT, if the generated code does not include any calls to a particular trace function, then it is not included.
Certain code optimizations can be enabled by selecting Generate LSL (Optimized) from the main program menu bar Script menu. This temporarily adjusts the Code Generation Options and disables Performance Analysis resulting in more compact and optimized LSL code generated.
If you are using an external LSL simulator for debugging your scripts the non-optimized version may be desirable so that you can take advantage of Execution Tracing as described above. However the optimized version should almost always be used to generate the final, tested script for the SL environment.