<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Keltic Games &#187; Second Life</title>
	<atom:link href="http://www.kelticgames.com/index.php/category/second-life/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kelticgames.com</link>
	<description></description>
	<lastBuildDate>Wed, 27 May 2009 15:20:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Second Life: A Guide to Your Virtual World</title>
		<link>http://www.kelticgames.com/index.php/2008/05/13/second-life-a-guide-to-your-virtual-world/</link>
		<comments>http://www.kelticgames.com/index.php/2008/05/13/second-life-a-guide-to-your-virtual-world/#comments</comments>
		<pubDate>Tue, 13 May 2008 14:04:44 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[dummies]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[sl]]></category>
		<category><![CDATA[virtual]]></category>
		<category><![CDATA[world]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/05/13/second-life-a-guide-to-your-virtual-world/</guid>
		<description><![CDATA[When I started my first SL project, my wife grabbed a couple SL books from the library where she works. The first was Second Life For Dummies. This may seem surprising, but I have found many of the Dummies books to be humorous and informative introductions into new topics. This title didn&#8217;t fall into that [...]]]></description>
			<content:encoded><![CDATA[<p>When I started my first SL project, my wife grabbed a couple SL books from the library where she works. The first was <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FSecond-Life-Dummies-Computer-Tech%2Fdp%2F0470180250%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1210687360%26sr%3D1-1&amp;tag=keltgame-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Second Life For Dummies</a><img src="http://www.assoc-amazon.com/e/ir?t=keltgame-20&amp;l=ur2&amp;o=1" style="border: medium none  ! important; margin: 0px ! important" border="0" height="1" width="1" target=_blank />. This may seem surprising, but I have found many of the Dummies books to be humorous and informative introductions into new topics. This title didn&#8217;t fall into that category. I learned more exploring in-world for a couple hours than reading this book. Second Life for Complete Morons would be a better title.</p>
<p>The second was <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2FSecond-Life-Guide-Virtual-World%2Fdp%2F0321501667%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1203880434%26sr%3D8-8&amp;tag=keltgame-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=9325">Second Life: A Guide to Your Virtual World</a><img src="http://www.assoc-amazon.com/e/ir?t=keltgame-20&amp;l=ur2&amp;o=1" style="border: medium none  ! important; margin: 0px ! important" border="0" height="1" width="1" target=_blank /> by Brian A. White. This is an excellent introduction to SL! The book covers all of the major topics about SL, it contains many valuable tutorials and many excellent screenshots for reference. I highly recommend it. One of the build tutorials in the book is how to make a waterfall. Ironically, on my first SL project, I was asked to make a waterfall. I grabbed the exact waterfall used in the tutorial from Brian&#8217;s land in SL and dissected it before building multiple waterfalls.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/05/13/second-life-a-guide-to-your-virtual-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SL Persistent Data Storage</title>
		<link>http://www.kelticgames.com/index.php/2008/05/13/sl-persistent-data-storage/</link>
		<comments>http://www.kelticgames.com/index.php/2008/05/13/sl-persistent-data-storage/#comments</comments>
		<pubDate>Tue, 13 May 2008 13:35:56 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[description]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[lsl]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[name]]></category>
		<category><![CDATA[notecard]]></category>
		<category><![CDATA[persistent]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[sl]]></category>
		<category><![CDATA[storage]]></category>
		<category><![CDATA[values]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/05/13/sl-persistent-data-storage/</guid>
		<description><![CDATA[The storage of persistent data appears to be quite a hot topic in the Second Life scripting community. I can certainly understand why. There are three options for storing data persistently in SL and each has a significant limitation. Object names and descriptions offer a location to read and write dynamic values, so long as [...]]]></description>
			<content:encoded><![CDATA[<p>The storage of persistent data appears to be quite a hot topic in the Second Life scripting community. I can certainly understand why. There are three options for storing data persistently in SL and each has a significant limitation.</p>
<ol>
<li>Object names and descriptions offer a location to read and write dynamic values, so long as they are short. Names are limited to 63 characters and descriptions to 127 characters. I&#8217;ve used the description field to store single values as well as short lists of values to parse in script.</li>
<li>Notecards are a popular way to store configuration values for scripts. Packaging a no modify script with a modifiable notecard, allows sellers to offer scripts that are configurable without giving the source code away. However, notecards are read-only.</li>
<li>Scripts can pass data to each other, allowing for scripts designed solely to store data while other scripts are reset. However, even these scripts will loose data when the sim is restarted.</li>
</ol>
<p>Linden Labs has indicated that they are not pursuing a solution, at least not before the release of Mono, the upcoming scripting language for SL with increased speed and stability. There are third-party solutions, but privacy and reliability would be big concerns. There are scripts available to setup your own external storage via PHP. This requires a hosting solutions outside of SL, an additional cost for many SL residents.</p>
<p>In the mean time, it seems like the best compromise would be an API that utilizes a reliable third party provider of storage. For example, an open source API created with <a href="http://code.google.com/appengine/" target="_blank">Google App Engine</a> would allow each scripter to easily setup their own private storage. hmmm</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/05/13/sl-persistent-data-storage/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>SL Teleport</title>
		<link>http://www.kelticgames.com/index.php/2008/05/08/sl-teleport/</link>
		<comments>http://www.kelticgames.com/index.php/2008/05/08/sl-teleport/#comments</comments>
		<pubDate>Thu, 08 May 2008 13:35:06 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[llMapDestination]]></category>
		<category><![CDATA[llSitTarget]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[sl]]></category>
		<category><![CDATA[teleport]]></category>
		<category><![CDATA[warpPos]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/05/08/sl-teleport/</guid>
		<description><![CDATA[The lack of a sound teleport function in Second Life has become a major frustration. I wrote a basic teleport script using the llSitTarget() hack. This worked well for short range distances, say anything under about 50 meters. However, when I implemented this over longer ranges of about 100m, some strange side-effects started to appear. [...]]]></description>
			<content:encoded><![CDATA[<p>The lack of a sound teleport function in Second Life has become a major frustration. I wrote a basic teleport script using the llSitTarget() hack. This worked well for short range distances, say anything under about 50 meters. However, when I implemented this over longer ranges of about 100m, some strange side-effects started to appear. The teleporting avatar would appear underground by more than 70m or off the sim by more than 100m. After 3-5 seconds, the avatar would snap to the correct position. This would certainly be confusing the many users.</p>
<p>On some teleports, the camera would start moving from the source to the destination, but stop mid-way, even though the avatar completed the trip. Using the moving keys would snap the camera to the correct position behind the avatar, but still not a good user experience.</p>
<p>Don&#8217;t even get me started on dealing with rotations in the llSitTarget() function. I could certainly be implementing them wrong, I&#8217;ve gotten some to work properly, but most do not. It seems to depend a great deal on the local rotation of the object. I&#8217;ve even had some chairs where two of the vector floats controlled the same axis! This limited me to rotating a sit target in two dimensions. I could rotate left-to-right and side-to-side, but not front-to-back.</p>
<p>I also tried implementing the popular warpPos function, which sits the avatar on a prim, moves the prim in 10m increments to the destination and then unsits the avatar. This worked, but exhibited the same unusual side-effects.</p>
<p>I also tested a number of commercial teleport solutions and they all exhibit the same side-effects.</p>
<p>Of course, llMapDestination() is the official method for teleporting. However, this simply brings up the full map with the target destination highlighted. The user is required to click the Teleport button among a sea of options. The map is a powerful tool, but completely overkill when you simply want to teleport to a specified destination.</p>
<p>A simple function would address all of these issues:</p>
<p>llTeleportAgent(vector targetLocation, float targetCompassFacingInDegrees, integer showMap)</p>
<p>I know there are security concerns that need to be addressed, but it&#8217;s hard to imagine creating mass-appeal for this environment when such basic issues persist.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/05/08/sl-teleport/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SL LSL Wish List</title>
		<link>http://www.kelticgames.com/index.php/2008/05/06/sl-lsl-wish-list/</link>
		<comments>http://www.kelticgames.com/index.php/2008/05/06/sl-lsl-wish-list/#comments</comments>
		<pubDate>Tue, 06 May 2008 14:13:40 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[catch]]></category>
		<category><![CDATA[error handling]]></category>
		<category><![CDATA[event]]></category>
		<category><![CDATA[float]]></category>
		<category><![CDATA[integer]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[lsl]]></category>
		<category><![CDATA[sl]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[try]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/05/06/sl-lsl-wish-list/</guid>
		<description><![CDATA[The lack of any type of error handling in Linden Scripting Language (lsl) is a bit frustrating. This could be addressed with the addition of a try/catch or an error event. Type checking would also be nice. This could either be done with individual functions, such as llIsInteger(), llIsVector(), etc. Or a single function could [...]]]></description>
			<content:encoded><![CDATA[<p>The lack of any type of error handling in Linden Scripting Language (lsl) is a bit frustrating. This could be addressed with the addition of a try/catch or an error event.</p>
<p>Type checking would also be nice. This could either be done with individual functions, such as llIsInteger(), llIsVector(), etc. Or a single function could return the type of a variable, such as llGetVariableType(string variableName).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/05/06/sl-lsl-wish-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SL Updating Scripts</title>
		<link>http://www.kelticgames.com/index.php/2008/05/06/sl-updating-scripts/</link>
		<comments>http://www.kelticgames.com/index.php/2008/05/06/sl-updating-scripts/#comments</comments>
		<pubDate>Tue, 06 May 2008 13:54:42 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[llRemoteLoadScriptPin]]></category>
		<category><![CDATA[llSetRemoteAccessPin]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shout]]></category>
		<category><![CDATA[sl]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/05/06/sl-updating-scripts/</guid>
		<description><![CDATA[When I started scripting in Second Life, I quickly realized that I would have many dozens of objects that used the same script. This script would need to be updated in all of those objects repeatedly, not something I was looking forward to doing manually. While it would be ideal if multiple objects could reference [...]]]></description>
			<content:encoded><![CDATA[<p>When I started scripting in Second Life, I quickly realized that I would have many dozens of objects that used the same script. This script would need to be updated in all of those objects repeatedly, not something I was looking forward to doing manually. While it would be ideal if multiple objects could reference the same script from a single location, that option is not available.</p>
<p>The next best option was to push the updated script from a central script server object to the client objects. A single script could handle serving the script using llRemoteLoadScriptPin(). This function pushes the specified script to an object with a specified key. If all of the objects that needed the script had the same name, then the central script could query those objects by name and create a list of their keys.</p>
<p>Not so fast. There is no function to return a list of object keys based on name or any other criteria aside from linkage. Due to the distances involved, linking was not an option. I certainly didn&#8217;t want to maintain a list of keys for the objects manually. And of course, the client object getting the script would need to have a matching pin number set for llRemoteLoadScriptPin() to work. Both of these issues meant that a client script was also required.</p>
<p>It&#8217;s easy enough to set the pin in the client script using llSetRemoteAccessPin(). However, how would the server script get the key of the client object? The client script needs to provide it. Not unlike an HTTP or FTP request, the client would need to request the script via chat and the server object, listening for the request, could provide the requested script back to the requesting object.</p>
<p>This created another issue: How is the client request initiated for each of dozens of objects? I added a listener to the client script that would listen for a specific chat command from my avatar on a private channel. This way, I could update objects within 20 meters via chat or objects up to 100 meters away via shout. This system has worked fairly well and only requires about 3 shouts to update the client scripts scattered across an entire region.</p>
<p>I also considered creating a single point of activation at the server. This could be done by adding another listener to the server which would broadcast an update request region-wide, prompting all of the clients in the region to request an update.</p>
<ol>
<li>Avatar to Server: hey server, broadcast update request to region</li>
<li>Server to Region: if you can hear me, it&#8217;s time to update</li>
<li>Client to Server: hey server, please send me this script</li>
<li>Server to Client: sends script</li>
</ol>
<p>I didn&#8217;t have the need to implement this by the end of this project, but may do so right at the beginning of my next SL project.</p>
<p>I have also added code to each script that queries the object name and prevents of the script from running if it&#8217;s located on the script server. This will avoid potentially wacky behavior that might result from various scripts running on the server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/05/06/sl-updating-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SL Rotations</title>
		<link>http://www.kelticgames.com/index.php/2008/04/29/sl-rotations/</link>
		<comments>http://www.kelticgames.com/index.php/2008/04/29/sl-rotations/#comments</comments>
		<pubDate>Wed, 30 Apr 2008 01:53:45 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[compass]]></category>
		<category><![CDATA[degrees]]></category>
		<category><![CDATA[direction]]></category>
		<category><![CDATA[hud]]></category>
		<category><![CDATA[llGetCameraRot]]></category>
		<category><![CDATA[llGetRootRotation]]></category>
		<category><![CDATA[lsl]]></category>
		<category><![CDATA[radians]]></category>
		<category><![CDATA[rotation]]></category>
		<category><![CDATA[sl]]></category>
		<category><![CDATA[vector]]></category>
		<category><![CDATA[vehicle]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/04/29/sl-rotations/</guid>
		<description><![CDATA[I recently completed the construction of a transportation system within an island of Second Life. This included a vehicle which needed to operate along a generally fixed but not exact path. Instead of putting the vehicle on some type of an rail, I placed the vehicle in the space, pointed it in a particular direction [...]]]></description>
			<content:encoded><![CDATA[<p>I recently completed the construction of a transportation system within an island of Second Life. This included a vehicle which needed to operate along a generally fixed but not exact path. Instead of putting the vehicle on some type of an rail, I placed the vehicle in the space, pointed it in a particular direction and let it go. I lined the space with invisible bumpers. When the vehicle collides with the invisible bumpers, it changes direction. This would allow the vehicle paths to vary slightly on each pass. I discussed the communication issues in <a href="http://www.kelticgames.com/index.php/2008/04/15/second-life-phantom-collisions/">Second Life Phantom Collisions</a>.</p>
<p>I encountered a very complex subject in SL: rotations. Since the vehicles needed to point in a particular compass direction at start and on collision, I would need to know the direction for each of these cases. This required determining the compass direction in an easy to read number from 0 to 359 degrees. This number was then converted to a vector (&lt;x, y, z&gt;), where x and y are both 0 and the degrees assume the z value (&lt;0.0, 0.0, direction&gt;). This vector was then converted from degrees to radians and then to a rotation. This was fairly easy to piece together using examples from the various LSL wikis (<a href="http://lslwiki.net/lslwiki/wakka.php?wakka=rotation" target="_blank">lslwiki.net</a> and <a href="http://wiki.secondlife.com/wiki/Rotation" target="_blank">wiki.secondlife.com</a>). However, as is with SL, there are always a few undocumented catches.</p>
<p>First, the degrees value is not what you might think. I would expect 0 degrees to represent North and proceed clockwise around the compass. I could also see the values starting at East and progressing clockwise. Neither was the case, 0 starts at East and proceeds <em>counter-clockwise</em> around the compass: 90 degrees is North, 180 degrees is West, 270 degrees is South, etc.</p>
<p>It was much too inaccurate to guess the degree values based on the compass headings in the mini-map, so I built a HUD to display an exact value based on the facing of my avatar. This way, I could point my avatar, read the value and plug it into the object needing a direction. After a series of tests, it became clear that the HUD was inaccurate anywhere between 1 and 9 degrees. After some trial and error, I switched from the rotation of the avatar with llGetRootRotation()  to the rotation of the camera with llGetCameraRot(). This produced an accurate result.</p>
<p>To summarize, the HUD would convert the rotation of the camera to a human-friendly direction in degrees and the objects could convert that direction back to a SL-friendly rotation.</p>
<p>The HUD simply consisted of floating text on an invisible prim. I had originally attached this to my head, which worked but lead to my fellow developers wondering why I had text floating above my head all the time. n00b! Instead, I attached the prim directly to my HUD, so that only I would see it. My first HUD attachment.</p>
<p>I&#8217;ve also been attempting to convert local rotations to global rotations and then modify those further based on a particular direction, but this has proved extremely challenging and beyond the scope of any SL rotation documentation that I have found. According to the documentation, it should be possible, I just haven&#8217;t figured it out yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/04/29/sl-rotations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Second Life Sound Issues</title>
		<link>http://www.kelticgames.com/index.php/2008/04/24/second-life-sound-issues/</link>
		<comments>http://www.kelticgames.com/index.php/2008/04/24/second-life-sound-issues/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 14:54:29 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[llLoopSound]]></category>
		<category><![CDATA[llPlaySound]]></category>
		<category><![CDATA[llTriggerSound]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[sl]]></category>
		<category><![CDATA[sound]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/04/24/second-life-sound-issues/</guid>
		<description><![CDATA[I&#8217;ve encountered an interesting limitation with sound in Second Life. You can only play a single sound from each script at any given time. If you have a script where you&#8217;d like to play a looping background sound and then play separate sounds based on events, you can&#8217;t. You are limited to a single sound [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve encountered an interesting limitation with sound in Second Life. You can only play a single sound from each script at any given time. If you have a script where you&#8217;d like to play a looping background sound and then play separate sounds based on events, you can&#8217;t. You are limited to a single sound playing at one time for each script. You can define whether additional sounds should cut-off and replace the current sound or should be queued to play after the current sound, but it&#8217;s only one at a time.Why the limitation? I could see limiting to 16, 8, or even 4 simultaneous sounds per script. If the concern is flooding the client with sounds, then that could be addressed by defining an overall limitation in the client, which I would hope exists already. This limitation simply forces anyone wishing to create a sound rich environment to create additional scripts for each sound. Inefficient.</p>
<p>Also, why are their separate functions for llPlaySound() and llLoopSound()? These should be a single function with an addition boolean parameter to define whether the clip loops. The same applies to llTriggerSound(). A boolean parameter defines whether the sound follows the prim it&#8217;s attached to or remains at the location it was created at. The new function could look like this, with the two new parameters (loop and follow) being optional and defaulting to false for backward compatibility.</p>
<p><code>llPlaySound(string sound, float volume, integer loop, integer follow)</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/04/24/second-life-sound-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Second Life Simple Data Storage</title>
		<link>http://www.kelticgames.com/index.php/2008/04/24/second-life-simple-data-storage/</link>
		<comments>http://www.kelticgames.com/index.php/2008/04/24/second-life-simple-data-storage/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 13:37:10 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[description]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[prim]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[sl]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/04/24/second-life-simple-data-storage/</guid>
		<description><![CDATA[In creating scripts for Second Life, I&#8217;ve tried to keep the scripts as portable and re-usable as possible. At the most basic level, this means creating a separation of code and data. For scripts that are used in a limited number of prims, this can be as simple as setting customizable variables at the top [...]]]></description>
			<content:encoded><![CDATA[<p>In creating scripts for Second Life, I&#8217;ve tried to keep the scripts as portable and re-usable as possible. At the most basic level, this means creating a separation of code and data. For scripts that are used in a limited number of prims, this can be as simple as setting customizable variables at the top of the script. For scripts that are going to be used in many prims, this system requires maintaining a unique copy of each script in each prim. If your base script is updated to fix a bug or add a feature, you&#8217;ll need to update each script by hand or overwrite the script in prim and reset the custom variables. Both options are prone to error.</p>
<p>For scripts used in many prims, storing the data for those variables in the prim&#8217;s description field can be an effective solution. This allows you to replace the script without impacting the custom data in each prim. The description field is limited to 127 characters, so this method is only useful with short length data. Also, since the description field can be publicly viewed in prim properties, this method should not be used to store private or sensitive data. On the plus side, this data can be updated dynamically using llSetObjectDesc().</p>
<p>When storing the value of a single variable in the description field, use this code to retrieve the value. If the type is anything other than a string, simply prefix the function with the data type. In this case, the variable type is a vector.</p>
<p><code>vector myVector; //declare variable type<br />
myVector = (vector)llGetObjectDesc(); //read the description, a string by default, and convert to a vector</code></p>
<p>If you need to store multiple values, format the data in the description field as a list, such as &#8220;Someplace;&lt;72,89,25&gt;&#8221;, read the data and parse it. This example uses the semi-colon as a delimiter.</p>
<p><code>list description;<br />
string locationName;<br />
vector locationTarget;</code></p>
<p><code>description = llParseString2List(llGetObjectDesc(), [";"], [""] );<br />
locationName = llList2String(description, 0);<br />
locationTarget = (vector)llList2String(description, 1);</code></p>
<p>I have found this method to be very effective and efficient for scripts that contain a limited amount of custom data. To store larger amounts of data, you&#8217;ll need to use a notecard or data store external to the prim.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/04/24/second-life-simple-data-storage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Second Life Phantom Collisions</title>
		<link>http://www.kelticgames.com/index.php/2008/04/15/second-life-phantom-collisions/</link>
		<comments>http://www.kelticgames.com/index.php/2008/04/15/second-life-phantom-collisions/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 14:35:41 +0000</pubDate>
		<dc:creator>Keltic</dc:creator>
				<category><![CDATA[Second Life]]></category>
		<category><![CDATA[chat]]></category>
		<category><![CDATA[collision]]></category>
		<category><![CDATA[collisions]]></category>
		<category><![CDATA[lsl]]></category>
		<category><![CDATA[phantom prim]]></category>
		<category><![CDATA[prims]]></category>

		<guid isPermaLink="false">http://www.kelticgames.com/index.php/2008/04/15/second-life-phantom-collisions/</guid>
		<description><![CDATA[I’ve been given the opportunity to do some coding for Second Life. Before I started, I was presented with a number of horror stories about the Linden Scripting Language (LSL). While it’s not as bad as a thought it might be, there are certainly some oddities, some due to the language itself and some due [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been given the opportunity to do some coding for Second Life. Before I started, I was presented with a number of horror stories about the Linden Scripting Language (LSL). While it’s not as bad as a thought it might be, there are certainly some oddities, some due to the language itself and some due to seemingly arbitrary limitations of the environment.</p>
<p>The first major issue that I ran into involved the detection of collisions with phantom prims. The project was a guided transportation system in which a vehicle would be provided a direction (vector) based on hidden prims that it collided with in the environment. The hidden prims providing the direction are transparent, so they cannot be seen in the environment. They are also phantom, since we didn’t want avatars blocked by invisible objects and becoming confused. However, no collision events (collision nor collision_start) are triggered in the vehicle. In this case, I’m using a vehicle, but the same applies to any prim or set of linked prims. By default, collisions with phantom objects are not detected by either object. Collisions can be detected by the phantom object with the inclusion of this function.</p>
<p><code>llVolumeDetect(TRUE);</code></p>
<p>However, this only allows collisions to be detected by the phantom prim and not by the vehicle that needs the information. The non-phantom prim will not detect collisions with phantom prims under any conditions. This meant that the vehicle pulling the new direction from the phantom prim was out of the question. Since the phantom prim could detect the collision, it must be the one to act.</p>
<p><code>	collision_start(integer total_number)<br />
{<br />
llWhisper(channelNumber, message);<br />
}</code></p>
<p>At the start of the collision, the phantom prim broadcasts the message on a non-0 channel. Using a non-0 channels helps to cut down on chat spam. In this case, I also used llWhisper, since the listening vehicle is moving slowly and will certainly be within 10 meters. llSay sends the message 20 meters, where it might be picked up by more vehicles.</p>
<p>In order to keep the chat to a minimum and ensure that only the vehicle involved in the collision acted upon the message, there are a number of other techniques used as well. The colliding objects all have the same name, so I can use a collision filter to ensure that only collisions with specifically named prims are detected.</p>
<p><code>llCollisionFilter(vehiclePrimName, NULL_KEY, TRUE);</code></p>
<p>While the collision event is fired continuously during the collision between two prims, the collision_start event is supposedly only fired once at the beginning of the collision. That certainly doesn’t appear to be the case, since collision_start is being fired multiples times as well. In order to limit this to a single event, get the key of the colliding object and only fire the event of the key is different from the last key. I also set a timer to clear the last key, so that future collisions with the same object will be effective, after 15 seconds in this case.</p>
<p><code>	collision_start(integer total_number)<br />
{<br />
currentKey = llDetectedKey(0);<br />
if ( currentKey != lastKey )<br />
{<br />
llWhisper(chatChannel, (string)currentKey + ";" + message);<br />
lastKey = currentKey;<br />
llSetTimerEvent(15);<br />
}<br />
}<br />
timer()<br />
{<br />
lastKey = NULL_KEY;<br />
llSetTimerEvent(0);<br />
}</code></p>
<p>On collision with a specifically named prim if there was no collision with that prim in the last 15 seconds, the message is whispered on a non-0 channel. Of course, you will need to ensure that the vehicle is listening for the message on the same channel. I also pass the key of the colliding object, so that any object receiving the message can validate the message was intended for it.</p>
<p>This solution is a bit of a kludge, but it produces the desired result.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kelticgames.com/index.php/2008/04/15/second-life-phantom-collisions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
