Advanced Scripting in Second Life LIBR 287 - Jeremy Kemp, SJSU SLIS [email_address]
HUD points to the Web Steps overview <ul><li>Gather the web addresses and icons, resize </li></ul><ul><li>Create the “forw...
Gather web addresses <ul><li>Visit the web pages and collect the URLs </li></ul><ul><ul><li>www.ala.org </li></ul></ul><ul...
Gather the Icons <ul><li>Capture icons using a screen capture tool </li></ul><ul><ul><li>Google </li></ul></ul><ul><ul><li...
Upload images <ul><li>Bulk upload and pay 50 L$ </li></ul>
Create a container with hotspots
Texture them properly
Scripting – What was touched? <ul><li>ClickedPrim=llDetectedLinkNumber(number);  </li></ul><ul><li>if (ClickedPrim==3) </l...
Scripting – do that pull down  <ul><li>llLoadURL(llDetectedKey(0), &quot;Click 'Go To Page' to visit.&quot;, pageURL ); </...
Advanced Scripting 2 Building a simple HUD
Steps overview <ul><li>Find the Dice container </li></ul><ul><li>Empty it (mostly) and add a blank script </li></ul><ul><l...
Clean the dice <ul><li>Remove everything but the “dice_drop” sound </li></ul><ul><li>Set “Stretch textures” before resizin...
Starting the script <ul><li>Two variables that are predefined: </li></ul><ul><ul><li>list rots = [< 0.00000, 1.00000, 0, 1...
Rotation and Eulers
When the prim is born: <ul><li>default{  </li></ul><ul><li>state_entry()  </li></ul><ul><ul><li>{ </li></ul></ul><ul><ul><...
Prim is touched = set random rot. <ul><li>touch_start(integer total_number) </li></ul><ul><li>{ </li></ul><ul><li>integer ...
Prim is touched = have some fun <ul><li>llOwnerSay(llList2String(numbers,random));  llPlaySound(&quot;dice_drop”, 1.0); </...
Insert the Script <ul><li>Make it in your inventory or in the prim </li></ul><ul><li>Rename it and add a version number </...
Attach to HUD <ul><li>Right click> More / Attach HUD / Top </li></ul>
Upcoming SlideShare
Loading in …5
×

Advanced Scripting in Second Life

5,343 views

Published on

Shows the process to create a heads up display

0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,343
On SlideShare
0
From Embeds
0
Number of Embeds
40
Actions
Shares
0
Downloads
27
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Advanced Scripting in Second Life

  1. 1. Advanced Scripting in Second Life LIBR 287 - Jeremy Kemp, SJSU SLIS [email_address]
  2. 2. HUD points to the Web Steps overview <ul><li>Gather the web addresses and icons, resize </li></ul><ul><li>Create the “forward” icon and upload images </li></ul><ul><li>Upload the script </li></ul><ul><li>Test and size the object </li></ul><ul><li>Play dice! </li></ul>
  3. 3. Gather web addresses <ul><li>Visit the web pages and collect the URLs </li></ul><ul><ul><li>www.ala.org </li></ul></ul><ul><ul><li>en.wikipedia.org/wiki/Librarian </li></ul></ul><ul><ul><li>google.com/search?hl=en&q=librarian </li></ul></ul><ul><ul><li>merriam-webster.com/dictionary/librarian </li></ul></ul>
  4. 4. Gather the Icons <ul><li>Capture icons using a screen capture tool </li></ul><ul><ul><li>Google </li></ul></ul><ul><ul><li>Wikipedia </li></ul></ul><ul><ul><li>ALA </li></ul></ul><ul><ul><li>Merriam-Webster </li></ul></ul><ul><ul><li>Tool: SnapZPro </li></ul></ul><ul><ul><ul><li>ambrosiasw.com/utilities/snapzprox </li></ul></ul></ul><ul><li>Resize to 256/256 (power of 2) </li></ul><ul><ul><li>Tool: Photoshop </li></ul></ul><ul><ul><ul><li>adobe.com/products/photoshopCreate </li></ul></ul></ul><ul><li>Create the “forward” icon </li></ul>
  5. 5. Upload images <ul><li>Bulk upload and pay 50 L$ </li></ul>
  6. 6. Create a container with hotspots
  7. 7. Texture them properly
  8. 8. Scripting – What was touched? <ul><li>ClickedPrim=llDetectedLinkNumber(number); </li></ul><ul><li>if (ClickedPrim==3) </li></ul><ul><ul><li>{ state rotation_three; </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>else if (ClickedPrim==9) </li></ul></ul><ul><ul><li>{ pageURL=&quot;http://google.com/search?hl=en&q=librarian&quot;;} </li></ul></ul><ul><ul><li>… </li></ul></ul><ul><ul><li>An arrow launches state rotation_three which changes the prim’s rotation </li></ul></ul><ul><ul><li>Or – the hotspots launch set the URL </li></ul></ul>
  9. 9. Scripting – do that pull down <ul><li>llLoadURL(llDetectedKey(0), &quot;Click 'Go To Page' to visit.&quot;, pageURL ); </li></ul><ul><li>llDetectedKey senses the avatar who touched it </li></ul><ul><li>You get a nice message on the pulldown </li></ul>
  10. 10. Advanced Scripting 2 Building a simple HUD
  11. 11. Steps overview <ul><li>Find the Dice container </li></ul><ul><li>Empty it (mostly) and add a blank script </li></ul><ul><li>Add the script parts and test it on the ground </li></ul><ul><li>Attach to HUD top and resize & position </li></ul>
  12. 12. Clean the dice <ul><li>Remove everything but the “dice_drop” sound </li></ul><ul><li>Set “Stretch textures” before resizing </li></ul><ul><li>Set the object to nonphysical and .2 on a side </li></ul>
  13. 13. Starting the script <ul><li>Two variables that are predefined: </li></ul><ul><ul><li>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 >]; </li></ul></ul><ul><ul><li>list numbers = [&quot; 一 &quot;,&quot; 二 &quot;, &quot; 三 &quot;, &quot; 四 &quot;, &quot; 五 &quot;, &quot; 六 &quot;]; </li></ul></ul><ul><ul><li>6 quaternions describe rotation of dice to make each sides show. The list of Chinese numbers is for fun. </li></ul></ul>
  14. 14. Rotation and Eulers
  15. 15. When the prim is born: <ul><li>default{ </li></ul><ul><li>state_entry() </li></ul><ul><ul><li>{ </li></ul></ul><ul><ul><li>llSetRot( (rotation) llList2String(rots,0)); </li></ul></ul><ul><ul><li>} </li></ul></ul><ul><ul><li>“ Set the rotation of the prim to the first item in the list “0”. Notice the type assignment making the string into a rotation. </li></ul></ul>
  16. 16. Prim is touched = set random rot. <ul><li>touch_start(integer total_number) </li></ul><ul><li>{ </li></ul><ul><li>integer random = llFloor(llFrand(6.0)); llSetRot((rotation)llList2String(rots,random)); </li></ul><ul><ul><li>“ 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” </li></ul></ul>
  17. 17. Prim is touched = have some fun <ul><li>llOwnerSay(llList2String(numbers,random)); llPlaySound(&quot;dice_drop”, 1.0); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>“ Use the same random number to pick a Chinese character and say it to owner.” </li></ul><ul><li>“ Play the sound at volume 1” </li></ul>
  18. 18. Insert the Script <ul><li>Make it in your inventory or in the prim </li></ul><ul><li>Rename it and add a version number </li></ul><ul><li>Copy/Paste the notecard text </li></ul>
  19. 19. Attach to HUD <ul><li>Right click> More / Attach HUD / Top </li></ul>

×