Sep 11

Interactive Linden Script Tutorial

Category: Exhibit, Second Life Scripting by Stone Culdesac

Here is another great site if you are looking to build your own stuff and learn the LSL scripting language, the Interactive Linden Script Tutorial has lots of great info, they have three books available, the first book contains copies of the posters from the LSL tutorial exhibition, the second book looks at using structured design with Linden script and the third book contains a set of structured exercises to help you learn linden scripting. I dropped 300 lindens on the three books while I was there, so if you have any specific questions, drop a comment and I’ll tell you if any of the books address what you are looking for and whether you should buy them or not.

A free interactive in-world tutorial to help you learn Linden Script. Developed by Clive Pro of Bromley College. Many of the posters they have in the main area include notecards containing the code for the program they are highlighting, such as this one.

// Bromley College
// Linden Script Exhibition

// Code for poster 40

float RUN_LENGTH = 120.0; // set timeout running time for movie to 2 minutes
integer CHANNEL = 42; // set dialog channel
list MENU_MAIN = ["play", "pause", "stop"]; // options for the main menu
key VIDEO_DEFAULT = “a2b04104-b16b-c537-6f1f-976a6b58ad43″; // choose default texture texture to replace with the movie

default
{
state_entry()
{
llListen(CHANNEL, “”, NULL_KEY, “”); // listen for dialog answers (from multiple users
llParcelMediaCommandList( [
PARCEL_MEDIA_COMMAND_URL, "http://s3.amazonaws.com/static-secondlife-com/media/mp4/20060824-pod_sl_getone.mp4", // set movie URL
PARCEL_MEDIA_COMMAND_TEXTURE,VIDEO_DEFAULT, // set default texture
PARCEL_MEDIA_COMMAND_AUTO_ALIGN, TRUE ] ); // play movie full size

}

touch_start(integer total_number)
{
llDialog(llDetectedKey(0), “What do you want to do?”, MENU_MAIN, CHANNEL); // present menu on touch
}

listen(integer channel, string name, key id, string message) // wait for agent’s response
{
if (message == “play”)
{
llSay(0,”Please wait while movie loads”);
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_PLAY ] ); // play movie
llSetTimerEvent(RUN_LENGTH); // start timer to stop movie after 2 mins
}

if (message == “pause”)
{
llSay(0,”Paused - Touch poster again to play”);
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_PAUSE ] ); // pause movie
}

if (message == “stop”)
{
llSay(0,”Please wait while movie unloads”);
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_STOP ] ); // stop movie
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_UNLOAD ] ); // unload movie - should restore texture
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_URL, "" ] ); // fix to restore original texture
llSetTimerEvent(0.0); // stop timer
llResetScript();
}

}
timer() //unload movie if it has been playing for more than 2 minutes
{
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_STOP ] );
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_UNLOAD ] );
llParcelMediaCommandList ( [ PARCEL_MEDIA_COMMAND_URL, "" ] );
llSetTimerEvent(0.0);
llResetScript();
}

}

// End of code;

They have a reading area, most of the posters will give you examples of the scripts, such as the one above plays a media file, the whole tutorial is available for purchase for 50 lindens, and you can read it as a notecard or where it as a hud. Check out some of the pics below, and visit this sim if you are interesting in some self paced LSL scripting education. They also mention a couple other LSL scripting resources, Using the Linden Script Language and the Linden Scripting Language Reference. Here is the Second Life URL for the site.

Interactive Linden Script Tutorial

Interactive Linden Script Tutorial 2

Interactive Linden Script Tutorial 3

Interactive Linden Script Tutorial 4

Interactive Linden Script Tutorial 5

Interactive Linden Script Tutorial 8

Popularity: 5%

No Comments

Leave a comment