1 / 19

CS590VC - Tutorial 3

CS590VC - Tutorial 3. Linden Scripting Language (LSL). 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.

dmusser
Télécharger la présentation

CS590VC - Tutorial 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 = <0.0, 0.0, 0.0, 1.0>; 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=5CuqWC-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-code • Second Life – the official guide (2nd ed.)

More Related