Tuesday, July 5, 2011

2013 HELP: Scripting. Meet LSL, object oriented, event driven and other concepts

Object oriented, event driven
You probably don't need to remember this page.  If you fool with scripts at all (even just putting them into objects), you may need to understand the concepts here.
  • Script (in LSL)
  • Object-oriented
  • Event-driven
  • Triggering event
  • Parameter (in a script)
  • Function (in scripts)
  • User-defined Function
Script (in LSL) 
A script (LSL) in a text document with instructions to Second Life software telling it what you want to happen and when you want it to happen.  A script document can exist in your inventory or in the contents of an object.  Your inventory has a folder named Scripts.  
Click on the name to open the folder.  Note the special  graphic used to mark a script.  That is how you distinguish it from other assets.
You can move (full perm) scripts between your inventory and object contents by dragging them. Assuming they are full perm, you will drag a copy and another copy will remain.
LSL scripts only live in contents of an object.  You inventory can contain scripts as documents.  Those are just lines of text.  When you put a script into the contents folder of an object, the system recognizes the lines as instructions to be carried out (executed) and makes the necessary arrangements.
Many instructions in scripts apply specifically to the objects that contain them.  You can put the same script in multiple objects and so give them all the same instructions.
Object contents: what you put there and why
A script will contain one or more triggering events each followed by a block of code that tells the system what to do when the triggering event occurs.  Example:
Triggering event: Touch (left mouse click on the object).
Action: Give a specific notecard to the person who touched the object.
You can find a list of trigger events here:
LSL Wiki
Parameter (in a script):   A value that can be changed to alter some specific result of a script without requiring any other change in the script.  Parameters are often used to control details of what the script does.
Function (in scripts)
An independent unit of code that is executed on call.  It is often controlled by parameters supplied at the point/time of execution.
User-defined Function
Code placed at the beginning of a script to be executed at one or more later points.  It is often controlled by parameters supplied at the point/time of execution.  User-defined Functions are convenient for handling code that is to be reused, either in a single script or in multiple scripts. In the other resources below, you will find user-defined functions that you may want to collect and use in your own scripts.
To reuse such a function, you copy the code into the beginning of another script.  Control by parameters can allow great flexibility of use.  You do not need to know any details about a function works  to use it.  You only need to know what result comes from the function, how the parameters control it, and where it begins and ends.
Other resources

  • What do we do in Virtual Worlds? 
  • Search on page with Google Chrome: Ctrl+f, search bar upper right 
  • Google search this blog, column on right
  • or put site:virtualoutworlding.blogspot.com at the end of the search terms
  • Annotated screen shots made with Jing
  • Creative Commons License, attribution only.
  • Second LifeLindenSLurl, and SL are trademarks of Linden Research Inc.
  • This blog is not affiliated with Second Life or anything else.  
  • Ads are  from Google

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.