Tuesday, September 27, 2011

Second Life Scripting (LSL)

What Is LSL?


LSL – Linden Scripting Language – is a simple yet powerful programming language
designed to work within Second Life to add action, reaction, interaction and
functionality to the world.




What Can You Do With It?

LSL lets you add “behaviors” to any object in Second Life.


You can make doors that open with a password, fires that burn, fireworks that
sparkle, weapons that shoot projectiles, and just about anything else you can
imagine.


If you learn the basics of this language, you’ll expand your creative options within
Second Life. If you become a skilled LSL programmer, you’ll be able to write
scripts for others as a business within Second Life.

~Beginner's Guide to Scripting



Hello World Demo


default
{
 state_entry()
 {
  llSay(0, "Hello, World!");
 }
 touch_start(integer total_number)
 {
  llSay(0, "Touched.");
 }
}


In the example code shown above, when an object is touched, the script sends a message that says "Hello, World."


To make this sample script, click "scripts" in the user panel. From here this script can be modified to do other things when touched. Some example of things you can do are: changing the color, rotating the object, etc.


*Note* Objects can have a maximum of 4 scripts attached.