SlideShare a Scribd company logo
1 of 22
THE DEFAULT SCRIPT
F/XUAL EDUCATION SERVICES
Investigating States, Events & Functions
Rez a prim and with it selected
display the Content tab.
Click on the New Script button to
create a new script.
Right click on the New Script icon
and select Rename from the menu.
Rename the script appropriately.
Right click on the script icon and
select Open from the menu OR
double click on the icon to open the
script.
The default script is displayed when the new script is opened.
Note that when the script was created the text Hello, Avatar! was displayed in main chat. Lines 2 to 5
show the EVENT that was triggered when the script was created (loaded into the prim). Line 4 is the
FUNCTION that generated the chat.
Scripts are comprised of STATES, the main state being the default state. This state is entered when a script
is compiled (saved), reset or loaded. More than one state may be defined, though one is the norm.
A script will react to EVENTS in the current state which are triggered by some occurrence or input, which
in turn run the FUNCTIONS defined in that event. Functions can be either the built-in functions of LSL or
user-defined functions. Curly brackets, i.e. { }, enclose the contents of a STATE or EVENT.
EVENTS may have built in parameters though the state_entry EVENT has none. This event is triggered when the
script is saved, when a STATE has been changed, when the script is reset or when the script is loaded into a prim.
The touch_start EVENT has one parameter, which is of the data type INTEGER (whole number). This event is
triggered when the prim is touched (clicked on by the down press of the left mouse button). The parameter
indicates the total number of avatars touching the prim during the last computing clock cycle.
Most FUNCTIONS also have built in parameters. The llSay FUNCTION has two, the first being the data type
INTEGER and the second the data type STRING. A string is text data and is contained between double quotes. Any
character can be used in a string.
All data types in LSL are immutable and built in parameters must be included in the EVENTS or FUNCTIONS.
The data types in LSL are; FLOAT, INTEGER, KEY, LIST, ROTATION, STRING and VECTOR.
To change the text generated by the llSay FUNCTION select the text between the double quotes in Line 4.
This parameter is the data type STRING and will be the text that is said when this function runs.
In the above example the text has been changed to Good morning Isa! To save the changes click on the
Save button (which is now highlighted due to some portion of the script being changed) OR press Ctrl S.
The script will be saved (compiled). This will trigger the state_entry EVENT which will run all the parts of
the script between the curly brackets { } from line 3 to 5. In this case it is the llSay FUNCTION that runs and
displays the text Good morning Isa! in main chat.
Every time a script is saved the state_entry EVENT is triggered. This will cause the llSay FUNCTION on line
4 to run. To prevent this happening it is possible to COMMENT out the function by placing two forward
slashes at the beginning of the line. This leaves the line visible in the script but does not compile this part
of the script when it is saved. Click on the Save button and you will see this function no longer runs.
Comments are a useful way of adding notes to remind you of the function of certain sections of code.
Help pop-ups can be accessed for all aspects of a script. For example holding the cursor over the
touch_start EVENT shows the pop-up above indicating that this event has one parameter, an INTEGER,
and that the event is triggered by the start (pressing the left mouse down) of agent (avatar) clicking on
task (the prim).
FUNCTIONS also have help pop-ups. In this example the llSay FUNCTION is shown to have two
parameters, an INTEGER and a STRING. When run the llSay FUNCTION will say the text of the STRING on
the chat channel indicated by the INTEGER. In this case the text Touched. will be said on channel 0, this
being the main public chat channel. A touch_start EVENT can only be tested with the prim deselected. A
script can be left open, altered and saved even when the prim is deselected. Test the touch_start EVENT.
LSL scripting syntax is very strict.
STATES and EVENTS must be enclosed in curly brackets { } and
lines of code within an EVENT must end with a semi-colon ;
All built in parameters must be included in EVENTS and
FUNCTIONS and must be enclosed in parentheses ( ), each of the
parameters must be delimited by a comma , and be in the correct
order and data types must be correct.
Code is also case sensitive so the correct case must be adhered
to, e.g. llSay not LLsay and touch_start not Touch_Start
If these rules are not met an error will occur when the script is
compiled (saved). The compiler will pause the cursor in the
vicinity of the error, usually the line after it occurs, so this is a
good indication of where the error is.
Linden Scripting Language SYNTAX
Continue with the script by adding a new FUNCTION into the touch_start EVENT.
Place the cursor at the end of line 9.
Press the Enter key to create a new line.
All EVENTS and FUNCTIONS can be accessed through the Insert button (though the newest additions to
LSL may take a little while becoming available in this menu). In this example the FUNCTION llOwnerSay
will be inserted. Click on the Insert button and scroll down the list till you see this function. Click on it to
insert it in the script.
As seen on line 10 the llOwnerSay FUNCTION has been inserted. Hold the cursor over the function to
display the help pop-up. This function has one parameter, a STRING. This string’s text will be said only to
the owner of the prim the script is in and the owner must be in the same sim as the prim to hear it.
The text will appear in the main chat window but will only be seen by the prim owner.
Complete the FUNCTION by adding parentheses ( ) and writing the STRING of text you wish to be seen
inside them. Ensure the text has double quotes around it, e.g. “Isa touched me”. Also ensure that the line
has been concluded with a semi-colon ; The line should look like: llOwnerSay(“Isa touched me”);
Comment out line 9 so that only the llOwnerSay function runs when the touch_start EVENT is triggered.
Click on the Save button to compile the script. Test the script by touching the prim.
It is also possible to add a FUNCTION within another FUNCTION. Currently the llOwnerSay FUNCTION in
the touch_start EVENT only says the text Isa touched me but doesn’t indicate who really touched the
prim. Anyone touching the prim will trigger this text to display. That can be changed.
Place the cursor after the first parenthesis in line 10 as shown above.
From the Insert button (which will currently display the name of the last item inserted, i.e. llOwnerSay)
find and insert the FUNCTION llDetectedName.
The FUNCTION llDetectedName has one parameter, an INTEGER, which accesses the list of avatars who
touched the prim. (This list is created by the touch_start EVENT.) Complete the script as shown in line 10.
The parameter 0 used in the llDetectedName FUNCTION accesses the first name in the list. It is extremely
unlikely that more than one avatar will touch a prim in one clock cycle so the first name suffices. Now save
the script and test the result. The text in chat will now say SomeAvatarName touched me
LSL Portal http://wiki.secondlife.com/wiki/LSL_Portal
States http://wiki.secondlife.com/wiki/State
Events http://wiki.secondlife.com/wiki/Category:LSL_Events
Functions http://wiki.secondlife.com/wiki/Category:LSL_Functions
Types http://wiki.secondlife.com/wiki/Category:LSL_Types
Comments
http://wiki.secondlife.com/wiki/LSL_101/Comments,_White-
space_and_Formatting
state_entry http://wiki.secondlife.com/wiki/State_entry
touch_start http://wiki.secondlife.com/wiki/Touch_start
llSay http://wiki.secondlife.com/wiki/LlSay
llOwnerSay http://wiki.secondlife.com/wiki/LlOwnerSay
llDetectedName http://wiki.secondlife.com/wiki/LlDetectedName
Resources

More Related Content

Viewers also liked

Catálogo automotor versión 2016
Catálogo automotor versión 2016Catálogo automotor versión 2016
Catálogo automotor versión 2016Dissan10
 
Concept of strategy in ir
Concept of strategy in irConcept of strategy in ir
Concept of strategy in irjayanjali
 
woodward fieser rule
 woodward fieser rule woodward fieser rule
woodward fieser ruleKavitha Bitra
 
Ir meaning, nature and importance
Ir  meaning, nature and importanceIr  meaning, nature and importance
Ir meaning, nature and importanceAsad Ali
 
Delegated legislation
Delegated legislationDelegated legislation
Delegated legislationReshma Suresh
 
States Of Matter Power Point
States Of Matter Power PointStates Of Matter Power Point
States Of Matter Power Pointwolffer87
 
Planificador de proyecto claudia
Planificador de proyecto claudiaPlanificador de proyecto claudia
Planificador de proyecto claudiaclaudiagudelo0917
 

Viewers also liked (10)

김형섭
김형섭김형섭
김형섭
 
Catálogo automotor versión 2016
Catálogo automotor versión 2016Catálogo automotor versión 2016
Catálogo automotor versión 2016
 
Concept of strategy in ir
Concept of strategy in irConcept of strategy in ir
Concept of strategy in ir
 
woodward fieser rule
 woodward fieser rule woodward fieser rule
woodward fieser rule
 
Elements of State
Elements of StateElements of State
Elements of State
 
Ir meaning, nature and importance
Ir  meaning, nature and importanceIr  meaning, nature and importance
Ir meaning, nature and importance
 
Delegated legislation
Delegated legislationDelegated legislation
Delegated legislation
 
State and its elements
State and its elementsState and its elements
State and its elements
 
States Of Matter Power Point
States Of Matter Power PointStates Of Matter Power Point
States Of Matter Power Point
 
Planificador de proyecto claudia
Planificador de proyecto claudiaPlanificador de proyecto claudia
Planificador de proyecto claudia
 

Similar to The Default Script

Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculatorVlad Kolesnyk
 
Getting started with the visual basic editor
Getting started with the visual basic editorGetting started with the visual basic editor
Getting started with the visual basic editorputiadetiara
 
Getting started with Microsoft Excel Macros
Getting started with Microsoft Excel MacrosGetting started with Microsoft Excel Macros
Getting started with Microsoft Excel MacrosNick Weisenberger
 
Engineering CS 5th Sem Python Module-1.pptx
Engineering CS 5th Sem Python Module-1.pptxEngineering CS 5th Sem Python Module-1.pptx
Engineering CS 5th Sem Python Module-1.pptxhardii0991
 
Gui programming a review - mixed content
Gui programming   a review - mixed contentGui programming   a review - mixed content
Gui programming a review - mixed contentYogesh Kumar
 
App Inventor : Getting Started Guide
App Inventor : Getting Started GuideApp Inventor : Getting Started Guide
App Inventor : Getting Started GuideVasilis Drimtzias
 
lec3forma.pptx
lec3forma.pptxlec3forma.pptx
lec3forma.pptxFaiz Zeya
 
Introduction to keyboard
Introduction to keyboardIntroduction to keyboard
Introduction to keyboardSanjuktaSahoo5
 
Intro to ios - init by SLOHacks
Intro to ios - init by SLOHacksIntro to ios - init by SLOHacks
Intro to ios - init by SLOHacksRandy Scovil
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2ppJ. C.
 

Similar to The Default Script (20)

Working With Text
Working With TextWorking With Text
Working With Text
 
2010 02 Working With Text
2010 02 Working With Text2010 02 Working With Text
2010 02 Working With Text
 
Tugas testing
Tugas testingTugas testing
Tugas testing
 
Android tutorials7 calculator
Android tutorials7 calculatorAndroid tutorials7 calculator
Android tutorials7 calculator
 
Lecture6 oopj
Lecture6 oopjLecture6 oopj
Lecture6 oopj
 
Getting started with the visual basic editor
Getting started with the visual basic editorGetting started with the visual basic editor
Getting started with the visual basic editor
 
Getting started with Microsoft Excel Macros
Getting started with Microsoft Excel MacrosGetting started with Microsoft Excel Macros
Getting started with Microsoft Excel Macros
 
Engineering CS 5th Sem Python Module-1.pptx
Engineering CS 5th Sem Python Module-1.pptxEngineering CS 5th Sem Python Module-1.pptx
Engineering CS 5th Sem Python Module-1.pptx
 
Maxbox starter
Maxbox starterMaxbox starter
Maxbox starter
 
Notes netbeans
Notes netbeansNotes netbeans
Notes netbeans
 
Gui programming a review - mixed content
Gui programming   a review - mixed contentGui programming   a review - mixed content
Gui programming a review - mixed content
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
App Inventor : Getting Started Guide
App Inventor : Getting Started GuideApp Inventor : Getting Started Guide
App Inventor : Getting Started Guide
 
lec3forma.pptx
lec3forma.pptxlec3forma.pptx
lec3forma.pptx
 
Tm 1st quarter - 2nd meeting
Tm   1st quarter - 2nd meetingTm   1st quarter - 2nd meeting
Tm 1st quarter - 2nd meeting
 
Introduction to keyboard
Introduction to keyboardIntroduction to keyboard
Introduction to keyboard
 
GUI programming
GUI programmingGUI programming
GUI programming
 
Intro to ios - init by SLOHacks
Intro to ios - init by SLOHacksIntro to ios - init by SLOHacks
Intro to ios - init by SLOHacks
 
Ingles 2do parcial
Ingles   2do parcialIngles   2do parcial
Ingles 2do parcial
 
Chapter2pp
Chapter2ppChapter2pp
Chapter2pp
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

The Default Script

  • 1. THE DEFAULT SCRIPT F/XUAL EDUCATION SERVICES Investigating States, Events & Functions
  • 2. Rez a prim and with it selected display the Content tab. Click on the New Script button to create a new script.
  • 3. Right click on the New Script icon and select Rename from the menu. Rename the script appropriately. Right click on the script icon and select Open from the menu OR double click on the icon to open the script.
  • 4. The default script is displayed when the new script is opened. Note that when the script was created the text Hello, Avatar! was displayed in main chat. Lines 2 to 5 show the EVENT that was triggered when the script was created (loaded into the prim). Line 4 is the FUNCTION that generated the chat.
  • 5. Scripts are comprised of STATES, the main state being the default state. This state is entered when a script is compiled (saved), reset or loaded. More than one state may be defined, though one is the norm. A script will react to EVENTS in the current state which are triggered by some occurrence or input, which in turn run the FUNCTIONS defined in that event. Functions can be either the built-in functions of LSL or user-defined functions. Curly brackets, i.e. { }, enclose the contents of a STATE or EVENT.
  • 6. EVENTS may have built in parameters though the state_entry EVENT has none. This event is triggered when the script is saved, when a STATE has been changed, when the script is reset or when the script is loaded into a prim. The touch_start EVENT has one parameter, which is of the data type INTEGER (whole number). This event is triggered when the prim is touched (clicked on by the down press of the left mouse button). The parameter indicates the total number of avatars touching the prim during the last computing clock cycle.
  • 7. Most FUNCTIONS also have built in parameters. The llSay FUNCTION has two, the first being the data type INTEGER and the second the data type STRING. A string is text data and is contained between double quotes. Any character can be used in a string. All data types in LSL are immutable and built in parameters must be included in the EVENTS or FUNCTIONS. The data types in LSL are; FLOAT, INTEGER, KEY, LIST, ROTATION, STRING and VECTOR.
  • 8. To change the text generated by the llSay FUNCTION select the text between the double quotes in Line 4. This parameter is the data type STRING and will be the text that is said when this function runs.
  • 9. In the above example the text has been changed to Good morning Isa! To save the changes click on the Save button (which is now highlighted due to some portion of the script being changed) OR press Ctrl S. The script will be saved (compiled). This will trigger the state_entry EVENT which will run all the parts of the script between the curly brackets { } from line 3 to 5. In this case it is the llSay FUNCTION that runs and displays the text Good morning Isa! in main chat.
  • 10. Every time a script is saved the state_entry EVENT is triggered. This will cause the llSay FUNCTION on line 4 to run. To prevent this happening it is possible to COMMENT out the function by placing two forward slashes at the beginning of the line. This leaves the line visible in the script but does not compile this part of the script when it is saved. Click on the Save button and you will see this function no longer runs. Comments are a useful way of adding notes to remind you of the function of certain sections of code.
  • 11. Help pop-ups can be accessed for all aspects of a script. For example holding the cursor over the touch_start EVENT shows the pop-up above indicating that this event has one parameter, an INTEGER, and that the event is triggered by the start (pressing the left mouse down) of agent (avatar) clicking on task (the prim).
  • 12. FUNCTIONS also have help pop-ups. In this example the llSay FUNCTION is shown to have two parameters, an INTEGER and a STRING. When run the llSay FUNCTION will say the text of the STRING on the chat channel indicated by the INTEGER. In this case the text Touched. will be said on channel 0, this being the main public chat channel. A touch_start EVENT can only be tested with the prim deselected. A script can be left open, altered and saved even when the prim is deselected. Test the touch_start EVENT.
  • 13. LSL scripting syntax is very strict. STATES and EVENTS must be enclosed in curly brackets { } and lines of code within an EVENT must end with a semi-colon ; All built in parameters must be included in EVENTS and FUNCTIONS and must be enclosed in parentheses ( ), each of the parameters must be delimited by a comma , and be in the correct order and data types must be correct. Code is also case sensitive so the correct case must be adhered to, e.g. llSay not LLsay and touch_start not Touch_Start If these rules are not met an error will occur when the script is compiled (saved). The compiler will pause the cursor in the vicinity of the error, usually the line after it occurs, so this is a good indication of where the error is. Linden Scripting Language SYNTAX
  • 14. Continue with the script by adding a new FUNCTION into the touch_start EVENT. Place the cursor at the end of line 9.
  • 15. Press the Enter key to create a new line.
  • 16. All EVENTS and FUNCTIONS can be accessed through the Insert button (though the newest additions to LSL may take a little while becoming available in this menu). In this example the FUNCTION llOwnerSay will be inserted. Click on the Insert button and scroll down the list till you see this function. Click on it to insert it in the script.
  • 17. As seen on line 10 the llOwnerSay FUNCTION has been inserted. Hold the cursor over the function to display the help pop-up. This function has one parameter, a STRING. This string’s text will be said only to the owner of the prim the script is in and the owner must be in the same sim as the prim to hear it. The text will appear in the main chat window but will only be seen by the prim owner.
  • 18. Complete the FUNCTION by adding parentheses ( ) and writing the STRING of text you wish to be seen inside them. Ensure the text has double quotes around it, e.g. “Isa touched me”. Also ensure that the line has been concluded with a semi-colon ; The line should look like: llOwnerSay(“Isa touched me”); Comment out line 9 so that only the llOwnerSay function runs when the touch_start EVENT is triggered. Click on the Save button to compile the script. Test the script by touching the prim.
  • 19. It is also possible to add a FUNCTION within another FUNCTION. Currently the llOwnerSay FUNCTION in the touch_start EVENT only says the text Isa touched me but doesn’t indicate who really touched the prim. Anyone touching the prim will trigger this text to display. That can be changed. Place the cursor after the first parenthesis in line 10 as shown above.
  • 20. From the Insert button (which will currently display the name of the last item inserted, i.e. llOwnerSay) find and insert the FUNCTION llDetectedName.
  • 21. The FUNCTION llDetectedName has one parameter, an INTEGER, which accesses the list of avatars who touched the prim. (This list is created by the touch_start EVENT.) Complete the script as shown in line 10. The parameter 0 used in the llDetectedName FUNCTION accesses the first name in the list. It is extremely unlikely that more than one avatar will touch a prim in one clock cycle so the first name suffices. Now save the script and test the result. The text in chat will now say SomeAvatarName touched me
  • 22. LSL Portal http://wiki.secondlife.com/wiki/LSL_Portal States http://wiki.secondlife.com/wiki/State Events http://wiki.secondlife.com/wiki/Category:LSL_Events Functions http://wiki.secondlife.com/wiki/Category:LSL_Functions Types http://wiki.secondlife.com/wiki/Category:LSL_Types Comments http://wiki.secondlife.com/wiki/LSL_101/Comments,_White- space_and_Formatting state_entry http://wiki.secondlife.com/wiki/State_entry touch_start http://wiki.secondlife.com/wiki/Touch_start llSay http://wiki.secondlife.com/wiki/LlSay llOwnerSay http://wiki.secondlife.com/wiki/LlOwnerSay llDetectedName http://wiki.secondlife.com/wiki/LlDetectedName Resources