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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 2. Getting Started2.1.4. Touch Eventtouch_start(integer total_number){llSay(0, "Touched.");}There are many events that can be detected in your scripts by declaring a handler. The touch_start() event israised when a user touches the object through the user interface.2.1.5. Try it OutNow that we have seen the default script, and examined it in some detail, it is time to to see the script in action.Save the script by clicking on Save. During the save process, the editor will save the text of the script andcompile the script into bytecode and then save that. When you see message ’Compile successful!’ in the previewwindow, you know the compile and save is done.To test the script you will have to apply it to an object in the world. Create a new object in the world by contextclicking in the main world view and selecting Create. When the wand appears, you can create a simple primitiveby clicking in the world. Once the object appears, you can drag your newly created script onto the object to startthe script.Soon after dragging the script onto the object, you will see the message Object: Hello Avatar!Make sure the touch event is working by clicking on the object. You should see the message Touched printedinto the chat history.2.2. Using The Built-In EditorThe built in editor comes with most of the typical features you would expect from a basic text editor. Highlighttext with the mouse, or by holding down the shift key while using the arrow keys. You can cut, copy, paste, anddelete your selection using the ’Edit’ pull down menu or by pressing the usual shortcut key.2.3. Using Alternative EditorsSince the built-in editor supports pasting text from the clipboard, you can employ a different editor to edit yourscripts, copying them into Second Life when you’re ready to save them.4

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

Saved successfully!

Ooh no, something went wrong!