loading

Step 2: Running Your First Script

Traditionally one starts by writing the smallest program possible to print "hello world". Since LSL only runs inside objects, you must know how to create an object and put a script inside it.

You must be on land which allows building. Either your own land, or land where you have permission to build on such as a sandbox. Right click on the ground and choose "create". (for one button macs use command+click)

By default, you should see a "wand" icon with which you can click and create a cube on the ground.

You will automatically enter "edit" mode and an edit window will pop up.
(Note: to place a script in an existing object, right click it and hit edit to open the edit window.)

In the edit window you may see a button marked "more>>>" click it to reveal five tabs marked general, object, features, content, and texture. Click "content".

This window shows the contents of an object which can hold scripts, notecards, even other objects. Press "new script" to add a new script.

This will open the LSL editor with a default script. This editor will color code your syntax and provide some info about keywords when you hold your mouse over them. It will also do basic syntax checking.

Before explaining the code, lets run it. Hit "save" and close your edit window (not the LSL editor window).

You should see the words "Hello Avatar" from "object"

If you touch the object, it will say "Touched."
(make sure the "edit" building window is closed for touching to work.

Congratulations! You have compiled and run your first LSL script!
<p>Can a different script language work in sl for example like : Java,JavaScript, Turbo C and Visual basic?</p>
<p>no just LSL but if you have the know how for other scripting languages.. this should fall right into place with minimal effort. :)</p>
<p style="margin-left: 20.0px;">Very grateful, for this information, I am trying to make my builds move, etc, and this really helped out a lot.. I will be back to review I am sure. :)</p>
<p>I ahve always wished a decent scripter should make some kind of turor app for lsl, something that will teach someone not only to script but understand LSL so someone can begin to truly create scripts.</p>
Just wanted to say thank you for the tut. Trying to find a place to start with all of this is hard, but things like this are certainly helpful. Thanks. Adrianne
I saw in a called site www.2lifeblog.com, some scripts to download; Basic Motorcycle Script, animated texture simple, final flight 2.2, and more, also it is possible to download the complete manual of scripting for Sl. Regards: Massimo
I saw in a called site www.2lifeblog.com, some scripts to download; Basic Motorcycle Script, animated texture simple, final flight 2.2, and more, also it is possible to download the complete manual of scripting for Sl. Regards: Massimo

About This Instructable

101,660views

21favorites

License:

Bio: Hey all, this is Blueman Steele. I don't log in much now but want to try to put some of the many things I ... More »
More by Blueman:How to edit scripts in Cloud Party Getting started in LSL scripting in Second Life 
Add instructable to: