Jump to content
You are about to reply to a thread that has been inactive for 109 days.

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

Recommended Posts

Posted

I would like to learn to script and I don't have any real programming experience.  I'd eventually like to do things like working with experience tools, too.  As a beginner, should I be learning LSL, Lua, or both?  I know Lua isn't available yet for SL, but it would take me a long time to learn LSL or Lua anyway.

 

Posted (edited)

There are loads of script examples and snippets on the LSL Portal which will help you, but there is very little on Lua at the moment.

 

Don't worry that you have to learn it all, you can just learn the basics such as making a cube have a text label over it, or say something when touched. Study the examples in the wiki.

Edited by Profaitchikenz Haiku
  • Thanks 1
Posted

There are two distinct things you must learn to use a scripting language , such as LSL.

1) The syntax (grammar) of the language itself. And how to use the available tools to compile the scripts you make. LSL and Lua have quite different syntaxes , right now LSL is available and you have an easy way to test your scripts, and many many examples.

2) the hard part in scripting in SL (or anywhere else) is learning the framework - in LSL that's all the functions that start with ll....   and which collectively act on the objects/avatars/whatevers in SL. It's hard because you have to know what the verb does AND all the constraints on it's use. The framework wil be the same in LSL and in Lua, at least initially.

So, my suggestion is fool around with LSL while you wait for Lua. Because that way you'll learn the framework and absorb some of the mindset you have to have s a script writer.

  • Like 2
  • Thanks 1
Posted

At present, there's no real choice but to use LSL. First, it's the one that's available now, and second, for a long time (forever?) it will be the one for which there are examples you can consult. Even the library functions in the wiki have LSL examples, and I have a hard time imagining anybody wasting the time to recreate parallel examples in another language.

At some point, programmers get enough experience learning different languages that picking up another one becomes a minor aggravation—they all need to do the same stuff, just are clumsy about it in different ways—but even for a new programmer first learning SL scripting, the specific design flaws in either language will not be the hard part.

Honestly, the only reason I see to bother with Lua for SL in the mid-term future is that the same language will be usable viewer-side, although that's pretty superficial—it's not as if the same Lua programs will ever run on the viewer and the sim. (Caveat: someday there could be specific functionality sim-side that's only available to Lua programs, or more likely some minor performance tricks, but that's just speculation at this point.)

  • Like 3
  • Thanks 1
Posted
4 hours ago, Bavid Dailey said:

There are two distinct things you must learn to use a scripting language , such as LSL.

1) The syntax (grammar) of the language itself. And how to use the available tools to compile the scripts you make. LSL and Lua have quite different syntaxes , right now LSL is available and you have an easy way to test your scripts, and many many examples.

2) the hard part in scripting in SL (or anywhere else) is learning the framework - in LSL that's all the functions that start with ll....   and which collectively act on the objects/avatars/whatevers in SL. It's hard because you have to know what the verb does AND all the constraints on it's use. The framework wil be the same in LSL and in Lua, at least initially.

Actually, the third part is the most important and can be the hardest: Logic. You can't even begin to write a script until you can frame the project well enough in your mind to know where you're going.  Also, you have no hope of finding and repairing the inevitable errors in a script unless you have built it around a logical framework, and unless you can think logically through the ways that it might have gone wrong. Too many beginning scripters get focused on syntax, grammar, and the mass of available functions, forgetting that they need to know exactly what their script is meant to do. That's the thinking part.

So, the best way to start learning, I believe, is to study very simple scripts (like the examples in the LSL wiki ) to see what they do. The ones on the function pages in the LSL wiki are good because they focus on one operation and they are usually well documented. Unlike scripts you may find randomly in world, they have been written by more experienced scripters and they are less likely to contain logical, syntax, and grammar errors. Your primary goal is to understand what each script is meant to do, and how the scripter has framed the problem. Your secondary goal is to become familiar with the language. Tutorials in the wiki can help with that stuff.

Learn by picking examples apart and trying to make modifications to make them do something slightly different, always asking yourself, "Can I draw a simple road map that describes what this script is doing?  Is there another way to frame the same problem? What other problems does this remind me of?"  Then ask, "Why is this function here?  What is it doing to make the logical process work? What would happen if I changed it somehow?" When you start to write your own scripts, get in the habit of thinking in modules -- baby steps -- instead to trying to tackle large, complex ideas all at once. Make yourself charts, diagrams, maps to show how the modules fit together to make the whole idea. To my way of thinking, this general approach will help build habits that keep you from getting lost in the weeds and will help you write scripts that not only work but also make sense.

  • Like 4
  • Thanks 1
Posted

LSL is a great place to start because while it's not exactly the most optimized, there is TONS of info out there that make jumping into it very simple in comparison.  You start learning how each individual part works, how to format the logic if it all, how to plot out the script, how to find specific information, etc.  So start with LSL just to get used to it, and then branch from there.  I saw something that always stood out to me...10% of programming is learning the language, the other 90% is knowing what you want to say and how to say it.

  • Like 3
  • Thanks 1
You are about to reply to a thread that has been inactive for 109 days.

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...