1 / 22

Joining the Developer Group

Joining the Developer Group. Register an account and select an avatar name at www.secondlife.com Email your avatar name to cwt@uark.edu (or as otherwise directed) Look for the invitation dialog box and click Join. Connecting to the Island. Open the Map tab

Download Presentation

Joining the Developer Group

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. Joining the Developer Group • Register an account and select an avatar name at www.secondlife.com • Email your avatar name to cwt@uark.edu (or as otherwise directed) • Look for the invitation dialog box and click Join

  2. Connecting to the Island • Open the Map tab • Type University of Arkansas into the Search box and click the Search button. • Click University of Arkansas in the results • Click Teleport

  3. Introduction to Second Life Scripting

  4. Resources • http://lslwiki.net/lslwiki/wakka.php • http://wiki.secondlife.com/wiki/LSL_Portal • http://vw.ddns.uark.edu/mediawiki • Resident Experts: Casey Bailey – Dillon Potez Keith Perkins – Thinker51 Brandenburg Nicholas Farrer – Anon Frog

  5. How to Create a Script (In Object) • Right Click object and select Edit • Click on the Content tab • Click “New Script”

  6. LSL Basics • Java-like syntax, but not object oriented • Strongly typed • Event and state driven • Next event will not be processed until current event finishes. • Includes logic and looping constructs such as for, if, while, and do-while

  7. Primary Built-In Data Types • Float – Same as the float type in C • Integer - 32-bit signed integer • String • Key • Vector • Rotation • List

  8. Key • Unique identifier for just about any object in Second Life (UUID/GUID) • Contains hexadecimal characters separated by dashes • Example: • a822ff2b-ff02-461d-b45d-dcd10a2de0c2

  9. Vector • Simple data structure of 3 floats, written as <x, y, z>. • Used to hold position, velocity, and color. • Individual elements can be accessed by using the .x, .y, and .z after the variable name. • For color: • X = Red • Y = Green • Z = Blue • Examples: • vector example = <0, 0, 1.0> • example.z gives the value of 1.0

  10. Rotation • Simple data structure of 4 floats, written as <x, y, z, s>. • Used to hold rotation information as a quaternion – See http://en.wikipedia.org/wiki/Quaternion • Individual elements can be accessed by using the .x, .y, .z, and .s after the variable name • Examples: • rotation example = <0, 0, 0, 1.0> • example.s gives the value of 1.0

  11. List • Generic Container that can hold any number of elements of any type. • Grows dynamically up to maximum amount of memory • All element access is done through llList2<type> functions which take the list and position (0-based as parameters) • Examples: • list example = [7, “Blue”, [0, 1, 2], <5,5,3>]; • llList2Integer(example, 0) returns 7.

  12. States • Every script must have a default state. • All objects begin in the default state. • Additional states can be declared using the state keyword. • Event functions are for that specific state. No direct way to have a event handler that works in all states.

  13. Variable Scope • Global variables are declared outside of all states • Local variables are declared inside of functions • There are no state variables (variables declared within a state but outside of all functions)

  14. Hello World default { state_entry() { llSay(0, "Hello world!"); } }

  15. Basic Chat Output Functions • All have two parameters – Output Channel (Integer) and Message (String) • Different functions have different ranges: • llWhisper – 10 meters • llSay – 20 meters • llShout – 100 meters • llRegionSay – Entire island (but not on received on clients) • Chat Channel 0 is the channel that is displayed in the Second Life client.

  16. Default Script default { state_entry() { llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { llSay(0, "Touched."); } }

  17. Events • Most events can be triggered multiple times per simulation clock cycle. • For the touch_start event, the total_number represents the total avatars that have started touching the object. • Information for each avatar or object detected can be obtained through the llDetected functions.

  18. default { state_entry() { llSay(0, "Hello, Avatar!"); } touch_start(integer total_number) { integer i = 0; for(; i < total_number; ++i) { llSay(0, "Touched by “ + llDetectedName(i)); } } }

  19. State events • State_entry – Triggered when state first becomes active • State_exit – Triggered when state changes and becomes inactive

  20. default { state_entry() { llSay(0, “Default State.”); } touch_start(integer num) { state active; } state_exit() { llSay(0, “Leaving default state.”); } } state active { state_entry() { llSay(0, “Activated”); } touch_start(integer num) { llSay(0, “Touched.”); } }

  21. Lab • Verify that you can teleport to the Second Life island • Get added to the development group • Build an object, add a script, test it out

More Related