SLE Ticker



18 Years and counting...Got SL News? Get it Published! Contact Lanai Jarrico at lanaijarrico@gmail.com

Friday, June 7, 2013

What The Hell is LSL?- Linden Scripting Language- MysticScottie Reporting…



LSL - Linden Scripting Language, that thing we all know exists but have no idea how it works.
To make the long story short, LSL is the life of the objects in Second Life. And I, MysticScottie will try my god damn hardest to help all you lay-mans understand LSL.



Step 1 - Get a strong shot of coffee, or whatever you use to get your mind active...




Step 2 - Put on your thinking caps.

Step 3 - Let me teach you how the basic "Hello Avatar" script works.

Ok, many of you readers may have right-clicked in your inventory and chosen "New Script", then all of a sudden Second Life presents you with : 




    
Then you are like F**K this!, and you close it as fast as possible.  Well, fear not readers, I will attempt to decipher this for you.

Ok, we will break this down bit by bit. The great thing about LSL, is it works in "States" i.e Open / Close, On/Off or Awake / Asleep, similar to that of your First Life, at the most basic level all scripts consist of at least one of these "States", the default state. 
    
Next we move on to Events. These Events are like triggers, for instance if you pull the trigger of a gun it fires a bullet. The "Hello World" script has 2 events, "state_entry()" and "touch_start()" both fairly self explanatory, the first triggers upon the entry of the default state and the second upon touching the object. 

State Entry = Upon creating the object and choosing "New Script



Touch start = After clicking it...... A few times




Now the event has been activated and we have functions. Functions are built in or created, all functions that have been created by Second Life begin with "ll", like the one we have above "llSay". Obviously "llSay" will just talk in local chat depending on either the object has just been placed or if touched.

Finally the Syntax, like on a calculator if you do something too radical it comes up with "Syntax error". All codes have rules to follow and with LSL, brackets, curly brackets and semicolons are its rules. The { above tells the script something is about to happen, and the} tells it something has finished allowing the script to move on. For each { you need a following}. The ;'s are used at the end of functions to inform the script that it is the end of that specific function.

I will wrap this lesson up now before I blow your minds with information. But as a parting gift, I will offer you some homework.

The following code has some errors, if you are so inclined i challenge you to fix it and then guess what it will do before attempting to run it. NO CHEATING!

default

state_enter()
{
    llSay(0, "Thank you for reading The SL Enquirer")
}

}


Thanks again, and good luck!
MScottie



1 comments:

  1. I never use Linden Script Language before, but if I understand the "Hello world" example right, the "Thank you" code is more like:
    ---
    default
    {
    state_enter()
    {
    llSay(0, "Thank you...");
    }
    }
    ---

    ¿How is the proper way to add comments at the right of some line of code to explain it?

    ReplyDelete

Comments will be reviewed and posted within 24 hours. Please note any abusive content or outside promotional links may not be approved.

 
cookieassistant.com