11.07.2015 Views

Linden Scripting Language Guide - Engineering Center

Linden Scripting Language Guide - Engineering Center

Linden Scripting Language Guide - Engineering Center

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 2. Getting StartedYou’re probably wondering what you can do with LSL, and how quickly you can do it. We’ll start with somesimple examples, disect them, and introduce you the the script development process while we’re at it.2.1. Hello AvatarContinuing a long tradition of getting started by looking at a script that says "Hello", we’ll do just that. Thoughobviously not a particularly useful example on it’s own, this example will introduce us to:• Creating a basic script• Script states• Calling functions• Script events• Applying a script to an object2.1.1. Creating the ScriptStart by opening your inventory and selecting ’Create|New Script’ from the inventory pull down menu. This willcreate an empty script called ’New Script’ in your ’Scripts’ folder. Double click on the text or icon of the scriptto open the script in the built in editor. When you open the script, the viewer will automatically insert a basicskeleton for lsl. It should look like:default{state_entry(){llSay(0, "Hello, Avatar!");}}touch_start(integer total_number){llSay(0, "Touched.");}A casual inspection of this script reveals that this scipt probably says ’Hello, Avatar!’ when it enters some state,and it says ’Touched.’ when it is touched. But since this is also probably the first time you have seen a scriptwe’ll disect this short listing, explaining each segment individually.2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!