SL Cert - Basic Scripting
- 1 Overview
- 2 Audience
- 3 Prerequisites
- 4 Criteria for testing to basic level
- 4.1 Broad Overview and Most Basic Skills
- 4.2 Data Types
- 4.3 Control Structures
- 4.4 Events and Functions
- 4.5 Rotations and Vectors
- 4.6 Basic I/0
This list of requirements is part of the Second Life Certification project. It is an effort to create a list of specific skills required for persons to become certified in basic scripting.
Persons who wish to demonstrate competence in basic LSL scripting.
Some experience and familiarity of the second life graphical user interface and controls is necessary. Also some experience of building within second life would be an advantage. Six months secondlife experience recommended.
Criteria for testing to basic level
In the basic skill sets a person should demonstrate a mastery of common programming tasks. The following categories provide the basic categories.
Broad Overview and Most Basic Skills
- Rationale for scripting
- Script creation
- Commenting and Clarity
- Mono vs. LSL2
- Software Development
A person should provide a basic understanding of the potential and the limitations of scripts. The person should be able to demonstrate how to create a script both within an object rezzed in world or in their inventory. The person should know the difference between mono and LSL2 and the implications when a script is created within inventory as opposed to an object's inventory. A person should demonstrate a basic understanding of the construction of consistent, structured code and consistent commenting style.
The person should demonstrate an understanding of the difference between server side lag, client side lag, and the script delays associated with different LSL library calls. The person does not need to memorize which function calls have a delay and how much the delay is, but they need to understand what a delay is and how to determine if a given function has a delay and how long the delay is.
Finally, the person should provide a very basic understanding of practices for good software development. This includes the use and maintenance of comments and the rationale for the use of functions and subroutines. Additionally, the person should provide a rudimentary understanding of code revisioning and practices to keep and maintain local back up files.
- Global vs. Local Variables
A person should be able to identify the basic data types, integer, float, string, key, list, vector and rotation. The person should know the basic operations and what they mean in context. For example, division with integers is different compared to division with floats. The person should understand that some operations are overloaded and have different meanings when combined with different types. For example, if v1 and v2 are vectors then v1*v2 is the dot product, but if v1 is a vector and r is a rotation then v1*r will rotate the vector.
The person should demonstrate the concept of the "scope" of a variable. There is a difference if it is defined outside of an event or function. Also, the person should demonstrate an understanding that a global variable can be ignored if it is also defined locally.
Finally, the person should demonstrate how to "convert" one variable into another and what happens. For example, a float is trunctated when cast as an integer.
- Loop Constructs
A person should demonstrate an understanding of the different looping constructs using for, while, and do-whole loops and understand when one loop construct might be favored over another in a given context. The person should also demonstrate an understanding of the "if" statement and be able to use compound and nested if statements.
The person should be able to demonstrate the ability to construct complex boolean expressions. For example, they should be able to make use of multiple boolean statements using the boolean "or," boolean "not," and boolean "and" to filter nontrivial conditions in a control structure or conditional. The person should demonstrate an understanding of the difference between integer operations such as "xor," "and," "or," and the shift operations as opposed to the similar boolean operations.
Events and Functions
A person should demonstrate the basic idea of an event and how a script might react in various circumstances. For example, the person should have a basic understanding of the three touch events and how they differ. At the basic level the broad categories of events that should be mastered include collision, touch, land collision, state entry/exit, timer, and attach events.
The person should demonstrate an understanding of the use and creation of their own functions. This includes understanding the difference between null functions and functions that return a specific data type. The person should know the difference between a user defined function and the set of functions available within the build in library.
Finally, the person should demonstrate an understanding of the use of states. They should understand the default state, how to define new states, and move between different states. The person should have a firm understanding of the control flow as a script moves between different states.
Rotations and Vectors
In the basic skill sets a person should be able to demonstrate that they understand the basic definitions. The person should also be able to demonstrate that they understand the basic idea. For example, a person should know how to calculate a dot product but also understand its relationship to the idea of a projection of one vector on to another.
Basic definition of position
- Globale position
- Absolute position (within a sim)
- Local position
A person should know what position is in the context of SL. This means the person should know the difference between a global coordinate, an absolute position within a sim, and the local position within a linkset. An understanding of the different contexts when you might use local versus absolute is vital to working with rotations and vectors. For example, when working within a linkset a local coordinate system is used. At the same time it is not uncommon to make use of local offsets when dealing with two separate objects.
Basic definition of a rotation
- Axis and angle
A person should demonstrate that they know the definitions of a rotation. The person should know the difference between an Euler rotation and a quarternion. A person need not know the specific implementation of a quarternion but should understand a roation in terms of an axis of rotation and an angle around that axis.
Changing position and rotation via the edit window
A person should be proficient using the edit window to manually move and rotate an object. The person should be able to move and rotate an object to a specific orientation (position and rotation). Also, the person should be able to read the position and rotation for a given object using the edit window.
Vectors and Operations
- Definition of vector in LSL
- Working with vector components (x, y, and z)
- Linear combinations of vectors
- Dot product
- Cross product
- Unit vectors
A person should know the basic mathematical vector operations. The person should know how the calculations are performed and the LSL overloaded operators. For example, given two vectors u and v, the person should know how to calculate the dot product and also know that in LSL u*v will give you the dot product. The person should know how to multiply a scalar and a vector in LSL as well as find linear combinations of vectors in LSL.
A person should know the basic ways to communicate information in LSL. The person should know the limitations and advantages of each command. The person should now the predefined channels for open chat and debug messages and also know the range of possible channels. The person should know the differences between using a positive number and negative number for the channel number and the relative advantages.
At the basic level a person should know how to open a channel for listening and construct a listening event. The person should understand the importance of being able to close a listening event. For example, the person should know how to use a timer to insure that an open listener will be closed within a given time frame.
At the basic level a person should also have a rudimentary understanding of the string functions. The person should be able to make direct comparisons and also be able to manipulate substrings. Additionally a person should be able to trim spaces off of the beginning and end of a string as well as convert the case to all upper or all lower.