Difference between revisions of "SL Cert - Basic Scripting"

From Second Life Wiki
Jump to navigation Jump to search
m (Remove legalese)
 
(35 intermediate revisions by 10 users not shown)
Line 1: Line 1:
== Intro to Scripting ==
{{SLCert Navbox}}
These are basic skills needed to understand programming using LSL, but without going into specifics of specific functions.
[[Category:Certification]]


'''Global and Local Variables''' Recognise the difference between the two and why using a naming system can be helpful to avoid confusion as script complexity grows.
==Overview==


'''States''' Understand what a state is and be able to explain why the default state is compulsory. Recognise that a script program essentially has no ending.
This list of requirements is part of the [[SL Certification | Second Life Certification]] project. It is an effort to create a list of specific skills  required for persons to become certified in basic scripting.


'''Events''' Understand what events are and how they can be used to capture input. Demonstrate this by scripting an object that says "I was clicked by (avatars name)" in public chat when touched.
==Audience==


'''Operators''' Understand how these can be used to manipulate variables and demonstrate this by creating an object that displays the number of times it has been touched in public chat.
Persons who wish to demonstrate competence in basic LSL scripting.


'''Variables, Types and Constants''' Be able to recognise differant types of variable and how they can be used to store different types of information. Understand that constants are in essence a "fixed" variable
==Prerequisites==


'''Functions and Parameters''' Recognise functions from their 'll' format and be able to explain why there is a necessity for so many different functions. Understand what a parameter is and why some functions do not need them yet still require brackets.
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.


'''Conditionals''' Show an understanding of the if(condition) and use this understanding to create an object that counts the number of times it has been touched by its owner and display this information in public chat.
==Criteria for testing to basic level==


'''Typecasting''' Understand the need to be able to convert one variable type into another by typecasting.
In the basic skill sets a person should demonstrate a mastery of common programming tasks. The focus here is not on the use of the Linden Labs library but on basic programming and the fundamental LSL commands for the control and flow of a program.  The following categories provide the basic categories.


== Skillset 1: User Interaction ==  
=== Broad Overview and Most Basic Skills  ===  
''' User Input and Communication '''
* Text communication - llSay, llShout, llInstantMessage, llOwnerSay, etc
* Text input - listen event handler and llListen, and their limitations and good practices
* Script communication - Channels other than 0, llRegionSay, link_message event handler and llMessageLinked, llEmail
''' Subcategory: Non-Text Events '''
* touch - touch_start, touch_end, touch, llDetected___ set of functions (we should include
** touchXY functions
* sit
* attach
* camera controls


== Skillset 2: Script-Driven Events ==
* Rationale for scripting
* timer, llSetTimerEvent, good practices
* Script creation
* sensors, good practices
* Commenting and Clarity
* Mono vs. LSL2
* Software Development
* Using Resources


== Skillset 3: Object Attributes ==
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.
* Setting size, shape, type, etc
* Setting color and texture, both overall and by face
* Lighting and other attributes
* Cross-reference to object editing training


== Skillset 4: Object Dynamics ==
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.
''' Non-physics objects '''
* Movement in 3-D space
* Rotations, Vectors, and Quaternions
''' Physics objects '''
* Basics of differences between physics and non-physics objects
* Switching between physics and non-physics via script
* Overview of energy, impulse, etc
* collision events, best practices
''' Vehicles '''
* Vehicle scripting
* Follow Camera controls
''' Linking, unlinking, permissions '''


== Skillset 5: Advanced Communication ==
The person should also 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.
''' Web interface '''
* httpRequest
* XML/RPC
* Basic knowledge of web languages - Perl, Python, PHP, Java, etc
* llEmail
* Parcel controls, including media controls


Finally, the person should demonstrate an awareness of the various resources available to help with programming in LSL. The person should demonstrate that they know how to use the LSL Portal ([http://wiki.secondlife.com/wiki/LSL_Portal]). The person should demonstrate how to use a search engine to obtain help and information about LSL.


== Good Programming with LSL ==
=== Data Types ===
'''Rationale for scripting''' Demonstrate an understanding of what scripts are, why they are used in second life.


'''Script creation''' Show ability to create scripts in both primitives and inventory. Be able to transfer one to the other, set them to running or not and set relevant permissions for them.
* Types
* Operators
* Global vs. Local Variables
* Typecasting


'''Commenting and Clarity''' Understand the benefits of keeping code legible, using the same style of writing throughout and commenting code where necessary.


'''Understanding Lag''' Understand what has a high impact on a simulator and general limitations of code.
 
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 truncated when cast as an integer.
 
==== String ====
 
At the basic level the person should demonstrate an understanding of the string data type. The person should know the memory costs and how it differs from LSL1 and mono. The person should know the difference between UTF-8 and UTF-16. The person should know how to define strings and use escape codes to construct non-trivial strings.
 
The person should know the basic operations defined for strings. This does not include the LSL library functions for the basic level, but the person should demonstrate an understanding of the assignment and comparison of strings.
 
==== List ====
 
At the basic level the person only requires minimal understanding. The person is required to know and be able to use the various library functions at the intermediate level, but at the basic level the person need only know the more basic aspects of lists.
 
The person should demonstrate an understanding of how to assign lists. The person should know the basic memory costs for using a list and know the basic restrictions, such as a list element cannot be a list.
 
The person should know how to concatenate two lists. The person should know how to clear a list. The person should be able to demonstrate a basic understanding of the idea behind a "strided" list and the importance of being able to group certain elements of a list and maintain their relative positioning within a list.
 
==== key ====
 
At the basic level the person should be able to assign a key, know the memory costs, and have a basic idea of what a key is. The person should be able to demonstrate how to assign a key and how to compare keys.
 
Additionally, the person should know about the predefined variables such as NULL_KEY, TEXTURE_BLANK, TEXTURE_MEDIA, TEXTURE_DEFAULT, TEXTURE_PLYWOOD, and TEXTURE_TRANSPARANT.
 
==== Math Functions ====
 
At the basic level the person should demonstrate an understanding of the difference between variables of type integer and float and the operators for each type. The person should also be able to demonstrate an understanding of the various boolean operations and how they differ from the integer operations.
 
===== Integer Functions =====
 
The person should be able to demonstrate a knowledge and an understanding of the basic operations. This includes the operations given at [http://wiki.secondlife.com/wiki/LSL_Operators]. This includes the basic operations, modulus operation, and various assignment operators.
 
This also includes the bit-wise operations. The person should be able to represent an integer in decimal, binary, and hexadecimal forms. Given a number in any of the forms the person should be able to demonstrate an understanding of each of the bit-wise operations and combinations of the bit-wise operations.
 
The person should also demonstrate an understanding of how to cast a variable from integer to other types and vice-versa. The person should know the difference between truncation and rounding (including rounding up and rounding down in consistent ways with both positive and negative floating point numbers). The person should demonstrate how to round and how to truncate using only the basic operations and casting numbers.
 
===== Floating Point Operations =====
 
In addition to the operations in the context of integers the person should also demonstrate an understanding of floating point numbers. This includes an understanding of the basic operations, but also includes the issues of rounding errors versus truncation errors in the context of floating point numbers. This also includes issues of the accumulation of errors which can lead to phenomena such as "prim drift."
 
 
 
 
=== Control Structures ===
 
* Loop Constructs
* Conditionals
 
A person should demonstrate an understanding of the different looping constructs using for, while, and do-while 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 ===
 
* Events
* Functions
* States
 
 
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 ====
 
* Global 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 link set. 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 link set 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 ====
* Euler
* Axis and angle
* Quaternions
 
A person should demonstrate that they know the definitions of a rotation. The person should know the difference between an Euler rotation and a quaternion. A person need not know the specific implementation of a quaternion but should understand a rotation 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.
 
 
=== Basic I/0 ===
 
* llWhisper
* llSay
* llShout
* llRegionSay
* llOwnerSay
* llInstantMessage
 
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 know 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.
 
 
=== Programming and Software Development ===
 
The person should demonstrate basic skills in maintaining and updating a code base. The names of the scripts should indicate what they do and be consistent for a project. Backups of the codes should be maintained, and the person should be able to demonstrate that they can compare and find the difference between files.
 
Most importantly the person should demonstrate consistent habits in commenting a script. Scripts should include comments that indicate what they do and how the programmer accomplishes each task within a script. Every event and subroutine also includes a block of comments to indicate which tasks it is used to complete.
 
We do not specify which commenting style should be used, but the style should be consistent. The person should be familiar with using both the "//" and "/* ---- */" notations for creating comments. Codes that are submitted for the practicum will be evaluated for commenting as well as for function.

Latest revision as of 09:00, 6 September 2010

Overview

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.

Audience

Persons who wish to demonstrate competence in basic LSL scripting.

Prerequisites

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 focus here is not on the use of the Linden Labs library but on basic programming and the fundamental LSL commands for the control and flow of a program. 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
  • Using Resources

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.

The person should also 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.

Finally, the person should demonstrate an awareness of the various resources available to help with programming in LSL. The person should demonstrate that they know how to use the LSL Portal ([1]). The person should demonstrate how to use a search engine to obtain help and information about LSL.

Data Types

  • Types
  • Operators
  • Global vs. Local Variables
  • Typecasting


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 truncated when cast as an integer.

String

At the basic level the person should demonstrate an understanding of the string data type. The person should know the memory costs and how it differs from LSL1 and mono. The person should know the difference between UTF-8 and UTF-16. The person should know how to define strings and use escape codes to construct non-trivial strings.

The person should know the basic operations defined for strings. This does not include the LSL library functions for the basic level, but the person should demonstrate an understanding of the assignment and comparison of strings.

List

At the basic level the person only requires minimal understanding. The person is required to know and be able to use the various library functions at the intermediate level, but at the basic level the person need only know the more basic aspects of lists.

The person should demonstrate an understanding of how to assign lists. The person should know the basic memory costs for using a list and know the basic restrictions, such as a list element cannot be a list.

The person should know how to concatenate two lists. The person should know how to clear a list. The person should be able to demonstrate a basic understanding of the idea behind a "strided" list and the importance of being able to group certain elements of a list and maintain their relative positioning within a list.

key

At the basic level the person should be able to assign a key, know the memory costs, and have a basic idea of what a key is. The person should be able to demonstrate how to assign a key and how to compare keys.

Additionally, the person should know about the predefined variables such as NULL_KEY, TEXTURE_BLANK, TEXTURE_MEDIA, TEXTURE_DEFAULT, TEXTURE_PLYWOOD, and TEXTURE_TRANSPARANT.

Math Functions

At the basic level the person should demonstrate an understanding of the difference between variables of type integer and float and the operators for each type. The person should also be able to demonstrate an understanding of the various boolean operations and how they differ from the integer operations.

Integer Functions

The person should be able to demonstrate a knowledge and an understanding of the basic operations. This includes the operations given at [2]. This includes the basic operations, modulus operation, and various assignment operators.

This also includes the bit-wise operations. The person should be able to represent an integer in decimal, binary, and hexadecimal forms. Given a number in any of the forms the person should be able to demonstrate an understanding of each of the bit-wise operations and combinations of the bit-wise operations.

The person should also demonstrate an understanding of how to cast a variable from integer to other types and vice-versa. The person should know the difference between truncation and rounding (including rounding up and rounding down in consistent ways with both positive and negative floating point numbers). The person should demonstrate how to round and how to truncate using only the basic operations and casting numbers.

Floating Point Operations

In addition to the operations in the context of integers the person should also demonstrate an understanding of floating point numbers. This includes an understanding of the basic operations, but also includes the issues of rounding errors versus truncation errors in the context of floating point numbers. This also includes issues of the accumulation of errors which can lead to phenomena such as "prim drift."



Control Structures

  • Loop Constructs
  • Conditionals

A person should demonstrate an understanding of the different looping constructs using for, while, and do-while 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

  • Events
  • Functions
  • States


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

  • Global 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 link set. 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 link set 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

  • Euler
  • Axis and angle
  • Quaternions

A person should demonstrate that they know the definitions of a rotation. The person should know the difference between an Euler rotation and a quaternion. A person need not know the specific implementation of a quaternion but should understand a rotation 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.


Basic I/0

  • llWhisper
  • llSay
  • llShout
  • llRegionSay
  • llOwnerSay
  • llInstantMessage

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 know 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.


Programming and Software Development

The person should demonstrate basic skills in maintaining and updating a code base. The names of the scripts should indicate what they do and be consistent for a project. Backups of the codes should be maintained, and the person should be able to demonstrate that they can compare and find the difference between files.

Most importantly the person should demonstrate consistent habits in commenting a script. Scripts should include comments that indicate what they do and how the programmer accomplishes each task within a script. Every event and subroutine also includes a block of comments to indicate which tasks it is used to complete.

We do not specify which commenting style should be used, but the style should be consistent. The person should be familiar with using both the "//" and "/* ---- */" notations for creating comments. Codes that are submitted for the practicum will be evaluated for commenting as well as for function.