Scripting Languages

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(C#: Warning about enabling this)
(VB.Net: Update with warning about enabling it in public regions)
Line 43: Line 43:
 
VB.Net is a .Net language.<br />
 
VB.Net is a .Net language.<br />
 
Although it is VB.Net the behaviour is much like LSL in the sense that you still use ll-functions like llSay(), and still use the same events as in LSL.<br />
 
Although it is VB.Net the behaviour is much like LSL in the sense that you still use ll-functions like llSay(), and still use the same events as in LSL.<br />
The first 4 characters in your script must be "//vb" for the compiler to treat it as VB.Net.<br />
+
The first line of your script must be the comment "//vb" for the compiler to treat it as VB.NET. For a particular script engine, you can also specify //XEngine:vb or //YEngine:vb (caution: YEngine is still considered experimental in OpenSim 0.9.1.0 "Snail" release!)<br />
  
 
Example code:
 
Example code:
Line 50: Line 50:
 
     llSay(0, "This is an incredibly useless program.")
 
     llSay(0, "This is an incredibly useless program.")
 
  End Sub
 
  End Sub
 +
 +
Only XEngine currently supports VB.NET. You need AllowedCompilers = lsl, vb under [XEngine] to make this work. Caution! This may not be safe because visitors *may* be able to use arbitrary code. Use it at your own risk or only in regions where no others have access.
  
 
== JScript.Net ==
 
== JScript.Net ==

Revision as of 03:31, 20 November 2019


Scripting Languages

OpenSimulator currently supports 2 scripting languages. The others listed here are no longer supported or may only work on some platforms.

Scripts are restored automatically when OpenSimulator starts.

LSL

LSLv2 is the well known Second Life scripting language. It is basically a C#/Java-like language. The majority of ll-functions has been implemented and it is possible to make usable scripts comparable to SL. Although LSL (including OSSL and Mod* functions where enabled) is the default, if for any reason you want to ensure that the compiler treats your script as LSL you should have "//lsl" in a comment in the first line of the script. For a particular script engine, you can also specify //XEngine:lsl or //YEngine:lsl (caution: YEngine is still considered experimental in OpenSim 0.9.1.0 "Snail" release!) Example code:

default
{
   state_entry()
   {
      llSay(0, "This is an incredibly useless program.");
   }
}

C#

C# is a .Net language.

Although it is C# the behaviour is much like LSL in the sense that you still use ll-functions like llSay(), and still use the same events as in LSL.

The first line of your script must be the comment "//c#" for the compiler to treat it as C#. For a particular script engine, you can also specify //XEngine:c# or //YEngine:c# (caution: YEngine is still considered experimental in OpenSim 0.9.1.0 "Snail" release!)

Example code:

//c#
public void default_event_state_entry()
{
    llSay(0, "This is an incredibly useless program.");
}

Only XEngine currently supports C#. You need AllowedCompilers = lsl, c# under [XEngine] to make this work. Caution! This may not be safe because visitors *may* be able to use arbitrary code. Use it at your own risk or only in regions where no others have access.

VB.Net

Mono does not have compiler for VB.Net, so VB.Net scripts may not work on Mono. :)

VB.Net is a .Net language.
Although it is VB.Net the behaviour is much like LSL in the sense that you still use ll-functions like llSay(), and still use the same events as in LSL.
The first line of your script must be the comment "//vb" for the compiler to treat it as VB.NET. For a particular script engine, you can also specify //XEngine:vb or //YEngine:vb (caution: YEngine is still considered experimental in OpenSim 0.9.1.0 "Snail" release!)

Example code:

//vb
Public Sub default_event_state_entry()
    llSay(0, "This is an incredibly useless program.")
End Sub

Only XEngine currently supports VB.NET. You need AllowedCompilers = lsl, vb under [XEngine] to make this work. Caution! This may not be safe because visitors *may* be able to use arbitrary code. Use it at your own risk or only in regions where no others have access.

JScript.Net

Javascript has not been present in OpenSimulator for a very long time (probably pre 0.6.6), as the require components are no longer supported upstream

The first 4 characters in your script must be "//js" for the compiler to treat it as JScript.Net.

Example code:

//js
function default_event_state_entry()
{
    llSay(0, "This is an incredibly useless program.");
}

Yield Prolog

The status of Yield Prolog support is currently unknown.

The first 4 characters in your script must be "//yp" for the compiler to treat it as Yield Prolog.

Example code:

//yp
Personal tools
General
About This Wiki