LSL 101/Strings and Simple Output

From Second Life Wiki
< LSL 101
Revision as of 15:07, 15 May 2009 by Omei Turnbull (talk | contribs) (New page: Category:LSL 101 {{NavNextPrev|prev=Comments, White-space and Formatting|next=Simplest Output}} Here's our sample program, with a line added so that the script actually does something...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
← Comments, White-space and Formatting ↑̲  LSL 101  ̲↑ Simplest Output →

Here's our sample program, with a line added so that the script actually does something.

<lsl> default {

    state_entry()
    {
         // Let the object's owner know the script is working
         llOwnerSay( "Congratulations! Your script has started to execute." );
    }

} </lsl>

The line that starts with llOwnerSay is a statement that instructs the object containing the script to chat a text message that will only be seen by the object's owner. Since you will usually be scripting objects you own, this will generally be you. This is a convenient way to get information about what your script is doing, without spamming text chat to everyone around you. But if you have an occasion (and permission) to script someone else's object, you would want to use one of the other communication statements, which we'll discuss in due time.

Let's start by looking at the punctuation in this line. Every statement in LSL must end with a semicolon. This is probably the easiest punctuation mark to overlook, but if it isn't there, your script isn't acceptable. Furthermore, the error message you get will probably puzzle you, because it will tell you the error is on the line following the missing semicolon, and it won't tell you that it is a semicolon that is missing. So work especially hard at remembering your semicolons.

The next set of punctuation marks to observe is the pair of double quote marks surrounding the text "Congratulations! Your script has started to execute.".