Jump to content
Sign in to follow this  
Alexander9 Carver

How did you learn LSL? Linden Scripting language

You are about to reply to a thread that has been inactive for 3225 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I am trying to learn LSL (Linden Scripting language). I tried learning LSL at http://slurl.com/secondlife/Horsa/51/220/84 College of Scripting in Horsa. I understand a little about LSL but i don't know enough to create a complex script. Any other sources in Secondlife or Websites were i could learn more about LSL and how to understand it?

 

How did you learn LSL?

Share this post


Link to post
Share on other sites

I already had a coding background, but my favorite method of learning in the begining was to experiment.... look at basic scripts that show structure, and tweak a little... have an idea for something I want to see if can be done, and look up what functions do that.....

the key for me is to spot the patterns first.... how things go together, and then to figure out what each piece is doing.learning first how events fit into states, and other code fits into those, and then what each is doing.

you should already have a link to the wiki, but if not http://wiki.secondlife.com/LSL_Portal is where you can go to look up how most every piece works, along with tons of examples.you can post here if you are having trouble finding the functions you need to do something specific, or the code is not behaving as you expect and you're stuck.

 

I dunno if this method will work for you, but it's an option.

Share this post


Link to post
Share on other sites

Well, my method of learning LSL is most likely not helpful for you. I started programming at age 16 (just shy of 40 years ago), so learning LSL was just a matter of adding another obscure dialect to my skillset. But I can offer some pointers that might help you get a better grip on it.

First of all, LSL is one of those languages that is a variant of the original "C" language invented as part of the Unix Operating System. C popularized many of the basic programming constructs such as functions, subroutines, code modules and a front-end filter called a "preprocessor". LSL borrows not only the general structure of C, but also utilizes a number of the common C language statements (such as function and procedure declarations, if-then-else flow control, for loops and do while loops and many others).

Original C also introduced a different way of thinking about program flow called "Event Driven Programming". While it was first really popularized in C, Event Driven Programming didn't really take off (as a main stream technique) until Microsoft revamped their Visual Basic language to include it as well. (I'm gonna get yelled at for saying that, but ah well .. such is life.)

LSL provides a very simplified model of Event Driven Programming by predefining the Events that can occur. If you study the LSL Wiki page for Events, you will see that they provide very good management of the various events that can occur in Second Life. Part of the trick to writing good LSL code is to become familiar with the Events and how LSL handles them.

Another very valuable concept that is included in LSL is what's called "State Modeling" or simply Program State. An LSL Script's State can be changed easily with LSL statements and can give multiple "Personalities" to a single script.

For example, in a simple "sit" script that handles someone sitting down on an object (such as a chair or couch, etc.), the LSL Script has two "states" ... one state for when there is no one sitting on it, and one where someone is sitting on it. As you visualize your script, you will often find that complex scripts need to change state to handle various situations it encounters. While powerful and handy, States can also be abused, so part of the finesse of programming in LSL is learning what makes a good reason to change State .. and what doesn't.

But really, the BEST way to learn LSL is to spend some time reading through the large number of free LSL scripts contained in the LSL Library, playing computer in your head as you read them, and slowly building up your comprehension of how the various LSL statements, techniques and features can be combined into functioning products and programs. As you start getting more and more comfortable with the various LSL statements and structures, you'll find that being able to write a quick script, drop it in a prim and run it is absolutely invaluable in testing and learning.

Oh, and one last thing, in about six months as you look back at some of your first scripts, don't beat yourself up too bad for writing such "yucky" code. It's a process that takes time .. learning good LSL style and technique. Fortunately for us, LSL is very forgiving for most common mistakes but also has the ability to be optimized and utilized to do some pretty amazing things.

Share this post


Link to post
Share on other sites

Visit NCI - eg; Kuula sim - and attend their classes.  Various other teaching organisations in SL also provide scripting classes.

  1. Take the classes for scripting basics
  2. Take the classes for specific scripting techniques (particles, physics, etc)
  3. do{
  4. Read the wiki
  5. Experiment/practice
  6. Read, discuss and ask here
  7. Keep up to date with the liibrary scripts in these forums and elsewhere (publishing a script for all to see and comment on means the author has to have pretty high confidence in it.  After being 'peer approved' by everyone means you can too)
  8. }while(TRUE)

Having said that scripting is programming so it helps rather a lot if you have a RL programming background.  As with RL programming a lot of people will never 'get it' and even more just won't have the interest/patience to become proficient.  There's so much in SL no-one can be good at all of it.

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 3225 days.

Please take a moment to consider if this thread is worth bumping.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...