<?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>Tentacolor &#187; scripting</title>
	<atom:link href="http://tentacolor.com/tag/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://tentacolor.com</link>
	<description></description>
	<lastBuildDate>Mon, 14 May 2012 03:56:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Idea for new &#8216;error&#8217; LSL event.</title>
		<link>http://tentacolor.com/2008/03/25/idea-for-new-error-lsl-event/</link>
		<comments>http://tentacolor.com/2008/03/25/idea-for-new-error-lsl-event/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 01:01:03 +0000</pubDate>
		<dc:creator>Jacek Antonelli</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Feature Ideas]]></category>
		<category><![CDATA[Musings]]></category>
		<category><![CDATA[The Best of Tentacolor]]></category>
		<category><![CDATA[Wishes]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://tentacolor.com/2008/03/25/idea-for-new-error-lsl-event/</guid>
		<description><![CDATA[The problem: runtime error handling in LSL is&#8230; well, it&#8217;s practically nonexistant. If something goes wrong, the script will usually shout some message to the world and then die. The obvious problem there is that you have to then manually restart the script and lose all data! Also, for the security-concious, it can potentially reveal [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The problem:</strong> runtime error handling in LSL is&#8230; well, it&#8217;s practically nonexistant. If something goes wrong, the script will usually shout some message to the world and then die. The obvious problem there is that you have to then manually restart the script and lose all data! Also, for the security-concious, it can potentially reveal implementation details of your script.</p>
<p><strong>Idea:</strong> a new event in LSL, error, which would allow scripts to intercept and deal with error messages in a sane and consistent manner. Here&#8217;s an example:</p>
<p><code>
<pre>default
{
    state_entry()
    {
        integer a = 1/0;
    }

    error( integer type, string message )
    {
        if( type == ERROR_MATH )
        {
            llOwnerSay( message + "You should have paid more attention in math class." );
        }
    }
}</pre>
<p></code></p>
<p>The two parameters for the error event are the type, which is one of a selection of integer constants, and the message, which is a human-readable message describing what went wrong. In this case, the type is ERROR_MATH (indicating a math error), and the message would be something like &#8220;Error: Division by zero.&#8221;. The output from this script would be a message to the owner, &#8220;Error: Division by zero. You should have paid more attention in math class.&#8221;</p>
<p>Some more <em>useful</em> (and less insulting) ways of handling errors might be to reset the script, send an IM to an assistant shopkeep, clearing some buffers to free up memory, giving a custom message on chat, or some other appropriate behavior for that particular application. If the script doesn&#8217;t define the event block, errors are reported in the default way, as they are now (e.g. shouting the error on the debug channel).</p>
<p>To complement the new error event, would be a new function for triggering errors: llError( integer type, string message ). When called, it triggers an error of the given type, using the given message. If an error event block is defined, the error is given to that block to be handled; if there&#8217;s no block, it&#8217;s handled in the default manner for that event type.</p>
<p>A second new function would be llNoHandleError, which behaves like llError, except that it always performs the default handling, bypassing the error event block if it exists. This could also be used within the error event block to &#8220;pass through&#8221; event types that it&#8217;s not intended to handle.</p>
<p>So, scripters: give me some feedback on this. Should we make a JIRA for this, or is it actually a really stupid idea?</p>
]]></content:encoded>
			<wfw:commentRss>http://tentacolor.com/2008/03/25/idea-for-new-error-lsl-event/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Notecard Writing Nonsense</title>
		<link>http://tentacolor.com/2008/02/01/notecard-writing-nonsense/</link>
		<comments>http://tentacolor.com/2008/02/01/notecard-writing-nonsense/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 03:51:43 +0000</pubDate>
		<dc:creator>Jacek Antonelli</dc:creator>
				<category><![CDATA[Gripes]]></category>
		<category><![CDATA[LL policy woes]]></category>
		<category><![CDATA[Wishes]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://tentacolor.com/?p=233</guid>
		<description><![CDATA[Scripters (myself included) have long bemoaned the lack of any way to write text to a notecard. You can read text from a notecard (although it&#8217;s a PITA due to LL&#8217;s non-blocking dataserver lookup; and it&#8217;s also apparently not possible with notecards that have any embedded inventory items like landmarks), but there&#8217;s no way to [...]]]></description>
			<content:encoded><![CDATA[<p>Scripters (myself included) have long bemoaned the lack of any way to write text to a notecard. You can read text from a notecard (although it&#8217;s a PITA due to LL&#8217;s non-blocking dataserver lookup; and it&#8217;s also apparently not possible with notecards that have any embedded inventory items like landmarks), but there&#8217;s no way to write to it.  That means you can&#8217;t save script settings or data to a notecard so that they persist between script resets.</p>
<p>Scripters, being naturally clever folk, have instead relied on the fact that you can change an object&#8217;s name and description. So, just save the settings/data to the object&#8217;s description, and it&#8217;ll be there the next time the script runs! This was especially handy because the servers have previously allowed much longer descriptions to be saved than they were supposed to.</p>
<p>Of course, anyone who has been following the Linden Blog should now be aware that the name/description size limits <a href="http://blog.secondlife.com/2008/02/01/scripters-object-name-and-description-changes/">will now be enforced</a>. I won&#8217;t say much about that, except to note that this is another instance of &#8220;Very useful exploit-turned-essential-tool that occasionally caused problems, so the Lindens removed the tool rather than fixed the problems&#8221;. See also: Megaprims.</p>
<p>What I&#8217;m more interested in right now, is the excuses the Lindens give about why we&#8217;re not allowed to write to notecards. For example, <a href="http://blog.secondlife.com/2008/02/01/scripters-object-name-and-description-changes/#comment-582319">Prospero Linden wrote</a>:</p>
<blockquote cite="http://blog.secondlife.com/2008/02/01/scripters-object-name-and-description-changes/#comment-582319"><p>Re: storing persistent data : the way the asset sever works, a UUID is a unique identifier to an asset. If you change anything, it has to be a new asset– because if somebody else, say, had the same notecard before it was changed, you don’t want your edits to go to this other person’s notecard. It can happen that different people with the same object in their inventory in fact just point to the same UUID in the asset server. If you were to be able to write to a notecard from the script, *every* write command would create a new asset, which would create a load of additional problems.</p></blockquote>
<p><strong>I call bullshit.</strong></p>
<p><span id="more-233"></span></p>
<p>Assuming the technical description is accurate, it follows that every time you edit a notecard by hand, <em>you must already be creating a new asset</em>. Otherwise, as Prospero pointed out, giving a friend a notecard and then editing your own version of that notecard, would also change your friend&#8217;s version. (Which might be cool for collaborative efforts, but would otherwise be annoying.)</p>
<p>New notecard assets are already being created &#8217;round the clock as Residents write to-do lists, notes for a friend whose IMs get capped, configurations for notecard-reading scripts, and so on. In the time it took me to write that last sentence, I would guess that at least 20 new notecard assets have been created in SL, not to mention scripts, clothing, and more.</p>
<p>Sure, the asset server has plenty of problems already, but why does Prospero think notecard-writing scripts would lead to <em>additional</em> ones?</p>
<p>Perhaps he&#8217;s worried about the sheer volume of notecard-writes that could occur. Scripts could, presumably, work a lot faster than Residents can. A griefer could perform a Denial-of-Service attack on the asset servers, by sending out self-replicating, notecard-writing objects that would create hundreds of new notecards every second! Egads!</p>
<p>Well here&#8217;s a thought: <strong>Put a delay on it.</strong></p>
<p>You know why people don&#8217;t use SL scripts to send out massive amounts of spam email, despite the presence of an <a href="http://wiki.secondlife.com/wiki/LlEmail">llEmail</a> command? Because every call to llEmail pauses the script for 20 full seconds. Rather annoying if you have a legitimate reason to send emails from a script, but nonetheless an effective way of discouraging abuse.</p>
<p>Even a notecard-writing function with a 60 second delay would be infinitely more useful than having <em>nothing</em>.</p>
<p>And that&#8217;s all assuming Prospero (and other Lindens who have made similar statements) are right about how notecard-writing works. It seems like a rather silly system, of course, but it certainly wouldn&#8217;t be the first silly system to come out of Linden Lab. A more sensible system would, one might think, involve making a new asset only when one was required &mdash; that is, when a new or copied asset is created.</p>
<p>Such a natural and obvious solution would also eliminate any reason for the notecard-writing function to create a new asset every time it&#8217;s used. The prim with the script in it would already have a notecard; when that notecard was copied to the prim, a new asset would be created one time. All subsequent writes to that notecard would modify the same asset. If you wanted to copy the notecard out of the prim, that would create one more asset. It&#8217;s really quite simple!</p>
<p>On the other hand, it wouldn&#8217;t be as useful for testing if it&#8217;s actually possible to run out of these so-called &#8220;Universally Unique IDs&#8221;. ;)</p>
]]></content:encoded>
			<wfw:commentRss>http://tentacolor.com/2008/02/01/notecard-writing-nonsense/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

