Advanced Scripting in Second Life

58 %
42 %
Information about Advanced Scripting in Second Life
Education

Published on October 29, 2008

Author: jeremykemp

Source: slideshare.net

Description

Shows the process to create a heads up display

Advanced Scripting in Second Life LIBR 287 - Jeremy Kemp, SJSU SLIS [email_address]

HUD points to the Web Steps overview Gather the web addresses and icons, resize Create the “forward” icon and upload images Upload the script Test and size the object Play dice!

Gather the web addresses and icons, resize

Create the “forward” icon and upload images

Upload the script

Test and size the object

Play dice!

Gather web addresses Visit the web pages and collect the URLs www.ala.org en.wikipedia.org/wiki/Librarian google.com/search?hl=en&q=librarian merriam-webster.com/dictionary/librarian

Visit the web pages and collect the URLs

www.ala.org

en.wikipedia.org/wiki/Librarian

google.com/search?hl=en&q=librarian

merriam-webster.com/dictionary/librarian

Gather the Icons Capture icons using a screen capture tool Google Wikipedia ALA Merriam-Webster Tool: SnapZPro ambrosiasw.com/utilities/snapzprox Resize to 256/256 (power of 2) Tool: Photoshop adobe.com/products/photoshopCreate Create the “forward” icon

Capture icons using a screen capture tool

Google

Wikipedia

ALA

Merriam-Webster

Tool: SnapZPro

ambrosiasw.com/utilities/snapzprox

Resize to 256/256 (power of 2)

Tool: Photoshop

adobe.com/products/photoshopCreate

Create the “forward” icon

Upload images Bulk upload and pay 50 L$

Bulk upload and pay 50 L$

Create a container with hotspots

Texture them properly

Scripting – What was touched? ClickedPrim=llDetectedLinkNumber(number); if (ClickedPrim==3) { state rotation_three; } else if (ClickedPrim==9) { pageURL="http://google.com/search?hl=en&q=librarian";} … An arrow launches state rotation_three which changes the prim’s rotation Or – the hotspots launch set the URL

ClickedPrim=llDetectedLinkNumber(number);

if (ClickedPrim==3)

{ state rotation_three;

}

else if (ClickedPrim==9)

{ pageURL="http://google.com/search?hl=en&q=librarian";}



An arrow launches state rotation_three which changes the prim’s rotation

Or – the hotspots launch set the URL

Scripting – do that pull down llLoadURL(llDetectedKey(0), "Click 'Go To Page' to visit.", pageURL ); llDetectedKey senses the avatar who touched it You get a nice message on the pulldown

llLoadURL(llDetectedKey(0), "Click 'Go To Page' to visit.", pageURL );

llDetectedKey senses the avatar who touched it

You get a nice message on the pulldown

Advanced Scripting 2 Building a simple HUD

Steps overview Find the Dice container Empty it (mostly) and add a blank script Add the script parts and test it on the ground Attach to HUD top and resize & position

Find the Dice container

Empty it (mostly) and add a blank script

Add the script parts and test it on the ground

Attach to HUD top and resize & position

Clean the dice Remove everything but the “dice_drop” sound Set “Stretch textures” before resizing Set the object to nonphysical and .2 on a side

Remove everything but the “dice_drop” sound

Set “Stretch textures” before resizing

Set the object to nonphysical and .2 on a side

Starting the script Two variables that are predefined: list rots = [< 0.00000, 1.00000, 0, 1>,<0.00000, 0, 0.70711, 0.70711 >, < -0.00000, 0.00000, -1.00000, 0.00000 >, < 0.00000, 0.00000, -0.70711, 0.70711 >,< 0.00000, 0.00000, 0.000, 0.70711 >,< 0.00000, -1, 0.000, 1 >]; list numbers = [&quot; 一 &quot;,&quot; 二 &quot;, &quot; 三 &quot;, &quot; 四 &quot;, &quot; 五 &quot;, &quot; 六 &quot;]; 6 quaternions describe rotation of dice to make each sides show. The list of Chinese numbers is for fun.

Two variables that are predefined:

list rots = [< 0.00000, 1.00000, 0, 1>,<0.00000, 0, 0.70711, 0.70711 >, < -0.00000, 0.00000, -1.00000, 0.00000 >, < 0.00000, 0.00000, -0.70711, 0.70711 >,< 0.00000, 0.00000, 0.000, 0.70711 >,< 0.00000, -1, 0.000, 1 >];

list numbers = [&quot; 一 &quot;,&quot; 二 &quot;, &quot; 三 &quot;, &quot; 四 &quot;, &quot; 五 &quot;, &quot; 六 &quot;];

6 quaternions describe rotation of dice to make each sides show. The list of Chinese numbers is for fun.

Rotation and Eulers

When the prim is born: default{ state_entry() { llSetRot( (rotation) llList2String(rots,0)); } “ Set the rotation of the prim to the first item in the list “0”. Notice the type assignment making the string into a rotation.

default{

state_entry()

{

llSetRot( (rotation) llList2String(rots,0));

}

“ Set the rotation of the prim to the first item in the list “0”. Notice the type assignment making the string into a rotation.

Prim is touched = set random rot. touch_start(integer total_number) { integer random = llFloor(llFrand(6.0)); llSetRot((rotation)llList2String(rots,random)); “ Take a random number 0 to 6 and round it down (floor)” “Set the rotation of the prim to a random item in the list”

touch_start(integer total_number)

{

integer random = llFloor(llFrand(6.0)); llSetRot((rotation)llList2String(rots,random));

“ Take a random number 0 to 6 and round it down (floor)” “Set the rotation of the prim to a random item in the list”

Prim is touched = have some fun llOwnerSay(llList2String(numbers,random)); llPlaySound(&quot;dice_drop”, 1.0); } } “ Use the same random number to pick a Chinese character and say it to owner.” “ Play the sound at volume 1”

llOwnerSay(llList2String(numbers,random)); llPlaySound(&quot;dice_drop”, 1.0);

}

}

“ Use the same random number to pick a Chinese character and say it to owner.”

“ Play the sound at volume 1”

Insert the Script Make it in your inventory or in the prim Rename it and add a version number Copy/Paste the notecard text

Make it in your inventory or in the prim

Rename it and add a version number

Copy/Paste the notecard text

Attach to HUD Right click> More / Attach HUD / Top

Right click> More / Attach HUD / Top

Add a comment

Related presentations

Related pages

SL Cert - Advanced Scripting - Second Life Wiki

Overview. Criteria required for persons to become certified in advanced scripting. Audience. Persons who wish to demonstrate competence in ...
Read more

Second Life - Advanced Scripting - blogspot.com

This week’s post is my personal favourite since a lot of scripting will be taking place. Last week’s blog entry focused on primitives which ...
Read more

Advanced Sculptie Exporter From Maya - Second Life Wiki

Advanced Sculptie Exporter From Maya. From Second Life Wiki. ... Automated Import To Second Life. ... Advanced Search;
Read more

#5/5 Advanced SL Pathfinding Scripting in Second Life ...

#5/5 Advanced SL Pathfinding Scripting in Second Life ... #4/5 Advanced Animations for SL Pathfinding Characters in Second Life ...
Read more

Scripting Recipes for Second Life - AbeBooks

Scripting Recipes for Second Life ... advanced items you must program in the Linden Scripting Language. This book presents many common objects in Second ...
Read more

Advanced Scripting in Second Life - Education - documents

1.Advanced Scripting in Second Life LIBR 287 - Jeremy Kemp, SJSU SLIS [email_address] 2. HUD points to the Web Steps overview . Gather the web addresses ...
Read more

Windlight advanced sky & RLV - Second Life

I'm not sure that here is the right place to ask, so if anyone can steer me to a more appropriate venue, I would be most grateful. But I thought I would ...
Read more

Advanced Texture Animation on Prim - Second Life

I have done some web searching and I cannot find anything related as to what I am trying to do. I have 5 textures 1024x1024 with 16 frames each in sequence ...
Read more

Advanced LSL Scripting - INGV Bologna

Stefano Cacciaguerra Ph.D in Computer Science 2 Outline I. Sending and Receiving Messages II. User Interface III. Advanced Data Management IV. Interacting ...
Read more