Difference between revisions of "LSL 101/A Gentle Introduction"

From Second Life Wiki
Jump to navigation Jump to search
m (→‎A Gentle Introduction to Scripting in Second Life: reduced choices at end of page to reduce student confusion, removed three (i.e.) in the same paragraph, edits)
m (more edit taking out extra words / added bolds to divide the page)
Line 7: Line 7:
If all of this sounds like you, welcome!
If all of this sounds like you, welcome!


Scripts are used to make SL objects ''do'' something.  They can detect things that happen like noticing mouse clicks or the approach of an avatar; and, that script can then act in response by moving, changing appearance, greeting an avatar with a message, or displaying a current stock quote, among many other actions like talking, moving or changing color.   
'''Scripts are used to make SL objects ''do'' something.''' They can detect things that happen like noticing mouse clicks or the approach of an avatar; and, that script can then act in response by moving, changing appearance, greeting an avatar with a message, or displaying a current stock quote, among many other actions like talking, moving or changing color.   


In SL, scripts are written in LSL (Linden Scripting Language), a simple but powerful programming language that was created for the SL environment.  (Here, "simple" is used to suggest that LSL is ''more limited'' than other programming languages; not that it is easier to learn.  Like any other language, learning LSL requires patience and practice.)
'''SL scripts are written in Linden Scripting Language [LSL],''' a simple but powerful programming language that was created for the SL environment.  When programmers say "simple" they mean to suggest that LSL is ''more limited'' than other programming languages; not that it is easier to learn.  Like any other language, mastering LSL requires patience and practice.


Spoken languages have not only words (vocabulary) but also an order of use (grammer). Written languages add to that punctuation - commas, full stops (aka periods), brackets, parenthesis and so on - which help to clarify how different words and phrases relate to each other. All combined, vocabulary, grammer and punctuation result in the rules of language called ''syntax''.
Spoken languages have words which make up vocabulary and a particular order of use, called grammar. Written languages add to that punctuation - commas, full stops (a/k/a periods), brackets, parentheses and so on - which help to clarify how different words and phrases relate to each other. All combined, vocabulary, grammar and punctuation result in the rules of language called ''syntax''.


The difference between computer languages and human languages is that with human languages people can generally understand your meaning even if your pronunciation or spelling is not completely correct or your grammar is slightly wrong. Computer languages are not like that. If your spelling, punctuation or structure is even slightly wrong the computer will report an error (for example "syntax error"), do something completely unexpected or fail to do anything with no explanation.  This can be ''very'' frustrating for beginners.
The difference between computer languages and human languages is that with human languages people can generally understand your meaning even if your pronunciation or spelling is not completely correct or your grammar is slightly wrong. Computer languages are not like that. If your spelling, punctuation or structure is even slightly wrong the computer will report an error (for example "syntax error"), do something completely unexpected or fail to do anything with no explanation.  This can be ''very'' frustrating for beginners.
Line 17: Line 17:
In LSL the syntax (also called "structure") is very important. It will be discussed shortly along with an introduction to the vocabulary, grammar and punctuation of LSL shortly.
In LSL the syntax (also called "structure") is very important. It will be discussed shortly along with an introduction to the vocabulary, grammar and punctuation of LSL shortly.


Please click [[LSL 101/In the Beginning|here to continue the tutorial]].
'''Please click [[LSL 101/In the Beginning|here to continue the tutorial]].'''

Revision as of 22:01, 5 July 2012

A Gentle Introduction to Scripting in Second Life

This section of LSL 101: The Wikibook is written for the SL user who has no experience with computer programming; or, for users with programming experience who would like a gentle introduction to LSL.

This section assumes you have basic building skills, since scripting is just one aspect of building. You should be able to create and edit a prim, then take it in and out of inventory. You should be able to do the same with a notecard and know how to add it to a prim's inventory.

If all of this sounds like you, welcome!

Scripts are used to make SL objects do something. They can detect things that happen like noticing mouse clicks or the approach of an avatar; and, that script can then act in response by moving, changing appearance, greeting an avatar with a message, or displaying a current stock quote, among many other actions like talking, moving or changing color.

SL scripts are written in Linden Scripting Language [LSL], a simple but powerful programming language that was created for the SL environment. When programmers say "simple" they mean to suggest that LSL is more limited than other programming languages; not that it is easier to learn. Like any other language, mastering LSL requires patience and practice.

Spoken languages have words which make up vocabulary and a particular order of use, called grammar. Written languages add to that punctuation - commas, full stops (a/k/a periods), brackets, parentheses and so on - which help to clarify how different words and phrases relate to each other. All combined, vocabulary, grammar and punctuation result in the rules of language called syntax.

The difference between computer languages and human languages is that with human languages people can generally understand your meaning even if your pronunciation or spelling is not completely correct or your grammar is slightly wrong. Computer languages are not like that. If your spelling, punctuation or structure is even slightly wrong the computer will report an error (for example "syntax error"), do something completely unexpected or fail to do anything with no explanation. This can be very frustrating for beginners.

In LSL the syntax (also called "structure") is very important. It will be discussed shortly along with an introduction to the vocabulary, grammar and punctuation of LSL shortly.

Please click here to continue the tutorial.