Download presentation
Presentation is loading. Please wait.
Published byMaud McDonald Modified over 9 years ago
1
CS590VC - Tutorial 3 Linden Scripting Language (LSL)
2
Getting started ……. Create a box on the ground Select the box by clicking it Select Content tab of Build window -> new script Save the code that you write in the editor. The code will try to get compiled and then saved.
3
Scripting language that runs on server side The running platform is a piece of software called simulator. Compilation into LSL bytecode Two basic concepts – states and events
4
LSL types Common types such as integer, float, string Group types: vector, list (no array for LSL) Position types: rotation UUID type: key
5
Positioning type - rotation Quaternion rotation – x, y, z and s components Example: rotation rot = ; http://lslwiki.net/lslwiki/wakka.php?wakka=rotation
6
Some scripting basics We start with a default state (multiple states are common) Event-based programming – hence event handlers Default event handlers: state_entry & touch_start Lot of library functions are available (starts with “ll*****”) http://lslwiki.net/lslwiki/wakka.php?wakka=HomePage
7
Lets do something….. We first build a door We then program it to make it open and close using LSL You can find the tutorial video at http://www.youtube.com/watch?v=5CuqW C-1w88 http://www.youtube.com/watch?v=5CuqW C-1w88
8
Step 1: Create a slab & make copy (click and press shift -> drag)
9
Step 2: Create another copy & rotate slab
10
Step 3: position the slab that was rotated at the center of the pillars & increase the length as shown
11
Step 4: Make a copy of the left pillar (“the door”) and position that at the center
12
Step 5: a) Make another copy of the left pillar (position that a little left as highlighted in the shot) b) shift + cntrl -> you get the red buttons
13
Step 6: click the button and drag left to create a thin hinge for your door
14
Step 7: Link the door and the hinge by clicking both of them using shift & then cntrl + L
15
Step 8: bring the left pillar back & rotate the door -90 degree using the profile editor
16
Our door is created!! We will now automate the opening and closing of the door
17
Step 9: Open the script editor
18
Step 10: Use this code in the editor default { touch_start(integer total_number) { rotation rot = llGetLocalRot(); // string z = (string)rot.z; // string s = (string)rot.s; // llsay(0, “z = ” + z + “s = ” + s); if (rot.z == 0) { rot.z = -0.707107; rot.s = 0.707107; } else { rot.z = 0; rot.s = 1; } llSetLocalRot(rot); }
19
References http://www.slbuilding.com/ - some very good scripting videos and source-codehttp://www.slbuilding.com/ Second Life – the official guide (2 nd ed.)
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.