Scripting Languages

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Robot: Replacing 'OpenSim' to 'OpenSimulator', which is the precise name)
(Yield Prolog: remove caution - theoretical anyway)
 
(24 intermediate revisions by 2 users not shown)
Line 5: Line 5:
 
= Scripting Languages =
 
= Scripting Languages =
  
OpenSimulator currently supports 5 scripting languages, and more are under way.<br />
+
OpenSimulator currently supports 2 scripting languages (LSL and C#).  The others listed here are no longer supported or may only work on some platforms.
Scripts are restored automatically when OpenSimulator starts.<br />
+
 
 +
Scripts are restored automatically when OpenSimulator starts.
  
 
== LSL ==
 
== LSL ==
 
LSLv2 is the well known Second Life scripting language. It is basically a C#/Java-like language.
 
LSLv2 is the well known Second Life scripting language. It is basically a C#/Java-like language.
Although many commands are still being developed, the majority of ll-functions has been implemented and it is possible to make usable scripts.
+
The majority of ll-functions have been implemented and it is possible to make usable scripts comparable to SL.
If you want to ensure that the compiler treats your script as LSL you should have "//lsl" as the first 5 letters in script.
+
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:
 
Example code:
 
  default
 
  default
Line 22: Line 23:
  
 
== C# ==
 
== C# ==
C# is a .Net language.<br />
+
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.<br />
+
 
The first 4 characters in your script must be "//c#" for the compiler to treat it as C#.<br />
+
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.
<br />
+
 
 +
The first line of your script must be the comment "//c#" for the compiler to treat it as C#. You can also specify //XEngine:c# but at present you will find that YEngine does not support C# as of OpenSim 0.9.1.0 "Snail" release.
 +
 
 
Example code:
 
Example code:
 
  //c#
 
  //c#
Line 32: Line 35:
 
     llSay(0, "This is an incredibly useless program.");
 
     llSay(0, "This is an incredibly useless program.");
 
  }
 
  }
 +
 +
You also need AllowedCompilers = lsl, c# under [XEngine] to make this work.
  
 
== VB.Net ==
 
== VB.Net ==
''Note! Mono does not have compiler for VB.Net, so VB.Net scripts may not work on Mono. :)''
+
'''Mono does not have compiler for VB.Net, so VB.Net scripts may not work on Mono. :)'''
 +
 
 
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. You can also specify //XEngine:vb but at present you will find that YEngine does not support VB.NET as of OpenSim 0.9.1.0 "Snail" release.<br />
  
 
Example code:
 
Example code:
Line 44: Line 50:
 
     llSay(0, "This is an incredibly useless program.")
 
     llSay(0, "This is an incredibly useless program.")
 
  End Sub
 
  End Sub
 +
 +
You need AllowedCompilers = lsl, vb under [XEngine] to make this work.
 +
 +
If your server runs on Windows, do consider that any VB.NET scripts that an avatar were using would fail at present on a Hypergrid teleport to a grid running Mono, i.e. Linux/Unix/BSD etc.
  
 
== JScript.Net ==
 
== JScript.Net ==
The first 4 characters in your script must be "//js" for the compiler to treat it as JScript.Net.<br />
+
'''Javascript has not been present in OpenSimulator for a very long time (probably pre 0.6.6), as the required components are no longer supported upstream'''
 +
 
 +
The first line of your script must be the comment "//js" for the compiler to treat it as JScript.NET. However, JScript.NET support has been commented out in the code for some time. You'd need to do some serious work to fix it. You could theoretically specify //XEngine:js though presumably YEngine would not support JScript.NET as of OpenSim 0.9.1.0 "Snail" release even if the previous code were fixed?<br />
  
 
Example code:
 
Example code:
Line 54: Line 66:
 
     llSay(0, "This is an incredibly useless program.");
 
     llSay(0, "This is an incredibly useless program.");
 
  }
 
  }
 +
 +
If this were one day functional again, you would theoretically require AllowedCompilers = lsl, js under [XEngine] to make this work. But it doesn't work and simply throws an error. Presumably you would be using this entirely at your own risk and more than likely would need to write the code to make it work.
  
 
== Yield Prolog ==
 
== Yield Prolog ==
The first 4 characters in your script must be "//yp" for the compiler to treat it as Yield Prolog.<br />
+
'''Yield Prolog support has apparently not been in place for many versions.'''
 +
 
 +
The first line of your script would theoretically be the comment "//yp" for the compiler to treat it as Yield Prolog, or you could specify //XEngine:yp  - however, at present you will find that neither XEngine nor YEngine supports Yield Prolog as of OpenSim 0.9.1.0 "Snail" release and it seems unlikely that it will be supported again.<br />
  
 
Example code:
 
Example code:
 
  //yp
 
  //yp
 +
 +
You would theoretically require AllowedCompilers = lsl, yp under [XEngine] to make this work. But it doesn't work and simply throws an error. Presumably you would be using this entirely at your own risk and more than likely would need to write the code to make it work.

Latest revision as of 10:41, 20 November 2019


[edit] Scripting Languages

OpenSimulator currently supports 2 scripting languages (LSL and C#). The others listed here are no longer supported or may only work on some platforms.

Scripts are restored automatically when OpenSimulator starts.

[edit] LSL

LSLv2 is the well known Second Life scripting language. It is basically a C#/Java-like language. The majority of ll-functions have 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.");
   }
}

[edit] 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#. You can also specify //XEngine:c# but at present you will find that YEngine does not support C# as of OpenSim 0.9.1.0 "Snail" release.

Example code:

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

You also need AllowedCompilers = lsl, c# under [XEngine] to make this work.

[edit] 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. You can also specify //XEngine:vb but at present you will find that YEngine does not support VB.NET as of 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

You need AllowedCompilers = lsl, vb under [XEngine] to make this work.

If your server runs on Windows, do consider that any VB.NET scripts that an avatar were using would fail at present on a Hypergrid teleport to a grid running Mono, i.e. Linux/Unix/BSD etc.

[edit] JScript.Net

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

The first line of your script must be the comment "//js" for the compiler to treat it as JScript.NET. However, JScript.NET support has been commented out in the code for some time. You'd need to do some serious work to fix it. You could theoretically specify //XEngine:js though presumably YEngine would not support JScript.NET as of OpenSim 0.9.1.0 "Snail" release even if the previous code were fixed?

Example code:

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

If this were one day functional again, you would theoretically require AllowedCompilers = lsl, js under [XEngine] to make this work. But it doesn't work and simply throws an error. Presumably you would be using this entirely at your own risk and more than likely would need to write the code to make it work.

[edit] Yield Prolog

Yield Prolog support has apparently not been in place for many versions.

The first line of your script would theoretically be the comment "//yp" for the compiler to treat it as Yield Prolog, or you could specify //XEngine:yp - however, at present you will find that neither XEngine nor YEngine supports Yield Prolog as of OpenSim 0.9.1.0 "Snail" release and it seems unlikely that it will be supported again.

Example code:

//yp

You would theoretically require AllowedCompilers = lsl, yp under [XEngine] to make this work. But it doesn't work and simply throws an error. Presumably you would be using this entirely at your own risk and more than likely would need to write the code to make it work.

Personal tools
General
About This Wiki