Scripting Languages

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m
Line 1: Line 1:
 
= Scripting Languages =
 
= Scripting Languages =
  
OpenSim currently supports 3 scripting languages, and more are under way.<br />
+
OpenSim currently supports 4 scripting languages, and more are under way.<br />
 
Scripts are restored automatically when OpenSim starts.<br />
 
Scripts are restored automatically when OpenSim starts.<br />
  
 
== LSL ==
 
== LSL ==
LSLv2 is the well know 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.
Allthough many commands are still being developed, the majority of ll-functions has been implemented and it is possible to make usable scripts.
+
Although many commands are still being developed, the majority of ll-functions has been implemented and it is possible to make usable scripts.
 
If you want to ensure that the compiler treats your script as LSL you should have "//lsl" as the first 5 letters in script.
 
If you want to ensure that the compiler treats your script as LSL you should have "//lsl" as the first 5 letters in script.
 
Example code:
 
Example code:
Line 19: Line 19:
 
== C# ==
 
== C# ==
 
C# is a .Net language.<br />
 
C# is a .Net language.<br />
Allthough 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 />
+
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 "//cs" for the compiler to treat it as C#.<br />
 
The first 4 characters in your script must be "//cs" for the compiler to treat it as C#.<br />
 
<br />
 
<br />
Line 32: Line 32:
 
''Note! Mono does not have compiler for VB.Net, so VB.Net scripts may not work on Mono. :)''
 
''Note! 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 />
Allthough 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 4 characters in your script must be "//vb" for the compiler to treat it as VB.Net.<br />
  
Line 40: Line 40:
 
     llSay(0, "This is an incredibly useless program.")
 
     llSay(0, "This is an incredibly useless program.")
 
  End Sub
 
  End Sub
 +
 +
== JavaScript ==
 +
The first 4 characters in your script must be "//js" for the compiler to treat it as JavaScript.<br />
 +
 +
Example code:
 +
//js
 +
// TODO: Someone add this please :)

Revision as of 11:32, 4 February 2008

Contents

Scripting Languages

OpenSim currently supports 4 scripting languages, and more are under way.
Scripts are restored automatically when OpenSim starts.

LSL

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. If you want to ensure that the compiler treats your script as LSL you should have "//lsl" as the first 5 letters in script. 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 4 characters in your script must be "//cs" for the compiler to treat it as C#.

Example code:

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

VB.Net

Note! 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 4 characters in your script must be "//vb" for the compiler to treat it as VB.Net.

Example code:

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

JavaScript

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

Example code:

//js
// TODO: Someone add this please :)
Personal tools
General
About This Wiki