LSL Basic Concepts
Before you start scripting, you need to understand a few important concepts. Read the following to understand the key concepts and terminologies.
Prims and Objects
Things inside Second Life are made of prims. A “prim” is the building block of basically all things in Second Life. (think of Lego toy blocks, or atoms.)
A prim has a name, description, type (box, sphere, cylinder etc), size, and several many other parameters depending on the type of prim (e.g. cut, hollow, twist, taper, etc). A prim has many sides, and most sides can have a texture and color.
Multiple prims makes up a Object. For example, a house, a sword, a flexy skirt, are objects.
Each prim can store other things inside itself. (known as the prim's inventory. Think of it as the prim's pocket or closet) For example, a prim can store other prims, objects, notecards, and scripts.
The way scripting works in Second Life, is to have a script inside a prim. Once a script is inside a prim, it can control its position and orientation, color and shape and size, physical properties, listen to commands, react to the environment, or any other interactivity provided by the scripting language. A running script always resides inside some prim that are rezzed somewhere.
Prims can be linked together. The primary purpose of “linking” is so that 3D construction can be made easier. (for example, a person can then move the whole thing as one single object) A object, such as a house, a sword, a hat, are not necessarily all linked together.
When multiple prims are linked together, one of the prim is called the root prim. The root prim is the last selected prim when making the link.
Understand linking is a important in some type of scripting. When creating scripted object made of multiple prims, you need to understand the parent/root relationship of the linking.
For example, create 2 prims. Then, select them one after the other. Note which one you selected last. Then link them. Then, drop a inventory item into the now linked object. Then, edit linked parts. You'll see that, the inventory item you dropped into is in the root prim, which is the last prim selected when you made the link.
Avatars and Attachment
A player inside Second Life is called a Agent, The 3D geometric representation of the player inworld, is called avatar.
A agent, is identified by a unique ID called a Key.
A avatar is made of body parts, and with other things attached to the avatar (for example, hair, bracelet, sword, gun, shoe.). These things that attach to the avatar are called the avatar's attachment. There are numerous predefined positions to attached to the body of a avatar. (e.g. skull, nose mouth, arms, shoulder, ankle…)
There are also some special positions on a player's screen, called Heads Up Display , that objects can be attached to. These are for user interfaces, such as a speed-meter and health-level meter or some other 2D graphical user interface elements a programer can create, such as buttons. These are mostly for games created inworld.
The avatar's poses, gestures (such as waving hands), movement animations (such as walking, dancing), are collectively called Animation Override (AO) and these are not done by LSL scripting. (scripting only control the activation or deactivation of animations) For those curious: avatar animations are done by uploading a file that describes human's skeletal positions and movements. The special file format used for this purpose by Second Life is called [ BVH ] [ https://en.wikipedia.org/wiki/Biovision_Hierarchy ].
Any prim or object has a creator , and owner.
SIM and Coordinates
A Region is a area of 256x256 meters inworld, and is run on a server by a Simulator process on a CPU. (We'll call “region” as “sim” here, because the term “region” is confusing.)
A sim appears on the map as a square. A sim can be owned by a (real life) person or a group of persons. The owner of a sim can control many aspects of the sim, including, for example, selling parts of the land, renting the land, create rules on what can be built there, create rules about a theme, style and purpose of the sim, create access list to allow only qualified player to enter, or rebooting the sim. A region costs about USD $1675, and with USD $295 monthly fee. (as of 2007-11) As of mid 2009, there are over 30 thousand sims.
A sim region, can be subdivided into smaller lands, to be rented or sold to people. A part of a sim subdivided this way is called a Parcel.
A sim has a regional coordinate system. Basically, triplet of numbers (x,y,z). The South West corner of the sim is (0,0,z), and z is the altitude.
Physics and Vehicles
A object has a number of properties, including material. Material is important when you are scripting a object that behaves like a physical object, for example, a car, a bullet. Any moving object that has physical properties are collectively called a vehicle.
The above info can get you started in LSL scripting, but is not all there is to know. Learning LSL scripting is a matter of experience, far more so than programing in other languages in other domains (for example, compared to Perl, Java, Lisp, systems programing, web server application programing).
As you start to do LSL scripting, you will pick up many more details of the context and environment LSL is used to control. LSL scripting is very much a trial and error, learn as you go, process.
You can now continue this tutorial on LSL Syntax.