“Getting the Code You Need”Presented by Lea Tesoro / Opal Lei at the Non-Profit Commons in Second Life on November 9, 2012...
Getting the Code You Need – Q&A                                                                               2Q: How come...
Getting the Code You Need – Q&A                                                                                3Q: How do ...
Getting the Code You Need – Q&A                                                                         4Q: What kind of c...
Upcoming SlideShare
Loading in...5
×

Getting the Code You Need - Q&A

166

Published on

Presented at the Non-Profit Commons in Second Life on Nov 9, 2012.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
166
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Getting the Code You Need - Q&A

  1. 1. “Getting the Code You Need”Presented by Lea Tesoro / Opal Lei at the Non-Profit Commons in Second Life on November 9, 2012This document contains the questions asked in the pre-talk survey and Opal’s answers.To receive a copy of the expanded version of the LSL spec-writing guideline as a pdf file, please fill out thepost-talk survey at http://www.surveymonkey.com/s/R3VDKJV or send email to opallei@gmail.com. IfOpal updates the document, you will automatically receive a copy by email.Q&AQ: What are the best current resources for learning more about scripting?The LSL portal in the Second Life wiki should be your bible: http://wiki.secondlife.com/wiki/LSL_Portal .I still refer to it every time to look up the correct spelling of a function name and/or to check theparameters it requires. Copying and pasting the syntax avoids wasted time looking for a bug caused bymisspelling or by the wrong parameter type.An older resource is lslwiki.net, but I’m not sure how up-to-date that is. However, some of the functionsare better described there than in the SL wiki.Don’t read it all at once. Just take the time to look up the one or two functions that you need.DISCLAIMER: I cannot vouch for nor recommend any of the following individuals, groups, sites ororganizations, because I have no connections nor interactions with them.  College of Scripting: http://maps.secondlife.com/secondlife/Horsa/57/243/84  Builder’s Brewery (buildersbrewery.com)  Groups: o “Scripting Mentors” looks like a good one to join. o Search for “scripting” in Groups.  YouTube: o Search for “lsl scripting tutorial”.  A website that generates LSL based on your answers to multiple choice questions: o http://www.3greeneggs.com/autoscript/  A website that generates LSL particle scripts (Thank you, Patio Plasma, for the tip!): o http://particles-lsl-generator.bashora.com
  2. 2. Getting the Code You Need – Q&A 2Q: How come a script such as a moving texture stays in the prim even after you delete thescript? I made some moving water and wanted to stop it but couldnt even after I deleted thescript.Texture animation is a property of the prim. Same as the hovertext. To stop the animation, you need torun a script that explicitly “stops” the animation by changing the value of that prim property.default{ state_entry() { llSetTextureAnim( 0, ALL_SIDES, 1, 1, 1.0, 1, 1 ); }}Q: Why do scripts suddenly stop working?It could be one of many reasons.Assuming that you’re in a parcel that allows scripts to run, …Assuming that the script is actually running, …Assuming that the script doesn’t have other conditions that prevent it from running; i.e.: it only works ifyou’re the owner of the object, or it only works underwater, or there’s an expiration built into the code(These conditions are, of course, usually rare, except the owner one), …… If the script is very old, it might be hitting some limitations that LL had imposed sometime after thescript was written, like the length of the object name, the length of the description, the length of thehovertext allowed. These are typically where scripts store data. It could also be other changes in theLSL API that affect the script.… If the scripts depends on data outside SL, like a website or a database, and the creator had left SL anddeleted the website and the database, … depending how user-friendly the script is, it might just stoprunning and not give you any idea why.… If the script exceeds the memory allocated to it, ... for example, if you’re saving the names of all yourvisitors and you usually clear the log once a day, but you had an unusually high number of visitors thatday, then your script could crash for lack of memory space, again depending on how it’s scripted tohandle errors. Most scripters usually don’t handle errors gracefully or validate data. That’s becausethey’re focused on the performance of the script or on getting it done as quickly as possible, and thosethings add complexity and bulk to the script. Or they really don’t know good coding practices.v20121109 ©2012 Eleanor (Lea) Tesoro / Opal Lei (VirtuaSapient.com)
  3. 3. Getting the Code You Need – Q&A 3Q: How do you get scripts to talk to each other?Depends how far away they are from each other.  If they’re in the same prim or object, use llMessageLinked.  If they’re in different objects but are within 20m of each other, use llSay in a private channel and llListen in the recipient.  If within 96m of each other, use llShout in a private channel.  If within the same sim, use llRegionSay or llRegionSayTo in a private channel.  If they are in different sims, use llEmail. Watch out for restrictions to that function though.In any of these, I would suggest using measures to secure your communication channel and avoid lag bycutting down the noise you listen to. For example, if you have to listen to channel 0, which is the publicchat channel, limit it to listen to only one person. Ideally, use another channel. Ideally, as far away fromzero as allowed. Ideally, a negative number.Of course, there are hacky ways to exchange information too.Q: How many scripts can you put into an object?Theoretically, as many items as you can put into the object, regardless of type.Practically, depending on the scripts. If they are all running, you’ll probably crash the sim before you getto that theoretical limit. Please let me know if you try it. ;)Q: How do you know it is okay to modify a script?If the script is intentionally open-source, the creator will probably include a license statement in it thattells you what you’re allowed to do with the script.If the creator gave you a modifiable script and does not explicitly give you permission to do what youwill with it, it’s best to explicitly ask the creator what you’re allowed to do with it. They might allow youto modify it for personal use only or for your products only, but not to distribute it otherwise, whetheryou modified it or not. That applies to the script as a whole and to significant parts of the script.When in doubt, ask the creator.v20121109 ©2012 Eleanor (Lea) Tesoro / Opal Lei (VirtuaSapient.com)
  4. 4. Getting the Code You Need – Q&A 4Q: What kind of credit do you need to keep posted inside a script that you modified?If it’s open-source, leave in what other contributors before you had written. When you modify a part ofit, you can create a comment with your unique name, email address or however you want to be known,the date of modification, a description of the modification, and why.Q: what is the difference between creating machinima and animating an avatar moreresponsively for a mixed reality event?It sounds like there are some misconceptions mixed in there, so I’ll try to explain as best as I can.A machinima is a movie filmed inside a game environment, like SL. When you said “animating anavatar”, I’m guessing that you don’t mean animations, but artificial intelligence. There are systems usingexternal code and special viewers that animate bots inside SL. But I think they’re still expensive and thetechnology is still really barely developed so it cannot do much beyond inviting you to join a group orgiving you a predefined greeting or a notecard. I could be wrong.v20121109 ©2012 Eleanor (Lea) Tesoro / Opal Lei (VirtuaSapient.com)

×