WHO THIS TUTORIAL IS FOR:
This tutorial is intended for those who have never programmed before, Second Life or elswhere. However, this tutorial will make little sense outside of Second Life. LSL is very specific to Second Life.
You will begin by running the standard "hello world" script and eventually move towards making your own. You will need to be familiar the basic principles of Second Life and general building skills before you can make use of everything in this tutorial.
Let's move to step 1. "What is LSL?"
Remove these ads by
Signing UpStep 1What is LSL?
One thing that makes LSL unique is it's heavy emphasis on "States" and "Events". A door can be "open" or "closed" and a light can be "on" or "off". A person can be "hyper", "calm", or "bored". Many real life objects have "states" and the same can be true for LSL programs. Minimally a script will have one state, the default state.
An event can be thought of as a "Trigger". Events are not user defined in Second Life but rather predefined in LSL. One called Touch_start(), will trigger the code in it when the object running the script is touched. So the minimum LSL program must have one state with one event in it. Here is a look at a minimal program in written in LSL that can loosely be translated as...."When I am in the default state, and I am touched, say "Hello World" on channel zero".
default
{
touch_start(integer total_number)
{
llSay(0,"Hello World");
}
}
WHAT CAN I DO WITH SCRIPTS?
Scripts can make an object move, listen, talk, operate as a vehicle or weapon, change colour, size or shape. A script can make an object listen to your words as well as talk back to you, scripts even let objects talk to each other.
The most basic object in Second Life is the "Prim" or primitive, the basic building block of all objects you can build in Second Life. When several prims are linked, they can each contain a script which speaks to the rest of the object via Link Messages. These are faster and more private than having objects "chat" or email each other. These are beyond the scope of this tutorial and we will instead focus on single scripts in a single prim.
Scripting is harder to learn than basic object manipulation, but is very rewarding once you make progress.
If you've built in Second Life, everything you can define in the edit window can be defined in a script. All interaction you see between objects or between avatars and objects is via scripts.
Learning more about the world and building model is vital to some aspects of scripting, thus I'd recommend a good foundation in building as you learn to script.
| « Previous Step | Download PDFView All Steps | Next Step » |
3
comments
|
Add Comment
|
![]() |
Add Comment
|































