connecting to the island
Download
Skip this Video
Download Presentation
Connecting to the Island

Loading in 2 Seconds...

play fullscreen
1 / 22

Connecting to the Island - PowerPoint PPT Presentation


  • 104 Views
  • Uploaded on

Connecting to the Island. Ensure you are in the UA CSCE Artificial Intelligence group Open the Map tap Type University of Arkansas into the Search box and hit the Search button. Click University of Arkansas in the results Click Teleport. Introduction to Second Life Scripting. Resources.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Connecting to the Island' - baxter


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
connecting to the island
Connecting to the Island
  • Ensure you are in the UA CSCE Artificial Intelligence group
  • Open the Map tap
  • Type University of Arkansas into the Search box and hit the Search button.
  • Click University of Arkansas in the results
  • Click Teleport
resources
Resources
  • http://wiki.secondlife.com/wiki/LSL_Portal
  • http://lslwiki.net/lslwiki/wakka.php
  • Inside of Second Life:
    • Linden Script Tutorial Group
    • The Particle Laboratory (http://slurl.com/secondlife/Teal/201/50/301)
how to create a script in inventory
How to Create a Script (In Inventory)
  • Right click and Select the new script button.
  • Cannot run scripts in inventory
how to create a script in object
How to Create a Script (In Object)
  • Right Click object and select Edit
  • Click on the Content tab
  • Click “New Script”
lsl basics
LSL Basics
  • Event and state driven
  • Single Threaded
  • Next event will not be processed until current event finishes.
  • Includes logic and looping constructs such as for, if, while, and do-while
primary built in data types
Primary Built-In Data Types
  • Float – Same as the float type in C
  • Integer - 32-bit signed integer
  • String
  • Key
  • Vector
  • List
slide9
Key
  • Unique identifier for just about any object in Second Life
  • Contains hexidecimal characters seperated by dashes
  • Example:
    • a822ff2b-ff02-461d-b45d-dcd10a2de0c2
vector
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>
    • example.z gives the value of 1.
slide11
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.
states
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.
hello world
Hello World

default

{

state_entry()

{

llSay(0, "Hello world!");

}

}

basic chat output functions
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.
default script
Default Script

default

{

state_entry()

{

llSay(0, "Hello, Avatar!");

}

touch_start(integer total_number)

{

llSay(0, "Touched.");

}

}

events
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.
slide17
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));

}

}

}

state events
State events
  • State_entry – Triggered when state first becomes active
  • State_exit – Triggered when state changes and becomes inactive
slide19
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.”);

}

}

slide20
integer relaychan = -1356;

default

{

state_entry()

{

llListen(relaychan, “”, NULL_KEY, “”); //Channel, Name, Key, Message filters

llListen(0, “”, NULL_KEY, “”);

}

listen(integer chan, string name, key id, string message)

{

if(chan == relaychan)

{

llSay(0, message);

}

else

{

llShout(relaychan, name + “: ” + message);

}

}

}

slide21
list lastReceived;integer listenchan = -800;default{   state_entry()   {       llListen(listenchan, "", NULL_KEY, "");       llSetText("ON", <1.0, 1.0, 1.0>, 1.0);   }   listen(integer channel, string name, key id, string message)   {       lastReceived = llListInsertList(lastReceived, [message], 0);       integer len = llGetListLength(lastReceived);       if(len > 10)       {           lastReceived = llList2List(lastReceived, 0, 9);       }       integer pos = 0;       string floatText = "Last 10 messages:\n";       for(; pos < 10; ++pos)       {           floatText += llList2String(lastReceived, pos) + "\n";       }       llSetText(floatText, <1.0, 1.0, 1.0>, 1.0);   }   touch_start(integer a)   {       state off;   }}state off{   state_entry()   {       llSetText("OFF", <1.0, 1.0, 1.0>, 1.0);   }   touch_start(integer a)   {       state default;   }}
slide22
Lab
  • Verify that you can teleport to the Second Life island
  • Try out the example scripts.
  • Create a script to use llShout to say your avatar name(s) on channel -800.
ad