Week 14 : Second Life Scripting

Introduction
Scripting makes a big part of Second Life because object interactivity is largely customizable using the scripting language in Second Life (LSL). This scripting language is similar to javascript & is event driven.

Scripting
Being  a bit more experienced from the previous sessions, I knew what I had to do in order to create scripts on objects. So as soon as I logged In I started experimenting with different script on my objects. The first thing script I wrote was executed as soon as someone touches the object. Here's the code to do that:

default
{

    touch_start(integer total_number) {

        // speak out loud!
        llShout(0,"Hello!");

    }

}
To script some code on an object, you have to right click on an object, press edit & content> new script. Than a window will appear in which you can right your favorite scripts. Here's a screen shot to illustrate just that.



Conclusion
It's pretty easy to script an object once you learn the events, internal functions and get used to the scripting language. I have already used event driven languages such as C# but i think that this language is more similar to Flash actionscript & in fact I think the two have really close similarities.This scripting language also consists of pretty good documentation which can be found online at http://wiki.secondlife.com/wiki/LSL_Portal. The conclude this post, I suggest that before trying to develop some scripts by yourself, first go into the portal & see some example scripts which you could easily understand unless they are comprised of complex graphics & 3d scripts.

0 comments:

Post a Comment