Compiling LSL to OpenSim C# - Teriks/LibLSLCC GitHub Wiki
Compiling
You can quickly compile the currently selected editor tab into OpenSim compatible C# by pressing Ctrl+Alt+C.
The default compile configuration is OpenSim Client Code, which will generate C# that can be uploaded to any un-modified OpenSim server with C# script uploads enabled.
If your server has "co-op" stop mode enabled for LSL scripts, you will want to pick the second configuration shown in the image below instead of the first.
The other two configurations will only work with: https://github.com/Teriks/OpenSim_With_LibLSLCC
And only when the AllowedCompilers option has csraw listed in your server config.
The last two configs that come with LibLSLCCEditor by default are mostly used for testing code generation, but also allow for full script reset support when using external C# uploads.
Library Data
Before you compile any code for OpenSim, you may want to setup the editor to allow only the subset of LSL which is implemented by OpenSim. Which can be done from the Tab Library Data menu item in the main window toolbar.
If you are going to use the OpenSim OSSL subset as well, you should make sure that the OSSL functions are enabled for use inside of your servers config file. Otherwise just select OpenSim LSL.
Compiler Config
You can create new compiler configurations from the Settings window.
The default compiler configurations that come with LibLSLCCEditor are readonly to prevent them from being irreversibly lost when being fiddled with (messing with them requires some arcane knowledge on how OpenSim actually works under the hood)
They can however be copied and then modified from the Settings window. Also exported/imported just like the rest of the editors various settings. A couple different things can be modified, such as what C# libraries are imported, the script header comment, and more advanced settings which are beyond the scope of this documentation.
Generated Code Example
Compiling with OpenSim Client Code will generated this from the simple "Hello World" program that the editor opens new tabs with:
//c#
/**
* Do not remove //c# from the first line of this script.
*
* This is OpenSim CSharp code, CSharp scripting must be enabled on the server to run.
*
* Please note this script does not support being reset, because a constructor was not generated.
* Compile using the server side script option to generate a script constructor.
*
* This code will run on an unmodified OpenSim server, however script resets will not reset global variables,
* and OpenSim will be unable to save the state of this script as its global variables are created in an object container.
*
*/
//Compiled by LibLSLCC, Date: 5/15/2018 4:05:00 AM
//============================
//== Compiler Utility Class ==
//============================
private static class UTILITIES
{
public static void ForceStatement<T>(T val) {}
public static bool ToBool(LSL_Types.LSLString str)
{
return str.Length != 0;
}
public static LSL_Types.Quaternion Negate(LSL_Types.Quaternion rot)
{
rot.x=(-rot.x);
rot.y=(-rot.y);
rot.z=(-rot.z);
rot.s=(-rot.s);
return rot;
}
public static LSL_Types.Vector3 Negate(LSL_Types.Vector3 vec)
{
vec.x=(-vec.x);
vec.y=(-vec.y);
vec.z=(-vec.z);
return vec;
}
}
//==================================
//== Default State Event Handlers ==
//==================================
public void default_event_state_entry()
{
this.llSay(0,"Hello World!");
}