3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Getting started in LSL scripting in Second Life

Step 5Putting it all together

Line by line, here is the hello avatar script. Copy and paste this to a new script to see it color coded.

// All Scripts need a Default State
default
// this open curly bracket denotes the start of the state
{
state_entry() // an event
// another curly bracket starts the body of the event
{
llSay(0, "Hello, Avatar!"); // a function inside the event
}
// closed curly bracked closes the state_entry event

touch_start(integer total_number) // another event inside default state
{
llSay(0, "Touched."); // a function between the brackets of the touch_start body
}
// end of touch start
}
// Code end

The instant you save your script, it enters default state, which in turns runs the "state_entry" event which in turn runs the funciton llSay() which makes the object talk.

After this the program waits idle in the default state until a new event is called.

Touching the box triggers the even "touch_start" which also makes the object speak.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
4
Followers
1
Author:Blueman
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 learned in Second Life here on this site.