eloise


Learning to script

Learning to script, basic

Common first scripts

The default script: Hello Avatar!
‘Switch’ scripts if… else, change states, Handling touches, handling speech and setting up listeners:

Light switches
Door scripts

Titler scripts Making hover text

Debugging

Spans
if’s with ;
semi-colons
spelling

Structure of a script

States
Events
Library Functions
Flow Control

Simple if… else
Loops with for
Loops with while and do-while

Variable types

Declaring variables
What’s in a variable?
Typecasting – changing variables between types
Local and Global variables.

Learning to script, intermediate

Camera controls Forcing mouselook, camera position, scripted camera movement
Collision e.g. bullets, automatic doors, hitting the ground
Simple Communications

sending an instant message (only to an av)
Speaking to the owner only
Speaking, shouting, and whispering, in general chat and on silent channels.

Cryptography
Converting stringsto base 64, from base 64 and encrypting two base 64 strings together.
Generating an MD5 checksum

Detection Detecting grabbing objects, active group, Keys, Touched link items, Names, Owners, Positions, Rotations, Type of entity and Movement from touch_*, collision_* and sensor() events (and ONLY these events).

Specifically to include setting up sensors and repeating sensors

Dataserver calls e.g. Online checkers, age of av check

Online status, age, ratings
NOT notecard reading which is advanced since it requires knowledge of notecards

Debugging

Checking inputs and outputs
speaking to the owner only – reduce spam!

llWhisper(DEBUG_CHANNEL, “foo); for errors.
Good practice

Error checking

Dialog (or menu) boxes
Making all text lower case, or UPPER CASE

Fast timers
Fast sensors
Filtering listens (why, where, when NOT to)

Dynamics e.g. lifts, attached tails, bullets

Physical movement, e.g.

Moving through space
Rotating around the centre
etc.

Working with forces, e.g.

Applying a linear force
Applying torques as well
Applying twists only
etc.

Non-physical movement, e.g.

Moving in space (short range teleport, slides through walls etc.)
Rotating the object
Linked movement (Rotating a child prim>, Finding a child’s position)

Land Controlling access: Banning and Adding to pass list; height, removing avies, Playing music streams.
Particles llParticleSystem. NOT llMakeSmoke, llMakeExplosion etc.
Simple work with texture and prims e.g. online indicator goes green or red

Getting and setting transparency (alpha)
Getting and setting colours
Getting and setting size of objects.
Lights

Variables

Manipulating lists
Manipulating strings

Structure of a script

if’s using &, &&, |, ||: changed and run_time_permissions
user defined functions

World and simulator functions e.g. telling the time, where you are etc.
Global regional co-ordinates, Simulator name
SL Time, GMT Time
etc.

Learning to script, advanced

Complex work with texture and prims This is advanced because it requires knowledge of textures and prims. e.g. animated textures for water, signs, using parts of textures through scripts, fullbright etc.

Finding out about and setting just about everything on a prim. Yes, all at once!
Changing the position of a texture
Changing the size/repeats of a texture
Applying a texture to a prim face
Animating a texture
Linking prims by scriptNB requires permissions from the owner.

Dataserver: Reading notecards:

How long is a notecard.
Retrieving a single line (maximum 255 characters)
Using the key of the query to filter

External Communications

Sending and receiving emails.
xmlrpc and the remote_data() event
Sending HTTP Requests and the receiving them. Also read the http general page.

Inventory management e.g. vendors, texture changers, ambient sound systems e.g.

Getting an inventory item’s key
Getting the name of an inventory item
Counting items in the inventory (of an object)
Getting permissions of an inventory item (also checks if it’s there).
Giving a single inventory item anywhere on the grid.
Giving several items in a folder only to avies, only in sim.
etc.

Sound

Looping sounds
Playing a sound once
Preloading a sound (so it plays when you tell it to)
Stopping a sound This is the only way to stop a loop, which becomes a prim property.
slaved sounds

Video Setting your parcel media to play movies

Learning to script, specialisms

Vehicles
Weapons and shield code
Good particle code

Other sources of information

The LSL Wiki is the most up-to-date and definitive resource for using lsl – the functions, events etc. along with their quirks, work-arounds. It also contains a number of tutorials and contact details for Learning to script who are not necessarily Second Life Mentors but are willing to field scripting questions. It also contains a Script Library and some Example scripts

The Second Life Help Wiki contains a small section on scripting – specifically going through the default script and states and events in good, accessible terms.

The Scripting Library and Scripting tipsfora on the SL Forums pages are also incredibly useful resources. The scripting library contains a wide number of generally well commented free scripts that you can look at for ideas as well as use for your own applications. Scripting Tips is a chance for you to ask questions and get polite, usually helpful replies. Many of the best scripters in SL read and reply to questions on this forum.

Advertisements

Trackbacks & Pingbacks

Comments

  1. * SignpostMarv says:

    The SL Help Wiki has moved/is in the process of moving to http://sliki.info

    | Reply Posted 12 years, 5 months ago


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: