Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×

Introduction to Linden Scripting Language 139

prostoalex writes "Dr. Dobb's Journal runs a lengthy introduction to Linden Scripting Language, the language behind avatars and their interaction in Second Life: "LSL is a scripting language that runs server-side, on a piece of software called the simulator. The simulator does just what it's name implies — it simulates the virtual world of Second Life. Each simulator runs everything for 16 acres of virtual land — buildings, physics, and of course, scripts. While you manipulate the script text in a form that is somewhat easy to read, the actual code that runs on the simulator is compiled. A compiler is a piece of software that takes the text version of the script and converts it into something that can actually run. In the case of LSL, the compiler exists within the Second Life viewer itself. In the future, it is likely that the compiler will move from the viewer into the Second Life simulators, but where the code is compiled isn't very important. What matters is that the text is converted into a form that can run on the simulators.""
This discussion has been archived. No new comments can be posted.

Introduction to Linden Scripting Language

Comments Filter:
  • by excelblue ( 739986 ) on Sunday February 25, 2007 @12:12PM (#18143944) Homepage
    Is this a way for Linden Labs (and possibly for others) to provide closed source scripts and objects? This seems to be a very possible thing with such technology.

    What if someone only made available a compiled copy of something? It'd be scary if you can't tell what's really going on with all the stuff.
    • Re: (Score:1, Insightful)

      by Anonymous Coward
      If you don't trust the person writing the script with only a compiled version, why are you trusting their script at all? Having the source code to something only means that you can probably find the malicious code, not that it doesn't exist.
      • Re: (Score:3, Insightful)

        by ajlitt ( 19055 )
        Who cares? Linden owns the production systems, so you're not guaranteed that execution on the simulator is one-for-one with the game.
    • Re: (Score:2, Informative)

      by Yetihehe ( 971185 )
      Yes. No. Well, sort of. You can just sell or give someone an object with compiled script. If he doesn't have rights to modify script, he don't see source code.
      • Re: (Score:3, Interesting)

        by makomk ( 752139 )
        Yes. No. Well, sort of. You can just sell or give someone an object with compiled script. If he doesn't have rights to modify script, he don't see source code.

        In fact, he can't even see the object code. (Actually, SL doesn't let you obtain the object code for scripts even if you do have the right to modify them. Combine this with the fact that compilation is currently client-side, and just inspecting the source of a script someone gave you isn't sufficient to ensure it's not malicious - you need to reco
        • by mwvdlee ( 775178 )
          It depends on your definition of Open Source.

          If by open source you mean having access to the code, enabling you to fix or change the code then there is no problem with disallowing redistribution of it.

          If by open source you mean that the code is free (as in beer), then you'd need more rights.

          Open source != GPL

          (GPL is just one flavor of open source)
          • by makomk ( 752139 )
            No, but open source does mean "conforming to the Open Source Definition [opensource.org]", which software that doesn't allow redistribution definitely doesn't do. ("Open Source" is actually a trademark...)
    • by turrican ( 55223 )
      "What if someone only made available a compiled copy of something? It'd be scary if you can't tell what's really going on with all the stuff."

      MIcrosoft is gonna be jazzed! The'll want to go this route when releasing a virtual copy of Windows for use within the SecondLife game...
      • Well, Linden Labs is planning on using Mono for LSL, and possibly to provide other languages such as C#..
    • Compilation is also very possible with Python (Freeze, cx_Freeze, py2exe, and PyInstaller) and Perl (Perl2Exe, PerlBin). I'm not sure exactly why they're reinventing the wheel with this scripting language, because compilation is not a unique feature by any stretch of the imagination.
    • Re: (Score:2, Interesting)

      by MilenCent ( 219397 )
      In fact, as people found out recently during the whole CopyBoy ruckus, using an outside client with the game allows people to copy almost any object in Second Life, but the scripts in objects were still safe. There is no known way to get the source code off an object for which it hasn't been provided, even through decompilation, since the object code, once on their servers, would seem to reside and run there entirely.
    • by suv4x4 ( 956391 )
      What if someone only made available a compiled copy of something? It'd be scary...

      You're too easily scared. Open or not, the script runs on the server, so that script kiddies can't tweak it on their clients.

      Also they are migrating to .NET soon, so maybe this will let you sleep at night.
  • by Chairboy ( 88841 ) on Sunday February 25, 2007 @12:14PM (#18143952) Homepage
    Credit where credit's due, it's important to note that LSL is the first scripting language to have furry [wikipedia.org] specific classes. This is an oft-overlooked aspect of modern languages.
    • Arf (Score:1, Funny)

      by Anonymous Coward
      Doesnt the C in C# stand for Canines? Everyone keeps saying its a language to sink your teeth into.
    • by mrcdeckard ( 810717 ) on Sunday February 25, 2007 @01:14PM (#18144318) Homepage

      it's funny, i just checked out 2nd life last night -- first time since a year or two ago -- and i was pretty amazed -- the place is one big car lot or sex club. really. i guess there are two kinds of people in 2nd life now -- the people selling "sex", and the people trying to sell their objects to buy the "sex".

      it really was a cool online social experiment -- it only ultimately confirmed what we knew all along -- the internet is good only for porn and consumerism.

      now, think about this for a second. first, it's not real sex that is drawing people. it's not even imagery of real people having sex. it's interaction of poorly-rendered avatars in a virtual world. this is a testament to the power of the sexual drive in humans, and what we decide to do with our best technology..... just a friendly reminder that yes, we are doomed.

      mr c
      • ... and of course, the language lacks a "redeemLindenDollarsForRealMoney()" function.

        Even Linden Labs now admits (after the taxman commeth ... and the online gambling investigators ...) that Linden$$$ are just play tokens, with no relation to real-world currency.

        • by vadim_t ( 324782 )
          it's not in the language, but it's on the website:

          https://secure-web7.secondlife.com/currency/sell.p hp [secondlife.com]
          • ... and every time someone tries to cash out any significant amount, the value drops several 100 percent - there's no real float, no "market makers". Plus, with the feds getting into the whole "you can't gamble on the intarweb", they either have to shut the virtual casinos down, or completely decouple Linden$ from the real world.

            • Comment removed based on user account deletion
              • Plus, with the feds getting into the whole "you can't gamble on the intarweb", they either have to shut the virtual casinos down, or completely decouple Linden$ from the real world.
                I don't live in the States.

                You don't have to - the servers are there, and if the feds say "no refund or exchange of Linden$" the credit card companies will do as they're told, same as the rest of the online gambling sites.

        • by MilenCent ( 219397 ) <johnwh@@@gmail...com> on Sunday February 25, 2007 @02:09PM (#18144798) Homepage
          But what is real currency? All money is fake, on a basic, fundamental level. Online games simply use faker money than usual, but with real world transactions becoming increasingly virtual, the difference between the two is becoming much more uncertain over time.

          It is in the best interest of any online world to convince the government that their money is fake, since that means they won't have to subject their servers and source code to government oversight, which would ultimately make the game much harder to implement. Most games are content to let it rest at that, since they see their money as play tokens themselves.

          Linden Labs is one of the first companies to realize that there is a value in allowing the public, if not regulators, to think otherwise. All L$ cashouts are probably, technically, at LL's discretion; to give players a true, real-world legal right to convert money would mean the government would ultimately start taking a hard look at them, since from a real-world standpoint they would start looking like a bank at best, and a potential tax dodge at worst.

          It is important to note, though, that Linden Labs' business requires that the illusion be maintained. If they actually did refuse to cash out L$, it would shake user faith in the system. Trading between real-and-virtual money may be ultimately by permission only, but to exercise that authority would be dangerous to their business, and they seem like they're in this some degree of foresight instead of hoping to make a quick buck, so L$ are still, practically, safe to buy and sell. Mostly.
          • Well thats how the US built up its currency, but backing it by gold. Once it became popular enough they no longer needed to back it and people used it anyways. Given there are a lot of third party L$ traders and people willing to buy from third parties that offer better prices than SL themselves does, its not impossible the LL could just stop someday and the economy could continue.
          • by mwvdlee ( 775178 )
            I agree with your statements, especially regarding the mutual need to keep up the illusion if real currency value.

            It just reminds me of one thing; the "end-game scenario" for Second Life.

            No doubt that someday, Second Life will be replaced by something bigger and better. It may not be soon but it is inevitable. Second Life is a platform based on networking technology of several years ago, at some point they will be surpassed.

            Then what happens? At that point, when Second Life's demise is inevitable and predic
            • That could be the case, if Linden Labs themselves plan on shuttering the doors permanently upon Second Life's demise. Otherwise they'll destroy their reputation as responsible virtual world stewards.

              In fact, if the illusion is shattered for Second Life, it would harm confidence in all VWs that seek to be anything more than MUDs or graphical MUDs. Linden Labs still has a fairly positive reputation, so for them to suddenly turn evil, it'd do more than wreck confidence in that one company, but in the idea th
      • by kahei ( 466208 )

        I agree with your above post except that I would insert 'not' before 'doomed' in the last line.

        If we were incapable of finding channels for commerce and amusement in new environments, then yeah, we'd be doomed.

        Having said that, if people really buy sex on 2nd life, that's kind of sad. Not because buying sex is sad but because it suggests it's a less positive environment than, say, FurryMUCK was in the last decade.

      • You used to have to go to MUDs or MUCKs to have fake sex with your anthropomorphic wolf lover, but now you can do it in Second Life with graphical avatars and animations and everything! Please kill me now!
      • Re: (Score:2, Interesting)

        by DaleGlass ( 1068434 )
        Nah, there are plenty of people in SL which aren't in it for the porn. A significant portion of the grid is PG. There are quite a few people who use it as a chat, or because they like scripting and building.

        I don't have or do anything porn-related in there, and don't spend any significant amounts of money either. So far I'm getting more out of it than I spend.
      • it really was a cool online social experiment -- it only ultimately confirmed what we knew all along -- the internet is good only for porn and consumerism.

        If it is a cool online social experiment, then it is such regardless of what the evidence produced by that experiment is. A serious argument could be made that the division between sex and the rest of our lives has only arisen since the onset of Christianity, and that SL's focus on sex is part of a natural "repaganizing" of civilization.

        Well, it's a thou
        • Are you seriously saying that SL's focus on sex is something new on Internet? Even though "The Internet Is For Porn" is the most annoying and evil song to ever swim from the dank bowels of Avenue Q, it has a kernel of truth.
      • by notthepainter ( 759494 ) <`oblique' `at' `alum.mit.edu'> on Sunday February 25, 2007 @04:22PM (#18145860) Homepage

        it's funny, i just checked out 2nd life last night -- first time since a year or two ago -- and i was pretty amazed -- the place is one big car lot or sex club. really. i guess there are two kinds of people in 2nd life now -- the people selling "sex", and the people trying to sell their objects to buy the "sex".
        This is why I started my web site http://www.secondseeker.com/ [secondseeker.com]. The parent poster is mostly right and completely wrong.

        All that is easy to find is sex.

        There is a lot more out there, it is just hard to find. I've spent a lot of time sailboat racing in SL. I no longer have access to a boat and I really missed it. It it the same? Certainly not. Is it better, than nothing. You bet! When I raced sailboats I was on a big boat with others, now I'm at the helm. I couldn't afford to do that in the real world.

        I hate to sound like spam but if you think sex is all that there is to SecondLife, just check out my web site, you might find something to do there that interests you. (Note, the site is supported by AdSense ads, if that offends you, please don't visit, or at least don't click on the ads!)

        Paul aka Seeker Gray

      • You are doomed if you see your life as a materialistic roller-coaster. Then there is no essential difference between you and animal.

        If you do what you are created for with recognition of that fact, then you are filling the shoes of a Human.
      • this is a testament to the power of the sexual drive in humans

        I've often thought that the internet, in general, gives us something like a microscope into human sexuality.
    • Is that anything like fuzzy logic?
    • I thought that was already present in YIFF.
    • by vadim_t ( 324782 )
      LSL has no classes, and about the most furry thing about it is the ear attachment points. Tails go on the pelvis attachment point.

      Makes me wonder where do the mature bits go when you have a tail, as there can be only one object attached to every point, but that's not something I intend to figure out.
      • Makes me wonder where do the mature bits go when you have a tail, as there can be only one object attached to every point, but that's not something I intend to figure out.

        My first thought was that you could make tails and penises joined as single objects.
        My second that you could make pluggable objects with an open API to make it possible to switch tails and penises independently.
        My third thought - "Hey, this could be a business idea!"

        I've been on the Internet too long. The most frightening thought is tha
    • There isn't anything furry-specific in Second Life as an architecture.

      Sure, there's a lot of furries there, and a lot of furry content, but that's because.. hey, it's a virtual environment where you can be ANYTHING. Of course it's going to attract people who want to roleplay as a non-human.

      If you're curious about the whole furry thing, come to Luskwood on Second Life. Not all furries are sex-crazed anti-social dumbasses-- just a very vocal few.

      -Z
  • by IL-CSIXTY4 ( 801087 ) on Sunday February 25, 2007 @12:21PM (#18144000) Homepage
    There was talk about converting the server-side scripting engine to Mono, with huge (50x) performance gains. There was supposed to be a LSL->CIL compiler at first, then libraries for other .Net languages. Has anyone heard anything about this recently?
  • by Linker3000 ( 626634 ) on Sunday February 25, 2007 @12:28PM (#18144034) Journal
    "A compiler is a piece of software that takes the text version of the script and converts it into something that can actually run."

    Glad that's all cleared up!
  • The summary quote uses 108 words to explain that there exists a compiler for this language.
    • by jfengel ( 409917 ) on Sunday February 25, 2007 @12:50PM (#18144166) Homepage Journal
      The article isn't much better. It spends a lot of time going over what most Slashdotters already know, like what an "integer" is, and very little on what's novel about a scripting language for an interactive world (or whatever you want to call Second Life.)
      • Re: (Score:2, Insightful)

        by seaturnip ( 1068078 )
        Yeah, all I'm interested in hearing about is, why is it necessary to have a special-purpose language for Second Life in the first place? Is there a good reason or is it just Not-Invented-Here syndrome? Why not use Lua [wikipedia.org] (a simple, extensible language commonly used to script games) or something instead?
        • by Gorobei ( 127755 )
          Right. The scripting language seems like a typical home-made C clone: Lua, Python, etc, would do just as well with less cost to all involved.

          I was hoping to see a langauge that really captured the concepts of virtual worlds and actors. LSL ain't it.
          • Comment removed based on user account deletion
            • by Gorobei ( 127755 )
              I'm not too sure on the memory usage of other scripting languages. LSL was designed to be compiled in bytecode (like python) and then executed in virtual machines. The maximum amount of memory a script can use (including it's bytecode) on SL is 13kb. Are you sure the alternatives would be able todo the same LSL can do within the same memory constraints?

              Anything I can look at to compare with?


              Pretty sure. Most stack-based VMs (Smalltalk-80, Forth, Python, etc) are approximately equivalent (with a factor of 3
        • LUA is not used to script games but to script UIs of games.

          LUA is a pascal like imperative (procedural) language, while LSL is basically a state machine, aka special purpose programming language.

          In an interactive object world, object states and their interaction events are far easier to map to a special purpose programming language, than it is, e.g. to register a LUA function for each event you are interested in.

          And bottom line, except old fashioned /. ers, no one really wants to program in pure procedural
          • Actually, Lua(which isn't an acronym) is a dynamic enough language that you can use their "tables"(which are the same as dictionaries/maps/associative arrays/whatever else they're called) to make working object-orientation.
          • Comment removed based on user account deletion
            • Yeah sure,

              Sorry. Surely you can use and surely there are games I'm not aware about that indeed use LUA as scripting language. The question is, if that is the language wise best solution. Implementation/problem wise it might be. After all its a free (as in money) language with a wide availability of interpreters/programmers and libraries.

              Event handlers aren't hard to add in Lua in my opinion.
              Arg, thats not what I said! Programming event handlers in LUA is an outdated programming model. And thats not bound to
      • Comment removed based on user account deletion
      • Yeah, when I played SL back in '03, it was rather easy to learn LSL. If you know C++, you're basically set.

        First thing I did was make a listening bug to spy on people. Hope they've handled that problem since I left...
      • The article is quite oki imho, and yes it explains what your follow up is asking: Is there a good reason or is it just Not-Invented-Here syndrome?

        And furthermore I doubt that many /. ers know what the special thing about LSL is.

        In short: LSL is a state machine and event based program language.

        Events are what are methods in an OO language. In game objects have various standard states and standard events like "touch" and you can script the behavior for events and state changes.

        Actually its a quite nice lang
        • by jfengel ( 409917 )
          That's what I wanted the summary to say. And I wanted the article to say what kinds of events are unique to Second Life, how event processing in LSL is different from event processing in other languages, etc.

          Be careful what you wish for in wishing to add features to languages. Java, for example, already has an event model. It's not as succinct as in a language designed explicitly for it, but when you add to much to a language it makes it hard to read and hard to get started in. That didn't stop Perl, bu
    • by MrJozef ( 524740 )

      The summary quote uses 108 words to explain that there exists a compiler for this language.
      And then still calls it a scripting language :(
      • Scripting languages run scripts, no matter what the nature of those scripts may be. Many such languages do some degree of compiling internally, these days.

        The determiner of whether it is a scripting language is not its basis, but what it does, whether it orchestrates the behavior of other objects, things like files and programs, according to what looks like a "script."
    • by makomk ( 752139 ) on Sunday February 25, 2007 @06:19PM (#18146806) Journal
      The summary quote uses 108 words to explain that there exists a compiler for this language.

      The compiler sucks. For example, when you define a vector, it generates three "float literal" instructions rather than one "vector literal" instruction. This means that 2 instructions and 2 bytes more code than necessary are generated for each vector literal in the code (similarly with quaternons/rotations). (Remember, there's a 16Kb per script limit for code+data.) As a second example, there are two types of instruction for transferring data from the stack to local/global variables - store and pop (which is equivalent to a store, followed by a drop). For one, the compiler only ever seems to use the "pop" variant, whilst for the other it always uses a "store; pop" pair (despite this being inefficient) - I've never seen a lone "store".

      Also, the goto is broken - due to a compiler bug/design error, only the last jump to a particualr label actually does anything. (The code for matching gotos to labels can only track one goto for each label.) This is a long-standing and well-known bug which I doubt would be difficult to fix, yet no-one's bothered.

      There are also other useful instructions which are never used (such as various dups, an instruction for setting the instruction pointer directly - making jump tables/efficient switch statements possible - and an instruction for freeing arbitrary amounts of stack quickly). The compiler never optimises anything, either. It's why I don't hold out much hope for speed improvements from Mono (and indeed, the predicted improvements mostly vanished when they started running actual LSL scripts with it.)
      • by Nurgled ( 63197 )

        At least this is one problem that can be addressed by hacking the open-source viewer; the compilation's done client-side, so you wouldn't need any LL co-operation to use and distribute an improved compiler.

  • In the future, it is likely that the compiler will move from the viewer into the Second Life simulators, but where the code is compiled isn't very important.

    Well, if it is running on the simulators, the simulated humans might be given access to it, and thus being able to script their own lifes!
    Well, maybe I should try if those scripts already work on our world! :-)
  • by mrcdeckard ( 810717 ) on Sunday February 25, 2007 @12:56PM (#18144190) Homepage

    hello class, this is a COM-PU-TER. computers run a set of instructions called a PROOOGRAAAM. programs are nothing but 1's and 0's. heheheh, but we don't program in 1's and 0's, we program in a language, such as linden script. another computer program, called a com-pi-ler, compiles the script into a format the computer can understand. ok, class, this is a DISK DRIVE . . .

    sheesh, i thought this was /.

    (actually, it must be -- even *I* am complaining about the summaries...)

    mr c
  • And why is he allowed to publish his journal if he doesn't know when to use "it's" vs. "its"?
    • by elrous0 ( 869638 ) *
      Probably for the same reason that you're allowed to post here without realizing that a quotation mark at the end of a sentence should contain the sentence punctuation.

      -Eric

  • by Cereal Box ( 4286 ) on Sunday February 25, 2007 @02:20PM (#18144890)
    I was expecting a tutorial on how to program an army of flying penises to interrupt a virtual press conference...
    • While it's been a few months since I last used SL, the scripting language leaves much to be desired.

      It is EASY for someone to write a script that bogs down the server. Also scripts can be automated and self replicating. There was a problem a while back (Not sure if it's still an issue) about someone writing scripts that fly around really high (higher than a normal user can go without scripting super powers into a worn object) scanning land blocks for land for sale. It then alerted the owner of the script if
  • by FishWithAHammer ( 957772 ) on Sunday February 25, 2007 @02:40PM (#18145048)
    ...or have done, really. The language is a bastard child of C, basically. Its major problem is its lack of arrays; you have a strange construct called a list that sort of does the same thing, but I really don't know why it's there instead of arrays. LSL is fairly underpowered. What I've taken to doing is using its HTTP system, though, to ping my web server, do something, and feed it back into the game. To do anything really impressive with LSL, it does seem to take an outside server to do the heavy lifting. It's kind of fun, though...
  • Each simulator runs everything for 16 acres of virtual land -- buildings, physics, and of course, scripts.

    I've never done 2nd life. What happens if you stand at the border and throw a rock into the next region?

    OK, I guess there's probably some handoff mechanism. But I have to say that I find the "physics" of 2nd life disappointing. In the real world, there's an enormous cost in time and energy in moving stuff from place to place. That's an important part of our economy. In 2nd life, they've gone to a lot

  • I turn my back for a couple of years and they're publishing articles where the authors find it necessary to explain what types like integers and floats are?
  • The LSL Wiki http://www.lslwiki.com/ [lslwiki.com] went down permanently in mid-January when a new, more stable wiki was started as a part of the official Linden Lab Wiki http://wiki.secondlife.com/ [secondlife.com].

    In its defense, it did say it was a "primer", targeted at beginners. Chances are, it was lifted from the SL book itself.

    LSL has a lot of limitations, some of which can be gotten around. However, the biggest issue is that LL is constantly breaking crap in their futile effort to scale their unscalable grid design to support the
  • Really, there is no 's' in the name of the company that created Second Life.

    It is Linden Lab not Linden Labs.

    Pau aka Seeker Gray

  • And to do all of the world scripting, no less? No wonder that place is full of perverts!

    Rob

How many hardware guys does it take to change a light bulb? "Well the diagnostics say it's fine buddy, so it's a software problem."

Working...