LSL 101/A Gentle Introduction

From Second Life Wiki
Jump to navigation Jump to search

A Gentle Introduction to Scripting in Second Life

This section of 'LSL 101: The Wikibook' is written for the SL user who wants to script the things they build or own, but who perhaps has no experience of any kind with programming. If that's you, welcome! It will also be of use to people who have experience in other programming languages and would like a gentle introduction to LSL.

Since scripting is one aspect of building, we will assume that you, the reader, have rudimentary building skills. You should, at minimum, be able to create a prim, edit it, take it in and out of your inventory, be able to do the same with a notecard, and know how to put a notecard into a prim's inventory. That's about it. Everything else you'll need, we'll try to cover.

Whenever you want an object in SL to do something, to respond to a mouse click, to greet someone when they come close to it, to change its texture or colour - all the interesting things that objects do, other than just sit there - a script is needed. Scripts take note of things that happen and are able to carry out actions in response.

Scripts in SL are written in LSL (Linden Scripting Language), a simple but powerful programming language, tied closely to the SL environment. (Simple, in this case, is used to mean it is more limited than many other popular programming languages; not necessarily that it is simpler to learn, though it is not very difficult if you are really interested to do so.)

Preliminaries concluded, lets get started.