<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Terk+Resident</id>
	<title>Second Life Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.secondlife.com/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Terk+Resident"/>
	<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/wiki/Special:Contributions/Terk_Resident"/>
	<updated>2026-07-28T17:25:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193227</id>
		<title>User talk:Terk Resident</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193227"/>
		<updated>2014-09-07T05:36:20Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* LSL style guide */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LSL style guide ==&lt;br /&gt;
&lt;br /&gt;
We decide long ago we were not going to refight the wars our father&#039;s faught. Instead of brother against brother we have decided the wiki is big enough for all of us. You are more than welcome to preach the gospel on your own userpage. Seeing that you have an interest on formatting we can always use help in making sure LSL Portal contributions fit one of the accepted white spacing schemes. We appreciate all the work you put into improving the article, but you have changed the the flavor of the article. I will, if I have time tomorrow work on restoring the more neutral tone of the article while at the same time keeping as much of your sizable contribution intact. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 19:54, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
Not really looking to fight about anything here.&lt;br /&gt;
It&#039;s just that the point of the wiki is to help new users and aspiring scripters look for a reference point of information which accurately documents the language. It&#039;s not a place to discuss the personal preferences in scripting styles. I&#039;m not some person out on a rampage demanding blood of all those who may format their scripts with an unconventional style, everyone has their own personal preferences. The wiki however is not the place to express those, or at the very least not on an LSL reference page. LSL is a derivative of C, and C based languages interpret code in what is represented with the Allman&#039;s style of formatting. That&#039;s just how C is. Heck, although K&amp;amp;R has it&#039;s roots in the old C manual itself, it even refers to that as being both overly complex for new programmers and a fertile breeding ground for code bugs. Surely you can understand that a documentation wiki tasked with introducing and teaching new users would not do well to be pushing a format that is strongly discouraged by the source documentation of the language LSL is based off?&lt;br /&gt;
Does that mean that anything other than that is less viable? Of course not. There are plenty of times where Obsfucated C can have it&#039;s purposes, but surely we can agree that place is not on an article helping new users approach their first steps into LSL and instead that&#039;s for discussion in personal groups or userpages.&lt;br /&gt;
K&amp;amp;R belongs on a wiki or documentation for JS based languages or in your personal scripting projects that aren&#039;t posted onto what is supposed to be a documentation for the language. [[User:Terk Resident|Terk Resident]] 20:30, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
If we are going to select any one single style, we would give preference to LL&#039;s preferred coding style, after all LL regularly hires from the community. SL is written in C++ and [[Coding_standard#Braces|LL uses a K&amp;amp;R derivative]]. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 22:05, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
But what you just linked me specifically says right there NOT to use the &amp;quot;more compact K&amp;amp;R standard&amp;quot;?&lt;br /&gt;
Am I misunderstanding you here? Because what you just linked is saying the same thing I was?&lt;br /&gt;
[http://i.gyazo.com/adbb7a07442a89a115ef3ea160696cde_1.png The exact section you linked me to]&lt;br /&gt;
But anyway, that&#039;s besides the point. Viewer Code != LSL Code. We&#039;re talking about LSL here, not what the viewer is programmed in. [[User:Terk Resident|Terk Resident]] 22:36, 6 September 2014 (PDT)&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193226</id>
		<title>User talk:Terk Resident</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193226"/>
		<updated>2014-09-07T05:34:11Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* LSL style guide */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LSL style guide ==&lt;br /&gt;
&lt;br /&gt;
We decide long ago we were not going to refight the wars our father&#039;s faught. Instead of brother against brother we have decided the wiki is big enough for all of us. You are more than welcome to preach the gospel on your own userpage. Seeing that you have an interest on formatting we can always use help in making sure LSL Portal contributions fit one of the accepted white spacing schemes. We appreciate all the work you put into improving the article, but you have changed the the flavor of the article. I will, if I have time tomorrow work on restoring the more neutral tone of the article while at the same time keeping as much of your sizable contribution intact. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 19:54, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
Not really looking to fight about anything here.&lt;br /&gt;
It&#039;s just that the point of the wiki is to help new users and aspiring scripters look for a reference point of information which accurately documents the language. It&#039;s not a place to discuss the personal preferences in scripting styles. I&#039;m not some person out on a rampage demanding blood of all those who may format their scripts with an unconventional style, everyone has their own personal preferences. The wiki however is not the place to express those, or at the very least not on an LSL reference page. LSL is a derivative of C, and C based languages interpret code in what is represented with the Allman&#039;s style of formatting. That&#039;s just how C is. Heck, although K&amp;amp;R has it&#039;s roots in the old C manual itself, it even refers to that as being both overly complex for new programmers and a fertile breeding ground for code bugs. Surely you can understand that a documentation wiki tasked with introducing and teaching new users would not do well to be pushing a format that is strongly discouraged by the source documentation of the language LSL is based off?&lt;br /&gt;
Does that mean that anything other than that is less viable? Of course not. There are plenty of times where Obsfucated C can have it&#039;s purposes, but surely we can agree that place is not on an article helping new users approach their first steps into LSL and instead that&#039;s for discussion in personal groups or userpages.&lt;br /&gt;
K&amp;amp;R belongs on a wiki or documentation for JS based languages or in your personal scripting projects that aren&#039;t posted onto what is supposed to be a documentation for the language. [[User:Terk Resident|Terk Resident]] 20:30, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
If we are going to select any one single style, we would give preference to LL&#039;s preferred coding style, after all LL regularly hires from the community. SL is written in C++ and [[Coding_standard#Braces|LL uses a K&amp;amp;R derivative]]. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 22:05, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
But what you just linked me specifically says right there NOT to use the &amp;quot;more compact K&amp;amp;R standard&amp;quot;?&lt;br /&gt;
Am I misunderstanding you here? Because what you just linked is saying the same thing I was?&lt;br /&gt;
[http://i.gyazo.com/adbb7a07442a89a115ef3ea160696cde_1.png The exact section you linked me to] [[User:Terk Resident|Terk Resident]] 22:34, 6 September 2014 (PDT)&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193225</id>
		<title>User talk:Terk Resident</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193225"/>
		<updated>2014-09-07T05:33:50Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* LSL style guide */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LSL style guide ==&lt;br /&gt;
&lt;br /&gt;
We decide long ago we were not going to refight the wars our father&#039;s faught. Instead of brother against brother we have decided the wiki is big enough for all of us. You are more than welcome to preach the gospel on your own userpage. Seeing that you have an interest on formatting we can always use help in making sure LSL Portal contributions fit one of the accepted white spacing schemes. We appreciate all the work you put into improving the article, but you have changed the the flavor of the article. I will, if I have time tomorrow work on restoring the more neutral tone of the article while at the same time keeping as much of your sizable contribution intact. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 19:54, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
Not really looking to fight about anything here.&lt;br /&gt;
It&#039;s just that the point of the wiki is to help new users and aspiring scripters look for a reference point of information which accurately documents the language. It&#039;s not a place to discuss the personal preferences in scripting styles. I&#039;m not some person out on a rampage demanding blood of all those who may format their scripts with an unconventional style, everyone has their own personal preferences. The wiki however is not the place to express those, or at the very least not on an LSL reference page. LSL is a derivative of C, and C based languages interpret code in what is represented with the Allman&#039;s style of formatting. That&#039;s just how C is. Heck, although K&amp;amp;R has it&#039;s roots in the old C manual itself, it even refers to that as being both overly complex for new programmers and a fertile breeding ground for code bugs. Surely you can understand that a documentation wiki tasked with introducing and teaching new users would not do well to be pushing a format that is strongly discouraged by the source documentation of the language LSL is based off?&lt;br /&gt;
Does that mean that anything other than that is less viable? Of course not. There are plenty of times where Obsfucated C can have it&#039;s purposes, but surely we can agree that place is not on an article helping new users approach their first steps into LSL and instead that&#039;s for discussion in personal groups or userpages.&lt;br /&gt;
K&amp;amp;R belongs on a wiki or documentation for JS based languages or in your personal scripting projects that aren&#039;t posted onto what is supposed to be a documentation for the language. [[User:Terk Resident|Terk Resident]] 20:30, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
If we are going to select any one single style, we would give preference to LL&#039;s preferred coding style, after all LL regularly hires from the community. SL is written in C++ and [[Coding_standard#Braces|LL uses a K&amp;amp;R derivative]]. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 22:05, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
But what you just linked me specifically says right there NOT to use the &amp;quot;more compact K&amp;amp;R standard&amp;quot;?&lt;br /&gt;
Am I misunderstanding you here? Because what you just linked is saying the same thing I was?&lt;br /&gt;
[http://i.gyazo.com/adbb7a07442a89a115ef3ea160696cde_1.png The exact section you linked me to]&lt;br /&gt;
 [[User:Terk Resident|Terk Resident]] 22:30, 6 September 2014 (PDT)&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193224</id>
		<title>User talk:Terk Resident</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193224"/>
		<updated>2014-09-07T05:32:52Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* LSL style guide */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LSL style guide ==&lt;br /&gt;
&lt;br /&gt;
We decide long ago we were not going to refight the wars our father&#039;s faught. Instead of brother against brother we have decided the wiki is big enough for all of us. You are more than welcome to preach the gospel on your own userpage. Seeing that you have an interest on formatting we can always use help in making sure LSL Portal contributions fit one of the accepted white spacing schemes. We appreciate all the work you put into improving the article, but you have changed the the flavor of the article. I will, if I have time tomorrow work on restoring the more neutral tone of the article while at the same time keeping as much of your sizable contribution intact. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 19:54, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
Not really looking to fight about anything here.&lt;br /&gt;
It&#039;s just that the point of the wiki is to help new users and aspiring scripters look for a reference point of information which accurately documents the language. It&#039;s not a place to discuss the personal preferences in scripting styles. I&#039;m not some person out on a rampage demanding blood of all those who may format their scripts with an unconventional style, everyone has their own personal preferences. The wiki however is not the place to express those, or at the very least not on an LSL reference page. LSL is a derivative of C, and C based languages interpret code in what is represented with the Allman&#039;s style of formatting. That&#039;s just how C is. Heck, although K&amp;amp;R has it&#039;s roots in the old C manual itself, it even refers to that as being both overly complex for new programmers and a fertile breeding ground for code bugs. Surely you can understand that a documentation wiki tasked with introducing and teaching new users would not do well to be pushing a format that is strongly discouraged by the source documentation of the language LSL is based off?&lt;br /&gt;
Does that mean that anything other than that is less viable? Of course not. There are plenty of times where Obsfucated C can have it&#039;s purposes, but surely we can agree that place is not on an article helping new users approach their first steps into LSL and instead that&#039;s for discussion in personal groups or userpages.&lt;br /&gt;
K&amp;amp;R belongs on a wiki or documentation for JS based languages or in your personal scripting projects that aren&#039;t posted onto what is supposed to be a documentation for the language. [[User:Terk Resident|Terk Resident]] 20:30, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
If we are going to select any one single style, we would give preference to LL&#039;s preferred coding style, after all LL regularly hires from the community. SL is written in C++ and [[Coding_standard#Braces|LL uses a K&amp;amp;R derivative]]. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 22:05, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
But what you just linked me specifically says right there NOT to use the &amp;quot;more compact K&amp;amp;R standard&amp;quot;?&lt;br /&gt;
Am I misunderstanding you here? Because what you just linked is saying the same thing I was?&lt;br /&gt;
[[File:http://i.gyazo.com/adbb7a07442a89a115ef3ea160696cde_1.png]] [[User:Terk Resident|Terk Resident]] 22:30, 6 September 2014 (PDT)&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193223</id>
		<title>User talk:Terk Resident</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193223"/>
		<updated>2014-09-07T05:30:12Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* LSL style guide */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LSL style guide ==&lt;br /&gt;
&lt;br /&gt;
We decide long ago we were not going to refight the wars our father&#039;s faught. Instead of brother against brother we have decided the wiki is big enough for all of us. You are more than welcome to preach the gospel on your own userpage. Seeing that you have an interest on formatting we can always use help in making sure LSL Portal contributions fit one of the accepted white spacing schemes. We appreciate all the work you put into improving the article, but you have changed the the flavor of the article. I will, if I have time tomorrow work on restoring the more neutral tone of the article while at the same time keeping as much of your sizable contribution intact. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 19:54, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
Not really looking to fight about anything here.&lt;br /&gt;
It&#039;s just that the point of the wiki is to help new users and aspiring scripters look for a reference point of information which accurately documents the language. It&#039;s not a place to discuss the personal preferences in scripting styles. I&#039;m not some person out on a rampage demanding blood of all those who may format their scripts with an unconventional style, everyone has their own personal preferences. The wiki however is not the place to express those, or at the very least not on an LSL reference page. LSL is a derivative of C, and C based languages interpret code in what is represented with the Allman&#039;s style of formatting. That&#039;s just how C is. Heck, although K&amp;amp;R has it&#039;s roots in the old C manual itself, it even refers to that as being both overly complex for new programmers and a fertile breeding ground for code bugs. Surely you can understand that a documentation wiki tasked with introducing and teaching new users would not do well to be pushing a format that is strongly discouraged by the source documentation of the language LSL is based off?&lt;br /&gt;
Does that mean that anything other than that is less viable? Of course not. There are plenty of times where Obsfucated C can have it&#039;s purposes, but surely we can agree that place is not on an article helping new users approach their first steps into LSL and instead that&#039;s for discussion in personal groups or userpages.&lt;br /&gt;
K&amp;amp;R belongs on a wiki or documentation for JS based languages or in your personal scripting projects that aren&#039;t posted onto what is supposed to be a documentation for the language. [[User:Terk Resident|Terk Resident]] 20:30, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
If we are going to select any one single style, we would give preference to LL&#039;s preferred coding style, after all LL regularly hires from the community. SL is written in C++ and [[Coding_standard#Braces|LL uses a K&amp;amp;R derivative]]. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 22:05, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
But what you just linked me specifically says right there NOT to use the &amp;quot;more compact K&amp;amp;R standard&amp;quot;? [[User:Terk Resident|Terk Resident]] 22:30, 6 September 2014 (PDT)&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193219</id>
		<title>User talk:Terk Resident</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193219"/>
		<updated>2014-09-07T04:05:25Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* LSL style guide */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LSL style guide ==&lt;br /&gt;
&lt;br /&gt;
We decide long ago we were not going to refight the wars our father&#039;s faught. Instead of brother against brother we have decided the wiki is big enough for all of us. You are more than welcome to preach the gospel on your own userpage. Seeing that you have an interest on formatting we can always use help in making sure LSL Portal contributions fit one of the accepted white spacing schemes. We appreciate all the work you put into improving the article, but you have changed the the flavor of the article. I will, if I have time tomorrow work on restoring the more neutral tone of the article while at the same time keeping as much of your sizable contribution intact. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 19:54, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
Not really looking to fight about anything here.&lt;br /&gt;
It&#039;s just that the point of the wiki is to help new users and aspiring scripters look for a reference point of information which accurately documents the language. It&#039;s not a place to discuss the personal preferences in scripting styles. I&#039;m not some person out on a rampage demanding blood of all those who may format their scripts with an unconventional style, everyone has their own personal preferences. The wiki however is not the place to express those, or at the very least not on an LSL reference page. LSL is a derivative of C, and C based languages interpret code in what is represented with the Allman&#039;s style of formatting. That&#039;s just how C is. Heck, although K&amp;amp;R has it&#039;s roots in the old C manual itself, it even refers to that as being both overly complex for new programmers and a fertile breeding ground for code bugs. Surely you can understand that a documentation wiki tasked with introducing and teaching new users would not do well to be pushing a format that is strongly discouraged by the source documentation of the language LSL is based off?&lt;br /&gt;
Does that mean that anything other than that is less viable? Of course not. There are plenty of times where Obsfucated C can have it&#039;s purposes, but surely we can agree that place is not on an article helping new users approach their first steps into LSL and instead that&#039;s for discussion in personal groups or userpages.&lt;br /&gt;
K&amp;amp;R belongs on a wiki or documentation for JS based languages or in your personal scripting projects that aren&#039;t posted onto what is supposed to be a documentation for the language. [[User:Terk Resident|Terk Resident]] 20:30, 6 September 2014 (PDT)&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193218</id>
		<title>User talk:Terk Resident</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=User_talk:Terk_Resident&amp;diff=1193218"/>
		<updated>2014-09-07T03:30:23Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* LSL style guide */ - Response to Strife&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== LSL style guide ==&lt;br /&gt;
&lt;br /&gt;
We decide long ago we were not going to refight the wars our father&#039;s faught. Instead of brother against brother we have decided the wiki is big enough for all of us. You are more than welcome to preach the gospel on your own userpage. Seeing that you have an interest on formatting we can always use help in making sure LSL Portal contributions fit one of the accepted white spacing schemes. We appreciate all the work you put into improving the article, but you have changed the the flavor of the article. I will, if I have time tomorrow work on restoring the more neutral tone of the article while at the same time keeping as much of your sizable contribution intact. -- &#039;&#039;&#039;[[User:Strife_Onizuka|Strife]]&#039;&#039;&#039; &amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;([[User talk:Strife_Onizuka|talk]]|[[Special:Contributions/Strife_Onizuka|contribs]])&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt; 19:54, 6 September 2014 (PDT)&lt;br /&gt;
&lt;br /&gt;
Not really looking to fight about anything here.&lt;br /&gt;
It&#039;s just that the point of the wiki is to help new users and aspiring scripters look for a reference point of information which accurately documents the language. It&#039;s not a place to discuss the personal preferences in scripting styles. I&#039;m not some person out on a rampage demanding blood of all those who may format their scripts with an unconventional style, everyone has their own personal preferences. The wiki however is not the place to express those, or at the very least not on an LSL reference page. LSL is a derivative of C, and C based languages interpret code in what is represented with the Allman&#039;s style of formatting. That&#039;s just how C is.&lt;br /&gt;
Does that mean that anything other than that is less viable? Of course not. There are plenty of times where Obsfucated C can have it&#039;s purposes, but surely we can agree that place is not on an article helping new users approach their first steps into LSL and instead that&#039;s for discussion in personal groups or userpages.&lt;br /&gt;
K&amp;amp;R belongs on a wiki or documentation for JS based languages or in your personal scripting projects that aren&#039;t posted onto what is supposed to be a documentation for the language. [[User:Terk Resident|Terk Resident]] 20:30, 6 September 2014 (PDT)&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193215</id>
		<title>LSL Style Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193215"/>
		<updated>2014-09-07T00:23:57Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: Fixing category internal links which didn&amp;#039;t appear as expected. Replaced with plaintext.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{RightToc}}&lt;br /&gt;
&lt;br /&gt;
Every major open-source project has its own style guide: a &#039;&#039;&#039;set of conventions&#039;&#039;&#039; (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a &#039;&#039;&#039;consistent style&#039;&#039;&#039;. These guidelines, referred to collectively as a Style Guide, are not as rigid as the rules required by the language compiler but nonetheless are critical to creating maintainable code. The most critical aspect of a style is that you apply it consistently to the code you write.&lt;br /&gt;
&lt;br /&gt;
Effective programming in [[LSL Portal|LSL]] requires that developers use a disciplined approach towards formatting and other conventions in their scripts.&lt;br /&gt;
&lt;br /&gt;
{{LSL Tip| Applying a style guide to your code does not only help others read your code. &#039;&#039;&#039;It helps you as well&#039;&#039;&#039;, because in future when you return to the code you wrote before, you&#039;ll appreciate reading formatted and annotated code.}}&lt;br /&gt;
&lt;br /&gt;
== Use third party editors: ==&lt;br /&gt;
&lt;br /&gt;
There are many [[LSL Alternate Editors|third party editors]] with [[LSL Portal|LSL]] syntax files available. See an example below of what your workflow would look like using an editor that has syntax highlighting and autocomplete and also applies an indent style to your code.&lt;br /&gt;
&lt;br /&gt;
[[File:Pareto_principle_scripting.gif|thumb|700px|center|Writing and fixing scripts takes time and effort. &#039;&#039;&#039;Readability is key to being more productive!&#039;&#039;&#039; [[LSL_Alternate_Editors|Alternate Editors do help, too.]] ]]&lt;br /&gt;
&lt;br /&gt;
You can see now, that using [[LSL Alternate Editors|third party editors]] has a few advantages over using the editor in the viewers:&lt;br /&gt;
* Autocompletion helps you avoid typos.&lt;br /&gt;
* Autocompletion sometimes not only does a linear autocompletion as in autocompleting &amp;lt;code&amp;gt;llS&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSay&amp;lt;/code&amp;gt; but sometimes works even with fuzzy search by autocompleting &amp;lt;code&amp;gt;llslppf&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSetLinkPrimitiveParamsFast&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The syntax highlighting file colors the code exactly like the code you see in the official Linden Lab viewer making you not having to learn or adapt to a different coloring scheme.&lt;br /&gt;
* Autocompletion might also preformat code with indent styles when autocompleting states, events, conditional clauses etc.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Indent_style Indent styles]: ==&lt;br /&gt;
&lt;br /&gt;
Most people, when they start programming on their own, will have programs that are UGLY to look at - to put it nicely, sometimes mistakenly thinking that such scripts occupy less space when compiled. Such scripts typically look like the following:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;unstyled source code&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;default {state_entry(){llSay(0,&amp;quot;Hello World.&amp;quot;);}}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
However, that code is difficult to read (or at least to &#039;&#039;&#039;follow&#039;&#039;&#039;) - even more so when one is writing a couple hundred lines program. There are several [http://en.wikipedia.org/wiki/Indent_style indent styles] which are seen throughout various programming languages which are used to make code more readable and easier to work with. LSL is a C based language and as such proper formatting makes use of the Allman style of code as seen below:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;[http://en.wikipedia.org/wiki/Indent_style#Allman_style Allman style] (used in C based languages)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;Hello World.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It should be noted that LSL is resilient and as such will compile even if an incorrect formatting style for the language is used so long as the syntax is correct. This can be useful if you are coming from another language such as JavaScript which makes use of K&amp;amp;R style formatting and can allow for an easier transition to coding in LSL. It is however, good practice to avoid using any other formatting styles other than Allman as doing so will result in code which is obsfucated and harder to read in terms of how LSL is interpreted with parenthesis&#039; and some operators. If good coding habits are important to you or if LSL is your first step into programming, it is strongly suggested you use Allman for your formatting style.&lt;br /&gt;
&lt;br /&gt;
== Naming conventions: ==&lt;br /&gt;
&lt;br /&gt;
There are many naming conventions in Second Life. Only the most used ones will be listed below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Global Variables (variables used through out the entire program) should be lowercase. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer index = 0;&lt;br /&gt;
string  name  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Others prefer to distinguish between global and local variables by prefixing variable names with a character, defining globals in the following manner:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer gIndex;&lt;br /&gt;
string  gName  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Constant variables should be in ALL CAPS following the style guide used by Linden Labs. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer DIALOG_CHANNEL = -517265;&lt;br /&gt;
vector  RED            = &amp;lt;1.0, 0.0, 0.0&amp;gt;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments used within a [[Category:LSL User-Defined Functions|user defined function]] or one of the standard [[Event|events]] should be named with &#039;&#039;&#039;easily readable and meaningful&#039;&#039;&#039; names. When using [[Event|events]], please use the standard names as listed here on the official wiki. An [[Event|overview of all events can be found here]]. Below is an example as can be found for the [[Listen|listen event]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//  ...&lt;br /&gt;
&lt;br /&gt;
    listen(integer channel, string name, key id, string message)&lt;br /&gt;
    {&lt;br /&gt;
        key OwnerKey = llGetOwner();&lt;br /&gt;
    &lt;br /&gt;
        if (channel == 1 &amp;amp;&amp;amp; id == OwnerKey)&lt;br /&gt;
            llOwnerSay(&amp;quot;Hello Avatar&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
//  ...&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Separating code: ==&lt;br /&gt;
Some people put too many function calls on one line. As shown in this example, too many function calls on a single line makes the code hard to read and almost impossible to debug.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    lst;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
    touch_start(integer n) {&lt;br /&gt;
        integer i;&lt;br /&gt;
        integer index = llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]);&lt;br /&gt;
        if (!~llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]))&lt;br /&gt;
            lst += llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1));&lt;br /&gt;
        llOwnerSay(llList2CSV(lst));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now here is the code, with the exact same features, in a simpler way. While hardly anyone could tell you what the above code did, almost everyone can figure out what the below code does.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    listOfStrings;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
    touch_start(integer n) &lt;br /&gt;
    {&lt;br /&gt;
        key     owner      = llGetOwner();&lt;br /&gt;
        key     id         = llDetectedKey(0);&lt;br /&gt;
        string  name       = llDetectedName(0);// or llKey2Name(id)&lt;br /&gt;
&lt;br /&gt;
        list    nameAsList = llParseString2List(name, [&amp;quot; &amp;quot;], []);&lt;br /&gt;
        string  firstName  = llList2String(nameAsList, 0);&lt;br /&gt;
        string  startPart  = llToLower(llGetSubString(firstName, 0, numDigits - 1));&lt;br /&gt;
        integer index      = llListFindList(listOfStrings, [startPart]);&lt;br /&gt;
&lt;br /&gt;
//      if index is equal to -1&lt;br /&gt;
        if (index == ERR_GENERIC)&lt;br /&gt;
            listOfStrings += startPart;&lt;br /&gt;
&lt;br /&gt;
//      send a message to the owner, only reaches owner if online and within the same sim&lt;br /&gt;
        llRegionSayTo(owner, PUBLIC_CHANNEL, llList2CSV(listOfStrings));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LSL lacks an optimizing compiler. For this reason it may be necessary to balance the two style to get faster, more compact executable code. Line combination optimization should only be done after the code is working &amp;amp; bug free. Improper optimization can lead to wrong results. Always test optimized code thoroughly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Script Structure==&lt;br /&gt;
LSL scripts are comprised of expressions, functions, statements, event handlers and states. The LSL compiler mandates a certain structure to scripts:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== [[LSL_Variables|Global Variables]] ====&lt;br /&gt;
&lt;br /&gt;
Global variables define and can contain data which can be written to or read from in multiple events and states within a script.&lt;br /&gt;
Here&#039;s an example of a simple script which uses global variables to store information in a state_entry event and allow it to be used in a second touch event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey; //Here we start by defining a global variable by the name of &amp;quot;ownerkey&amp;quot; and specify that it stores a key (UUID)&lt;br /&gt;
&lt;br /&gt;
string ownername; //Next we define another global variable which stores the username of the owner of the prim containing this script and specify it is storing a string&lt;br /&gt;
&lt;br /&gt;
integer reportonchannel = 0; //In this case we are defining a global variable which stores the numerical channel we will be using later, but in this case we give it a value at the start. &lt;br /&gt;
//As with the last 2, this can be written to but will revert to the specified value when the script is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when entering the default state (When the script first runs or if moving to the default state from a user state)&lt;br /&gt;
	{&lt;br /&gt;
		ownerkey = llGetOwner(); //Stores the key of the owner of the prim containing this script to the &amp;quot;key ownerkey&amp;quot; global variable&lt;br /&gt;
		&lt;br /&gt;
		ownername = llGetUsername(ownerkey); //Here we use that newly stored key to find the username of the account associated with the key in &amp;quot;key ownerkey&amp;quot;&lt;br /&gt;
		//Note that since we have already defined ownerkey and ownername as a key and string respectively, we do not need to specify what type of data they store, unlike local variables&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected) //This event is triggered when someone click the prim this script contains (If it&#039;s on click action is set to touch in the build floater)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey; //Let&#039;s prepare the key for use in a chat message. llSay requires strings but ownerkey is currently a string. &lt;br /&gt;
		//Note that this is an inefficent method of preparing data stored in a variable to another type of data. &lt;br /&gt;
		//Typically this would be done with typecasting in the intended function it is to be used in, but for the purpose of keeping this example easy to follow, I&#039;ll use this method.&lt;br /&gt;
		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
		//When clicked, the prim will speak on the channel specified in &amp;quot;integer reportonchannel&amp;quot; and say the information we found in the previous event.&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[User-defined_functions|User Defined Functions]] ====&lt;br /&gt;
&lt;br /&gt;
[[User-defined_functions|User defined functions]] follow imediatly after global variables in a script and before the default state. [[User-defined_functions|User Defined Functions]] allow for chunks of code that are repeated often throughout a script to be replaced with a one line function that acts in the same way as standard functions (Linden Library Functions).&lt;br /&gt;
These are useful when you want to keep your script bloat to a minimum by only having to write that chunk a single time and substitute other instances of it with a single easy line throughout the script.&lt;br /&gt;
Here&#039;s an example of our earlier script, this time making use of a custom function to replace the functions seen in our state_entry event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey;&lt;br /&gt;
string ownername;&lt;br /&gt;
integer reportonchannel = 0;&lt;br /&gt;
&lt;br /&gt;
RetrieveOwnerData() //Here we create the user-defined function with the name &amp;quot;RetrieveOwnerData&amp;quot;.&lt;br /&gt;
{&lt;br /&gt;
	ownerkey = llGetOwner(); &lt;br /&gt;
	ownername = llGetUsername(ownerkey);&lt;br /&gt;
	//Notice how we took the contents of our earlier state_entry() and placed it in a function.&lt;br /&gt;
	//When the new function is called, this code will be ran.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		RetrieveOwnerData(); //Here we call the function just like we would a normal LL function.&lt;br /&gt;
		//Using a user-defined variable only once in a script is inefficient and shouldn&#039;t be used in place of just putting the code in normally if not being used multiple times.&lt;br /&gt;
		//As for the point at which you deem it necessary? That&#039;s personal preference, but personally I go with if I am repeating code 3 or more times in a script.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey;		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[default|Default State]] ====&lt;br /&gt;
Next up we create our first [[state]]. This comes after user-defined functions and global variables.&lt;br /&gt;
In LSL, a state refers to a the container of events that trigger functions in the script. A script when it first starts will always exist in the initial [[default]] state which is a prerequisite for any LSL script. Scripts can contain multiple states, but only one can be active at any one time and only events that are handled in the active state will trigger functions in the script. A state can only contain one of each event handler (such as [[touch_start|Touch_start]] or [[state_entry|State_entry]]).&lt;br /&gt;
See below for an example of a simple script which says hello when clicked for an example of the default state:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default //All LSL scripts must contain a state named &amp;quot;default&amp;quot; and this must be the first state defined in your script.&lt;br /&gt;
{&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[state|User-Defined States]] ====&lt;br /&gt;
Lastly, we include any additional states we want in a script. User-Defined states allow for multiple instances of an event handler while effectively turning off other undesired events.&lt;br /&gt;
It should be noted that in most cases, you would want to use [http://lslwiki.net/lslwiki/wakka.php?wakka=condition conditionals] or [[Timer|timers]] in place of a state but the occasional use still does show up time to time.&lt;br /&gt;
Below is our previous script used in the default state example with a user-defined state added.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked!&amp;quot;);&lt;br /&gt;
		state two; // This instructs the script to switch to &amp;quot;state two&amp;quot; and stop processing events in the default state.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
state two&lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the second state!&amp;quot;);&lt;br /&gt;
		state default; // This instructs the script to switch back to the default state and stop processing events in &amp;quot;state two&amp;quot;.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take great care when changing states in a script! Changing a state during an if or some loops can have adverse effects! Make sure to read up on [[state|states]] for more information.&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193214</id>
		<title>LSL Style Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193214"/>
		<updated>2014-09-07T00:13:05Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: Accidentally wiped the page with last edit. Fixed it and included the intended edit. Sorry!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{RightToc}}&lt;br /&gt;
&lt;br /&gt;
Every major open-source project has its own style guide: a &#039;&#039;&#039;set of conventions&#039;&#039;&#039; (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a &#039;&#039;&#039;consistent style&#039;&#039;&#039;. These guidelines, referred to collectively as a Style Guide, are not as rigid as the rules required by the language compiler but nonetheless are critical to creating maintainable code. The most critical aspect of a style is that you apply it consistently to the code you write.&lt;br /&gt;
&lt;br /&gt;
Effective programming in [[LSL Portal|LSL]] requires that developers use a disciplined approach towards formatting and other conventions in their scripts.&lt;br /&gt;
&lt;br /&gt;
{{LSL Tip| Applying a style guide to your code does not only help others read your code. &#039;&#039;&#039;It helps you as well&#039;&#039;&#039;, because in future when you return to the code you wrote before, you&#039;ll appreciate reading formatted and annotated code.}}&lt;br /&gt;
&lt;br /&gt;
== Use third party editors: ==&lt;br /&gt;
&lt;br /&gt;
There are many [[LSL Alternate Editors|third party editors]] with [[LSL Portal|LSL]] syntax files available. See an example below of what your workflow would look like using an editor that has syntax highlighting and autocomplete and also applies an indent style to your code.&lt;br /&gt;
&lt;br /&gt;
[[File:Pareto_principle_scripting.gif|thumb|700px|center|Writing and fixing scripts takes time and effort. &#039;&#039;&#039;Readability is key to being more productive!&#039;&#039;&#039; [[LSL_Alternate_Editors|Alternate Editors do help, too.]] ]]&lt;br /&gt;
&lt;br /&gt;
You can see now, that using [[LSL Alternate Editors|third party editors]] has a few advantages over using the editor in the viewers:&lt;br /&gt;
* Autocompletion helps you avoid typos.&lt;br /&gt;
* Autocompletion sometimes not only does a linear autocompletion as in autocompleting &amp;lt;code&amp;gt;llS&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSay&amp;lt;/code&amp;gt; but sometimes works even with fuzzy search by autocompleting &amp;lt;code&amp;gt;llslppf&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSetLinkPrimitiveParamsFast&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The syntax highlighting file colors the code exactly like the code you see in the official Linden Lab viewer making you not having to learn or adapt to a different coloring scheme.&lt;br /&gt;
* Autocompletion might also preformat code with indent styles when autocompleting states, events, conditional clauses etc.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Indent_style Indent styles]: ==&lt;br /&gt;
&lt;br /&gt;
Most people, when they start programming on their own, will have programs that are UGLY to look at - to put it nicely, sometimes mistakenly thinking that such scripts occupy less space when compiled. Such scripts typically look like the following:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;unstyled source code&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;default {state_entry(){llSay(0,&amp;quot;Hello World.&amp;quot;);}}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
However, that code is difficult to read (or at least to &#039;&#039;&#039;follow&#039;&#039;&#039;) - even more so when one is writing a couple hundred lines program. There are several [http://en.wikipedia.org/wiki/Indent_style indent styles] which are seen throughout various programming languages which are used to make code more readable and easier to work with. LSL is a C based language and as such proper formatting makes use of the Allman style of code as seen below:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;[http://en.wikipedia.org/wiki/Indent_style#Allman_style Allman style] (used in C based languages)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;Hello World.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It should be noted that LSL is resilient and as such will compile even if an incorrect formatting style for the language is used so long as the syntax is correct. This can be useful if you are coming from another language such as JavaScript which makes use of K&amp;amp;R style formatting and can allow for an easier transition to coding in LSL. It is however, good practice to avoid using any other formatting styles other than Allman as doing so will result in code which is obsfucated and harder to read in terms of how LSL is interpreted with parenthesis&#039; and some operators. If good coding habits are important to you or if LSL is your first step into programming, it is strongly suggested you use Allman for your formatting style.&lt;br /&gt;
&lt;br /&gt;
== Naming conventions: ==&lt;br /&gt;
&lt;br /&gt;
There are many naming conventions in Second Life. Only the most used ones will be listed below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Global Variables (variables used through out the entire program) should be lowercase. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer index = 0;&lt;br /&gt;
string  name  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Others prefer to distinguish between global and local variables by prefixing variable names with a character, defining globals in the following manner:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer gIndex;&lt;br /&gt;
string  gName  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Constant variables should be in ALL CAPS following the style guide used by Linden Labs. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer DIALOG_CHANNEL = -517265;&lt;br /&gt;
vector  RED            = &amp;lt;1.0, 0.0, 0.0&amp;gt;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments used within a [[Category:LSL User-Defined Functions|user defined function]] or one of the standard [[Event|events]] should be named with &#039;&#039;&#039;easily readable and meaningful&#039;&#039;&#039; names. When using [[Event|events]], please use the standard names as listed here on the official wiki. An [[Event|overview of all events can be found here]]. Below is an example as can be found for the [[Listen|listen event]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//  ...&lt;br /&gt;
&lt;br /&gt;
    listen(integer channel, string name, key id, string message)&lt;br /&gt;
    {&lt;br /&gt;
        key OwnerKey = llGetOwner();&lt;br /&gt;
    &lt;br /&gt;
        if (channel == 1 &amp;amp;&amp;amp; id == OwnerKey)&lt;br /&gt;
            llOwnerSay(&amp;quot;Hello Avatar&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
//  ...&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Separating code: ==&lt;br /&gt;
Some people put too many function calls on one line. As shown in this example, too many function calls on a single line makes the code hard to read and almost impossible to debug.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    lst;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
    touch_start(integer n) {&lt;br /&gt;
        integer i;&lt;br /&gt;
        integer index = llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]);&lt;br /&gt;
        if (!~llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]))&lt;br /&gt;
            lst += llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1));&lt;br /&gt;
        llOwnerSay(llList2CSV(lst));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now here is the code, with the exact same features, in a simpler way. While hardly anyone could tell you what the above code did, almost everyone can figure out what the below code does.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    listOfStrings;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
    touch_start(integer n) &lt;br /&gt;
    {&lt;br /&gt;
        key     owner      = llGetOwner();&lt;br /&gt;
        key     id         = llDetectedKey(0);&lt;br /&gt;
        string  name       = llDetectedName(0);// or llKey2Name(id)&lt;br /&gt;
&lt;br /&gt;
        list    nameAsList = llParseString2List(name, [&amp;quot; &amp;quot;], []);&lt;br /&gt;
        string  firstName  = llList2String(nameAsList, 0);&lt;br /&gt;
        string  startPart  = llToLower(llGetSubString(firstName, 0, numDigits - 1));&lt;br /&gt;
        integer index      = llListFindList(listOfStrings, [startPart]);&lt;br /&gt;
&lt;br /&gt;
//      if index is equal to -1&lt;br /&gt;
        if (index == ERR_GENERIC)&lt;br /&gt;
            listOfStrings += startPart;&lt;br /&gt;
&lt;br /&gt;
//      send a message to the owner, only reaches owner if online and within the same sim&lt;br /&gt;
        llRegionSayTo(owner, PUBLIC_CHANNEL, llList2CSV(listOfStrings));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LSL lacks an optimizing compiler. For this reason it may be necessary to balance the two style to get faster, more compact executable code. Line combination optimization should only be done after the code is working &amp;amp; bug free. Improper optimization can lead to wrong results. Always test optimized code thoroughly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Script Structure==&lt;br /&gt;
LSL scripts are comprised of expressions, functions, statements, event handlers and states. The LSL compiler mandates a certain structure to scripts:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== [[LSL_Variables|Global Variables]] ====&lt;br /&gt;
&lt;br /&gt;
Global variables define and can contain data which can be written to or read from in multiple events and states within a script.&lt;br /&gt;
Here&#039;s an example of a simple script which uses global variables to store information in a state_entry event and allow it to be used in a second touch event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey; //Here we start by defining a global variable by the name of &amp;quot;ownerkey&amp;quot; and specify that it stores a key (UUID)&lt;br /&gt;
&lt;br /&gt;
string ownername; //Next we define another global variable which stores the username of the owner of the prim containing this script and specify it is storing a string&lt;br /&gt;
&lt;br /&gt;
integer reportonchannel = 0; //In this case we are defining a global variable which stores the numerical channel we will be using later, but in this case we give it a value at the start. &lt;br /&gt;
//As with the last 2, this can be written to but will revert to the specified value when the script is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when entering the default state (When the script first runs or if moving to the default state from a user state)&lt;br /&gt;
	{&lt;br /&gt;
		ownerkey = llGetOwner(); //Stores the key of the owner of the prim containing this script to the &amp;quot;key ownerkey&amp;quot; global variable&lt;br /&gt;
		&lt;br /&gt;
		ownername = llGetUsername(ownerkey); //Here we use that newly stored key to find the username of the account associated with the key in &amp;quot;key ownerkey&amp;quot;&lt;br /&gt;
		//Note that since we have already defined ownerkey and ownername as a key and string respectively, we do not need to specify what type of data they store, unlike local variables&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected) //This event is triggered when someone click the prim this script contains (If it&#039;s on click action is set to touch in the build floater)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey; //Let&#039;s prepare the key for use in a chat message. llSay requires strings but ownerkey is currently a string. &lt;br /&gt;
		//Note that this is an inefficent method of preparing data stored in a variable to another type of data. &lt;br /&gt;
		//Typically this would be done with typecasting in the intended function it is to be used in, but for the purpose of keeping this example easy to follow, I&#039;ll use this method.&lt;br /&gt;
		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
		//When clicked, the prim will speak on the channel specified in &amp;quot;integer reportonchannel&amp;quot; and say the information we found in the previous event.&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[User-defined_functions|User Defined Functions]] ====&lt;br /&gt;
&lt;br /&gt;
[[User-defined_functions|User defined functions]] follow imediatly after global variables in a script and before the default state. [[User-defined_functions|User Defined Functions]] allow for chunks of code that are repeated often throughout a script to be replaced with a one line function that acts in the same way as standard functions (Linden Library Functions).&lt;br /&gt;
These are useful when you want to keep your script bloat to a minimum by only having to write that chunk a single time and substitute other instances of it with a single easy line throughout the script.&lt;br /&gt;
Here&#039;s an example of our earlier script, this time making use of a custom function to replace the functions seen in our state_entry event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey;&lt;br /&gt;
string ownername;&lt;br /&gt;
integer reportonchannel = 0;&lt;br /&gt;
&lt;br /&gt;
RetrieveOwnerData() //Here we create the user-defined function with the name &amp;quot;RetrieveOwnerData&amp;quot;.&lt;br /&gt;
{&lt;br /&gt;
	ownerkey = llGetOwner(); &lt;br /&gt;
	ownername = llGetUsername(ownerkey);&lt;br /&gt;
	//Notice how we took the contents of our earlier state_entry() and placed it in a function.&lt;br /&gt;
	//When the new function is called, this code will be ran.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		RetrieveOwnerData(); //Here we call the function just like we would a normal LL function.&lt;br /&gt;
		//Using a user-defined variable only once in a script is inefficient and shouldn&#039;t be used in place of just putting the code in normally if not being used multiple times.&lt;br /&gt;
		//As for the point at which you deem it necessary? That&#039;s personal preference, but personally I go with if I am repeating code 3 or more times in a script.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey;		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[default|Default State]] ====&lt;br /&gt;
Next up we create our first [[state]]. This comes after user-defined functions and global variables.&lt;br /&gt;
In LSL, a state refers to a the container of events that trigger functions in the script. A script when it first starts will always exist in the initial [[default]] state which is a prerequisite for any LSL script. Scripts can contain multiple states, but only one can be active at any one time and only events that are handled in the active state will trigger functions in the script. A state can only contain one of each [[Category:LSL_Events|event handler]] (such as [[touch_start|Touch_start]] or [[state_entry|State_entry]]).&lt;br /&gt;
See below for an example of a simple script which says hello when clicked for an example of the default state:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default //All LSL scripts must contain a state named &amp;quot;default&amp;quot; and this must be the first state defined in your script.&lt;br /&gt;
{&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[state|User-Defined States]] ====&lt;br /&gt;
Lastly, we include any additional states we want in a script. User-Defined states allow for multiple instances of an [[Category:LSL_Events|event handler]] while effectively turning off other undesired events.&lt;br /&gt;
It should be noted that in most cases, you would want to use [http://lslwiki.net/lslwiki/wakka.php?wakka=condition conditionals] or [[Timer|timers]] in place of a state but the occasional use still does show up time to time.&lt;br /&gt;
Below is our previous script used in the default state example with a user-defined state added.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked!&amp;quot;);&lt;br /&gt;
		state two; // This instructs the script to switch to &amp;quot;state two&amp;quot; and stop processing events in the default state.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
state two&lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the second state!&amp;quot;);&lt;br /&gt;
		state default; // This instructs the script to switch back to the default state and stop processing events in &amp;quot;state two&amp;quot;.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take great care when changing states in a script! Changing a state during an if or some loops can have adverse effects! Make sure to read up on [[state|states]] for more information.&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193213</id>
		<title>LSL Style Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193213"/>
		<updated>2014-09-07T00:09:02Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* User-Defined States */ Nope. Actually fixing it now. Note to self - use show preview and don&amp;#039;t just assume an edit fixed the issue.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Script Structure==&lt;br /&gt;
LSL scripts are comprised of expressions, functions, statements, event handlers and states. The LSL compiler mandates a certain structure to scripts:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== [[LSL_Variables|Global Variables]] ====&lt;br /&gt;
&lt;br /&gt;
Global variables define and can contain data which can be written to or read from in multiple events and states within a script.&lt;br /&gt;
Here&#039;s an example of a simple script which uses global variables to store information in a state_entry event and allow it to be used in a second touch event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey; //Here we start by defining a global variable by the name of &amp;quot;ownerkey&amp;quot; and specify that it stores a key (UUID)&lt;br /&gt;
&lt;br /&gt;
string ownername; //Next we define another global variable which stores the username of the owner of the prim containing this script and specify it is storing a string&lt;br /&gt;
&lt;br /&gt;
integer reportonchannel = 0; //In this case we are defining a global variable which stores the numerical channel we will be using later, but in this case we give it a value at the start. &lt;br /&gt;
//As with the last 2, this can be written to but will revert to the specified value when the script is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when entering the default state (When the script first runs or if moving to the default state from a user state)&lt;br /&gt;
	{&lt;br /&gt;
		ownerkey = llGetOwner(); //Stores the key of the owner of the prim containing this script to the &amp;quot;key ownerkey&amp;quot; global variable&lt;br /&gt;
		&lt;br /&gt;
		ownername = llGetUsername(ownerkey); //Here we use that newly stored key to find the username of the account associated with the key in &amp;quot;key ownerkey&amp;quot;&lt;br /&gt;
		//Note that since we have already defined ownerkey and ownername as a key and string respectively, we do not need to specify what type of data they store, unlike local variables&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected) //This event is triggered when someone click the prim this script contains (If it&#039;s on click action is set to touch in the build floater)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey; //Let&#039;s prepare the key for use in a chat message. llSay requires strings but ownerkey is currently a string. &lt;br /&gt;
		//Note that this is an inefficent method of preparing data stored in a variable to another type of data. &lt;br /&gt;
		//Typically this would be done with typecasting in the intended function it is to be used in, but for the purpose of keeping this example easy to follow, I&#039;ll use this method.&lt;br /&gt;
		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
		//When clicked, the prim will speak on the channel specified in &amp;quot;integer reportonchannel&amp;quot; and say the information we found in the previous event.&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[User-defined_functions|User Defined Functions]] ====&lt;br /&gt;
&lt;br /&gt;
[[User-defined_functions|User defined functions]] follow imediatly after global variables in a script and before the default state. [[User-defined_functions|User Defined Functions]] allow for chunks of code that are repeated often throughout a script to be replaced with a one line function that acts in the same way as standard functions (Linden Library Functions).&lt;br /&gt;
These are useful when you want to keep your script bloat to a minimum by only having to write that chunk a single time and substitute other instances of it with a single easy line throughout the script.&lt;br /&gt;
Here&#039;s an example of our earlier script, this time making use of a custom function to replace the functions seen in our state_entry event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey;&lt;br /&gt;
string ownername;&lt;br /&gt;
integer reportonchannel = 0;&lt;br /&gt;
&lt;br /&gt;
RetrieveOwnerData() //Here we create the user-defined function with the name &amp;quot;RetrieveOwnerData&amp;quot;.&lt;br /&gt;
{&lt;br /&gt;
	ownerkey = llGetOwner(); &lt;br /&gt;
	ownername = llGetUsername(ownerkey);&lt;br /&gt;
	//Notice how we took the contents of our earlier state_entry() and placed it in a function.&lt;br /&gt;
	//When the new function is called, this code will be ran.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		RetrieveOwnerData(); //Here we call the function just like we would a normal LL function.&lt;br /&gt;
		//Using a user-defined variable only once in a script is inefficient and shouldn&#039;t be used in place of just putting the code in normally if not being used multiple times.&lt;br /&gt;
		//As for the point at which you deem it necessary? That&#039;s personal preference, but personally I go with if I am repeating code 3 or more times in a script.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey;		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[default|Default State]] ====&lt;br /&gt;
Next up we create our first [[state]]. This comes after user-defined functions and global variables.&lt;br /&gt;
In LSL, a state refers to a the container of events that trigger functions in the script. A script when it first starts will always exist in the initial [[default]] state which is a prerequisite for any LSL script. Scripts can contain multiple states, but only one can be active at any one time and only events that are handled in the active state will trigger functions in the script. A state can only contain one of each [[Category:LSL_Events|event handler]] (such as [[touch_start|Touch_start]] or [[state_entry|State_entry]]).&lt;br /&gt;
See below for an example of a simple script which says hello when clicked for an example of the default state:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default //All LSL scripts must contain a state named &amp;quot;default&amp;quot; and this must be the first state defined in your script.&lt;br /&gt;
{&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[state|User-Defined States]] ====&lt;br /&gt;
Lastly, we include any additional states we want in a script. User-Defined states allow for multiple instances of an [[Category:LSL_Events|event handler]] while effectively turning off other undesired events.&lt;br /&gt;
It should be noted that in most cases, you would want to use [http://lslwiki.net/lslwiki/wakka.php?wakka=condition conditionals] or [[Timer|timers]] in place of a state but the occasional use still does show up time to time.&lt;br /&gt;
Below is our previous script used in the default state example with a user-defined state added.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked!&amp;quot;);&lt;br /&gt;
		state two; // This instructs the script to switch to &amp;quot;state two&amp;quot; and stop processing events in the default state.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
state two&lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the second state!&amp;quot;);&lt;br /&gt;
		state default; // This instructs the script to switch back to the default state and stop processing events in &amp;quot;state two&amp;quot;.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take great care when changing states in a script! Changing a state during an if or some loops can have adverse effects! Make sure to read up on [[state|states]] for more information.&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193212</id>
		<title>LSL Style Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193212"/>
		<updated>2014-09-07T00:05:39Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: Fixing a derp on the internal link to the conditionals category.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Script Structure==&lt;br /&gt;
LSL scripts are comprised of expressions, functions, statements, event handlers and states. The LSL compiler mandates a certain structure to scripts:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== [[LSL_Variables|Global Variables]] ====&lt;br /&gt;
&lt;br /&gt;
Global variables define and can contain data which can be written to or read from in multiple events and states within a script.&lt;br /&gt;
Here&#039;s an example of a simple script which uses global variables to store information in a state_entry event and allow it to be used in a second touch event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey; //Here we start by defining a global variable by the name of &amp;quot;ownerkey&amp;quot; and specify that it stores a key (UUID)&lt;br /&gt;
&lt;br /&gt;
string ownername; //Next we define another global variable which stores the username of the owner of the prim containing this script and specify it is storing a string&lt;br /&gt;
&lt;br /&gt;
integer reportonchannel = 0; //In this case we are defining a global variable which stores the numerical channel we will be using later, but in this case we give it a value at the start. &lt;br /&gt;
//As with the last 2, this can be written to but will revert to the specified value when the script is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when entering the default state (When the script first runs or if moving to the default state from a user state)&lt;br /&gt;
	{&lt;br /&gt;
		ownerkey = llGetOwner(); //Stores the key of the owner of the prim containing this script to the &amp;quot;key ownerkey&amp;quot; global variable&lt;br /&gt;
		&lt;br /&gt;
		ownername = llGetUsername(ownerkey); //Here we use that newly stored key to find the username of the account associated with the key in &amp;quot;key ownerkey&amp;quot;&lt;br /&gt;
		//Note that since we have already defined ownerkey and ownername as a key and string respectively, we do not need to specify what type of data they store, unlike local variables&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected) //This event is triggered when someone click the prim this script contains (If it&#039;s on click action is set to touch in the build floater)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey; //Let&#039;s prepare the key for use in a chat message. llSay requires strings but ownerkey is currently a string. &lt;br /&gt;
		//Note that this is an inefficent method of preparing data stored in a variable to another type of data. &lt;br /&gt;
		//Typically this would be done with typecasting in the intended function it is to be used in, but for the purpose of keeping this example easy to follow, I&#039;ll use this method.&lt;br /&gt;
		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
		//When clicked, the prim will speak on the channel specified in &amp;quot;integer reportonchannel&amp;quot; and say the information we found in the previous event.&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[User-defined_functions|User Defined Functions]] ====&lt;br /&gt;
&lt;br /&gt;
[[User-defined_functions|User defined functions]] follow imediatly after global variables in a script and before the default state. [[User-defined_functions|User Defined Functions]] allow for chunks of code that are repeated often throughout a script to be replaced with a one line function that acts in the same way as standard functions (Linden Library Functions).&lt;br /&gt;
These are useful when you want to keep your script bloat to a minimum by only having to write that chunk a single time and substitute other instances of it with a single easy line throughout the script.&lt;br /&gt;
Here&#039;s an example of our earlier script, this time making use of a custom function to replace the functions seen in our state_entry event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey;&lt;br /&gt;
string ownername;&lt;br /&gt;
integer reportonchannel = 0;&lt;br /&gt;
&lt;br /&gt;
RetrieveOwnerData() //Here we create the user-defined function with the name &amp;quot;RetrieveOwnerData&amp;quot;.&lt;br /&gt;
{&lt;br /&gt;
	ownerkey = llGetOwner(); &lt;br /&gt;
	ownername = llGetUsername(ownerkey);&lt;br /&gt;
	//Notice how we took the contents of our earlier state_entry() and placed it in a function.&lt;br /&gt;
	//When the new function is called, this code will be ran.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		RetrieveOwnerData(); //Here we call the function just like we would a normal LL function.&lt;br /&gt;
		//Using a user-defined variable only once in a script is inefficient and shouldn&#039;t be used in place of just putting the code in normally if not being used multiple times.&lt;br /&gt;
		//As for the point at which you deem it necessary? That&#039;s personal preference, but personally I go with if I am repeating code 3 or more times in a script.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey;		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[default|Default State]] ====&lt;br /&gt;
Next up we create our first [[state]]. This comes after user-defined functions and global variables.&lt;br /&gt;
In LSL, a state refers to a the container of events that trigger functions in the script. A script when it first starts will always exist in the initial [[default]] state which is a prerequisite for any LSL script. Scripts can contain multiple states, but only one can be active at any one time and only events that are handled in the active state will trigger functions in the script. A state can only contain one of each [[Category:LSL_Events|event handler]] (such as [[touch_start|Touch_start]] or [[state_entry|State_entry]]).&lt;br /&gt;
See below for an example of a simple script which says hello when clicked for an example of the default state:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default //All LSL scripts must contain a state named &amp;quot;default&amp;quot; and this must be the first state defined in your script.&lt;br /&gt;
{&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[state|User-Defined States]] ====&lt;br /&gt;
Lastly, we include any additional states we want in a script. User-Defined states allow for multiple instances of an [[Category:LSL_Events|event handler]] while effectively turning off other undesired events.&lt;br /&gt;
It should be noted that in most cases, you would want to use [[Category:LSL_Conditional|Conditionals]] or [[Timer|timers]] in place of a state but the occasional use still does show up time to time.&lt;br /&gt;
Below is our previous script used in the default state example with a user-defined state added.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked!&amp;quot;);&lt;br /&gt;
		state two; // This instructs the script to switch to &amp;quot;state two&amp;quot; and stop processing events in the default state.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
state two&lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the second state!&amp;quot;);&lt;br /&gt;
		state default; // This instructs the script to switch back to the default state and stop processing events in &amp;quot;state two&amp;quot;.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take great care when changing states in a script! Changing a state during an if or some loops can have adverse effects! Make sure to read up on [[state|states]] for more information.&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193211</id>
		<title>LSL Style Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193211"/>
		<updated>2014-09-06T23:58:42Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Script Structure */ Expanded on stub section on the structure of a script. Included LSL examples walking through the 4 sections of any script.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{RightToc}}&lt;br /&gt;
&lt;br /&gt;
Every major open-source project has its own style guide: a &#039;&#039;&#039;set of conventions&#039;&#039;&#039; (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a &#039;&#039;&#039;consistent style&#039;&#039;&#039;. These guidelines, referred to collectively as a Style Guide, are not as rigid as the rules required by the language compiler but nonetheless are critical to creating maintainable code. The most critical aspect of a style is that you apply it consistently to the code you write.&lt;br /&gt;
&lt;br /&gt;
Effective programming in [[LSL Portal|LSL]] requires that developers use a disciplined approach towards formatting and other conventions in their scripts.&lt;br /&gt;
&lt;br /&gt;
{{LSL Tip| Applying a style guide to your code does not only help others read your code. &#039;&#039;&#039;It helps you as well&#039;&#039;&#039;, because in future when you return to the code you wrote before, you&#039;ll appreciate reading formatted and annotated code.}}&lt;br /&gt;
&lt;br /&gt;
== Use third party editors: ==&lt;br /&gt;
&lt;br /&gt;
There are many [[LSL Alternate Editors|third party editors]] with [[LSL Portal|LSL]] syntax files available. See an example below of what your workflow would look like using an editor that has syntax highlighting and autocomplete and also applies an indent style to your code.&lt;br /&gt;
&lt;br /&gt;
[[File:Pareto_principle_scripting.gif|thumb|700px|center|Writing and fixing scripts takes time and effort. &#039;&#039;&#039;Readability is key to being more productive!&#039;&#039;&#039; [[LSL_Alternate_Editors|Alternate Editors do help, too.]] ]]&lt;br /&gt;
&lt;br /&gt;
You can see now, that using [[LSL Alternate Editors|third party editors]] has a few advantages over using the editor in the viewers:&lt;br /&gt;
* Autocompletion helps you avoid typos.&lt;br /&gt;
* Autocompletion sometimes not only does a linear autocompletion as in autocompleting &amp;lt;code&amp;gt;llS&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSay&amp;lt;/code&amp;gt; but sometimes works even with fuzzy search by autocompleting &amp;lt;code&amp;gt;llslppf&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSetLinkPrimitiveParamsFast&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The syntax highlighting file colors the code exactly like the code you see in the official Linden Lab viewer making you not having to learn or adapt to a different coloring scheme.&lt;br /&gt;
* Autocompletion might also preformat code with indent styles when autocompleting states, events, conditional clauses etc.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Indent_style Indent styles]: ==&lt;br /&gt;
&lt;br /&gt;
Most people, when they start programming on their own, will have programs that are UGLY to look at - to put it nicely, sometimes mistakenly thinking that such scripts occupy less space when compiled. Such scripts typically look like the following:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;unstyled source code&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;default {state_entry(){llSay(0,&amp;quot;Hello World.&amp;quot;);}}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
However, that code is difficult to read (or at least to &#039;&#039;&#039;follow&#039;&#039;&#039;) - even more so when one is writing a couple hundred lines program. There are several [http://en.wikipedia.org/wiki/Indent_style indent styles] which are seen throughout various programming languages which are used to make code more readable and easier to work with. LSL is a C based language and as such proper formatting makes use of the Allman style of code as seen below:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;[http://en.wikipedia.org/wiki/Indent_style#Allman_style Allman style] (used in C based languages)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;Hello World.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It should be noted that LSL is resilient and as such will compile even if an incorrect formatting style for the language is used so long as the syntax is correct. This can be useful if you are coming from another language such as JavaScript which makes use of K&amp;amp;R style formatting and can allow for an easier transition to coding in LSL. It is however, good practice to avoid using any other formatting styles other than Allman as doing so will result in code which is obsfucated and harder to read in terms of how LSL is interpreted with parenthesis&#039; and some operators. If good coding habits are important to you or if LSL is your first step into programming, it is strongly suggested you use Allman for your formatting style.&lt;br /&gt;
&lt;br /&gt;
== Naming conventions: ==&lt;br /&gt;
&lt;br /&gt;
There are many naming conventions in Second Life. Only the most used ones will be listed below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Global Variables (variables used through out the entire program) should be lowercase. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer index = 0;&lt;br /&gt;
string  name  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Others prefer to distinguish between global and local variables by prefixing variable names with a character, defining globals in the following manner:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer gIndex;&lt;br /&gt;
string  gName  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Constant variables should be in ALL CAPS following the style guide used by Linden Labs. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer DIALOG_CHANNEL = -517265;&lt;br /&gt;
vector  RED            = &amp;lt;1.0, 0.0, 0.0&amp;gt;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments used within a [[Category:LSL User-Defined Functions|user defined function]] or one of the standard [[Event|events]] should be named with &#039;&#039;&#039;easily readable and meaningful&#039;&#039;&#039; names. When using [[Event|events]], please use the standard names as listed here on the official wiki. An [[Event|overview of all events can be found here]]. Below is an example as can be found for the [[Listen|listen event]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//  ...&lt;br /&gt;
&lt;br /&gt;
    listen(integer channel, string name, key id, string message)&lt;br /&gt;
    {&lt;br /&gt;
        key OwnerKey = llGetOwner();&lt;br /&gt;
    &lt;br /&gt;
        if (channel == 1 &amp;amp;&amp;amp; id == OwnerKey)&lt;br /&gt;
            llOwnerSay(&amp;quot;Hello Avatar&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
//  ...&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Separating code: ==&lt;br /&gt;
Some people put too many function calls on one line. As shown in this example, too many function calls on a single line makes the code hard to read and almost impossible to debug.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    lst;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
    touch_start(integer n) {&lt;br /&gt;
        integer i;&lt;br /&gt;
        integer index = llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]);&lt;br /&gt;
        if (!~llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]))&lt;br /&gt;
            lst += llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1));&lt;br /&gt;
        llOwnerSay(llList2CSV(lst));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now here is the code, with the exact same features, in a simpler way. While hardly anyone could tell you what the above code did, almost everyone can figure out what the below code does.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    listOfStrings;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
    touch_start(integer n) &lt;br /&gt;
    {&lt;br /&gt;
        key     owner      = llGetOwner();&lt;br /&gt;
        key     id         = llDetectedKey(0);&lt;br /&gt;
        string  name       = llDetectedName(0);// or llKey2Name(id)&lt;br /&gt;
&lt;br /&gt;
        list    nameAsList = llParseString2List(name, [&amp;quot; &amp;quot;], []);&lt;br /&gt;
        string  firstName  = llList2String(nameAsList, 0);&lt;br /&gt;
        string  startPart  = llToLower(llGetSubString(firstName, 0, numDigits - 1));&lt;br /&gt;
        integer index      = llListFindList(listOfStrings, [startPart]);&lt;br /&gt;
&lt;br /&gt;
//      if index is equal to -1&lt;br /&gt;
        if (index == ERR_GENERIC)&lt;br /&gt;
            listOfStrings += startPart;&lt;br /&gt;
&lt;br /&gt;
//      send a message to the owner, only reaches owner if online and within the same sim&lt;br /&gt;
        llRegionSayTo(owner, PUBLIC_CHANNEL, llList2CSV(listOfStrings));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LSL lacks an optimizing compiler. For this reason it may be necessary to balance the two style to get faster, more compact executable code. Line combination optimization should only be done after the code is working &amp;amp; bug free. Improper optimization can lead to wrong results. Always test optimized code thoroughly.&lt;br /&gt;
&lt;br /&gt;
==Script Structure==&lt;br /&gt;
LSL scripts are comprised of expressions, functions, statements, event handlers and states. The LSL compiler mandates a certain structure to scripts:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== [[LSL_Variables|Global Variables]] ====&lt;br /&gt;
&lt;br /&gt;
Global variables define and can contain data which can be written to or read from in multiple events and states within a script.&lt;br /&gt;
Here&#039;s an example of a simple script which uses global variables to store information in a state_entry event and allow it to be used in a second touch event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey; //Here we start by defining a global variable by the name of &amp;quot;ownerkey&amp;quot; and specify that it stores a key (UUID)&lt;br /&gt;
&lt;br /&gt;
string ownername; //Next we define another global variable which stores the username of the owner of the prim containing this script and specify it is storing a string&lt;br /&gt;
&lt;br /&gt;
integer reportonchannel = 0; //In this case we are defining a global variable which stores the numerical channel we will be using later, but in this case we give it a value at the start. &lt;br /&gt;
//As with the last 2, this can be written to but will revert to the specified value when the script is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when entering the default state (When the script first runs or if moving to the default state from a user state)&lt;br /&gt;
	{&lt;br /&gt;
		ownerkey = llGetOwner(); //Stores the key of the owner of the prim containing this script to the &amp;quot;key ownerkey&amp;quot; global variable&lt;br /&gt;
		&lt;br /&gt;
		ownername = llGetUsername(ownerkey); //Here we use that newly stored key to find the username of the account associated with the key in &amp;quot;key ownerkey&amp;quot;&lt;br /&gt;
		//Note that since we have already defined ownerkey and ownername as a key and string respectively, we do not need to specify what type of data they store, unlike local variables&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected) //This event is triggered when someone click the prim this script contains (If it&#039;s on click action is set to touch in the build floater)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey; //Let&#039;s prepare the key for use in a chat message. llSay requires strings but ownerkey is currently a string. &lt;br /&gt;
		//Note that this is an inefficent method of preparing data stored in a variable to another type of data. &lt;br /&gt;
		//Typically this would be done with typecasting in the intended function it is to be used in, but for the purpose of keeping this example easy to follow, I&#039;ll use this method.&lt;br /&gt;
		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
		//When clicked, the prim will speak on the channel specified in &amp;quot;integer reportonchannel&amp;quot; and say the information we found in the previous event.&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[User-defined_functions|User Defined Functions]] ====&lt;br /&gt;
&lt;br /&gt;
[[User-defined_functions|User defined functions]] follow imediatly after global variables in a script and before the default state. [[User-defined_functions|User Defined Functions]] allow for chunks of code that are repeated often throughout a script to be replaced with a one line function that acts in the same way as standard functions (Linden Library Functions).&lt;br /&gt;
These are useful when you want to keep your script bloat to a minimum by only having to write that chunk a single time and substitute other instances of it with a single easy line throughout the script.&lt;br /&gt;
Here&#039;s an example of our earlier script, this time making use of a custom function to replace the functions seen in our state_entry event.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
key ownerkey;&lt;br /&gt;
string ownername;&lt;br /&gt;
integer reportonchannel = 0;&lt;br /&gt;
&lt;br /&gt;
RetrieveOwnerData() //Here we create the user-defined function with the name &amp;quot;RetrieveOwnerData&amp;quot;.&lt;br /&gt;
{&lt;br /&gt;
	ownerkey = llGetOwner(); &lt;br /&gt;
	ownername = llGetUsername(ownerkey);&lt;br /&gt;
	//Notice how we took the contents of our earlier state_entry() and placed it in a function.&lt;br /&gt;
	//When the new function is called, this code will be ran.&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		RetrieveOwnerData(); //Here we call the function just like we would a normal LL function.&lt;br /&gt;
		//Using a user-defined variable only once in a script is inefficient and shouldn&#039;t be used in place of just putting the code in normally if not being used multiple times.&lt;br /&gt;
		//As for the point at which you deem it necessary? That&#039;s personal preference, but personally I go with if I am repeating code 3 or more times in a script.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		string ownerkeyasastring = (string)ownerkey;		&lt;br /&gt;
		llSay(reportonchannel,&amp;quot;I am owned by &amp;quot;+ownername+&amp;quot; and their UUID is &amp;quot;+ownerkeyasastring); &lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[default|Default State]] ====&lt;br /&gt;
Next up we create our first [[state]]. This comes after user-defined functions and global variables.&lt;br /&gt;
In LSL, a state refers to a the container of events that trigger functions in the script. A script when it first starts will always exist in the initial [[default]] state which is a prerequisite for any LSL script. Scripts can contain multiple states, but only one can be active at any one time and only events that are handled in the active state will trigger functions in the script. A state can only contain one of each [[Category:LSL_Events|event handler]] (such as [[touch_start|Touch_start]] or [[state_entry|State_entry]]).&lt;br /&gt;
See below for an example of a simple script which says hello when clicked for an example of the default state:&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default //All LSL scripts must contain a state named &amp;quot;default&amp;quot; and this must be the first state defined in your script.&lt;br /&gt;
{&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== [[state|User-Defined States]] ====&lt;br /&gt;
Lastly, we include any additional states we want in a script. User-Defined states allow for multiple instances of an [[Category:LSL_Events|event handler]] while effectively turning off other undesired events.&lt;br /&gt;
It should be noted that in most cases, you would want to use [[Conditionals|Category:LSL_Conditional]] or [[Timer|timers]] in place of a state but the occasional use still does show up time to time.&lt;br /&gt;
Below is our previous script used in the default state example with a user-defined state added.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked!&amp;quot;);&lt;br /&gt;
		state two; // This instructs the script to switch to &amp;quot;state two&amp;quot; and stop processing events in the default state.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving the default state!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
state two&lt;br /&gt;
{&lt;br /&gt;
	state_entry() //This event is triggered when we are entering from another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I have entered state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer num_detected)&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I was clicked! I&#039;m in the second state!&amp;quot;);&lt;br /&gt;
		state default; // This instructs the script to switch back to the default state and stop processing events in &amp;quot;state two&amp;quot;.&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	state_exit() //This event is triggered when we are changing to another state&lt;br /&gt;
	{&lt;br /&gt;
		llSay(0,&amp;quot;I am leaving state two!&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Take great care when changing states in a script! Changing a state during an if or some loops can have adverse effects! Make sure to read up on [[state|states]] for more information.&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193210</id>
		<title>LSL Style Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193210"/>
		<updated>2014-09-06T22:44:52Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* LSL Portal Style */ - The point of this article is introducing new users to proper formatting. Not to make a case for your personal favoured style being on the wiki when C has established norms.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{RightToc}}&lt;br /&gt;
&lt;br /&gt;
Every major open-source project has its own style guide: a &#039;&#039;&#039;set of conventions&#039;&#039;&#039; (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a &#039;&#039;&#039;consistent style&#039;&#039;&#039;. These guidelines, referred to collectively as a Style Guide, are not as rigid as the rules required by the language compiler but nonetheless are critical to creating maintainable code. The most critical aspect of a style is that you apply it consistently to the code you write.&lt;br /&gt;
&lt;br /&gt;
Effective programming in [[LSL Portal|LSL]] requires that developers use a disciplined approach towards formatting and other conventions in their scripts.&lt;br /&gt;
&lt;br /&gt;
{{LSL Tip| Applying a style guide to your code does not only help others read your code. &#039;&#039;&#039;It helps you as well&#039;&#039;&#039;, because in future when you return to the code you wrote before, you&#039;ll appreciate reading formatted and annotated code.}}&lt;br /&gt;
&lt;br /&gt;
== Use third party editors: ==&lt;br /&gt;
&lt;br /&gt;
There are many [[LSL Alternate Editors|third party editors]] with [[LSL Portal|LSL]] syntax files available. See an example below of what your workflow would look like using an editor that has syntax highlighting and autocomplete and also applies an indent style to your code.&lt;br /&gt;
&lt;br /&gt;
[[File:Pareto_principle_scripting.gif|thumb|700px|center|Writing and fixing scripts takes time and effort. &#039;&#039;&#039;Readability is key to being more productive!&#039;&#039;&#039; [[LSL_Alternate_Editors|Alternate Editors do help, too.]] ]]&lt;br /&gt;
&lt;br /&gt;
You can see now, that using [[LSL Alternate Editors|third party editors]] has a few advantages over using the editor in the viewers:&lt;br /&gt;
* Autocompletion helps you avoid typos.&lt;br /&gt;
* Autocompletion sometimes not only does a linear autocompletion as in autocompleting &amp;lt;code&amp;gt;llS&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSay&amp;lt;/code&amp;gt; but sometimes works even with fuzzy search by autocompleting &amp;lt;code&amp;gt;llslppf&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSetLinkPrimitiveParamsFast&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The syntax highlighting file colors the code exactly like the code you see in the official Linden Lab viewer making you not having to learn or adapt to a different coloring scheme.&lt;br /&gt;
* Autocompletion might also preformat code with indent styles when autocompleting states, events, conditional clauses etc.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Indent_style Indent styles]: ==&lt;br /&gt;
&lt;br /&gt;
Most people, when they start programming on their own, will have programs that are UGLY to look at - to put it nicely, sometimes mistakenly thinking that such scripts occupy less space when compiled. Such scripts typically look like the following:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;unstyled source code&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;default {state_entry(){llSay(0,&amp;quot;Hello World.&amp;quot;);}}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
However, that code is difficult to read (or at least to &#039;&#039;&#039;follow&#039;&#039;&#039;) - even more so when one is writing a couple hundred lines program. There are several [http://en.wikipedia.org/wiki/Indent_style indent styles] which are seen throughout various programming languages which are used to make code more readable and easier to work with. LSL is a C based language and as such proper formatting makes use of the Allman style of code as seen below:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;[http://en.wikipedia.org/wiki/Indent_style#Allman_style Allman style] (used in C based languages)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;Hello World.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It should be noted that LSL is resilient and as such will compile even if an incorrect formatting style for the language is used so long as the syntax is correct. This can be useful if you are coming from another language such as JavaScript which makes use of K&amp;amp;R style formatting and can allow for an easier transition to coding in LSL. It is however, good practice to avoid using any other formatting styles other than Allman as doing so will result in code which is obsfucated and harder to read in terms of how LSL is interpreted with parenthesis&#039; and some operators. If good coding habits are important to you or if LSL is your first step into programming, it is strongly suggested you use Allman for your formatting style.&lt;br /&gt;
&lt;br /&gt;
== Naming conventions: ==&lt;br /&gt;
&lt;br /&gt;
There are many naming conventions in Second Life. Only the most used ones will be listed below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Global Variables (variables used through out the entire program) should be lowercase. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer index = 0;&lt;br /&gt;
string  name  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Others prefer to distinguish between global and local variables by prefixing variable names with a character, defining globals in the following manner:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer gIndex;&lt;br /&gt;
string  gName  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Constant variables should be in ALL CAPS following the style guide used by Linden Labs. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer DIALOG_CHANNEL = -517265;&lt;br /&gt;
vector  RED            = &amp;lt;1.0, 0.0, 0.0&amp;gt;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments used within a [[Category:LSL User-Defined Functions|user defined function]] or one of the standard [[Event|events]] should be named with &#039;&#039;&#039;easily readable and meaningful&#039;&#039;&#039; names. When using [[Event|events]], please use the standard names as listed here on the official wiki. An [[Event|overview of all events can be found here]]. Below is an example as can be found for the [[Listen|listen event]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//  ...&lt;br /&gt;
&lt;br /&gt;
    listen(integer channel, string name, key id, string message)&lt;br /&gt;
    {&lt;br /&gt;
        key OwnerKey = llGetOwner();&lt;br /&gt;
    &lt;br /&gt;
        if (channel == 1 &amp;amp;&amp;amp; id == OwnerKey)&lt;br /&gt;
            llOwnerSay(&amp;quot;Hello Avatar&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
//  ...&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Separating code: ==&lt;br /&gt;
Some people put too many function calls on one line. As shown in this example, too many function calls on a single line makes the code hard to read and almost impossible to debug.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    lst;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
    touch_start(integer n) {&lt;br /&gt;
        integer i;&lt;br /&gt;
        integer index = llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]);&lt;br /&gt;
        if (!~llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]))&lt;br /&gt;
            lst += llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1));&lt;br /&gt;
        llOwnerSay(llList2CSV(lst));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now here is the code, with the exact same features, in a simpler way. While hardly anyone could tell you what the above code did, almost everyone can figure out what the below code does.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    listOfStrings;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
    touch_start(integer n) &lt;br /&gt;
    {&lt;br /&gt;
        key     owner      = llGetOwner();&lt;br /&gt;
        key     id         = llDetectedKey(0);&lt;br /&gt;
        string  name       = llDetectedName(0);// or llKey2Name(id)&lt;br /&gt;
&lt;br /&gt;
        list    nameAsList = llParseString2List(name, [&amp;quot; &amp;quot;], []);&lt;br /&gt;
        string  firstName  = llList2String(nameAsList, 0);&lt;br /&gt;
        string  startPart  = llToLower(llGetSubString(firstName, 0, numDigits - 1));&lt;br /&gt;
        integer index      = llListFindList(listOfStrings, [startPart]);&lt;br /&gt;
&lt;br /&gt;
//      if index is equal to -1&lt;br /&gt;
        if (index == ERR_GENERIC)&lt;br /&gt;
            listOfStrings += startPart;&lt;br /&gt;
&lt;br /&gt;
//      send a message to the owner, only reaches owner if online and within the same sim&lt;br /&gt;
        llRegionSayTo(owner, PUBLIC_CHANNEL, llList2CSV(listOfStrings));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LSL lacks an optimizing compiler. For this reason it may be necessary to balance the two style to get faster, more compact executable code. Line combination optimization should only be done after the code is working &amp;amp; bug free. Improper optimization can lead to wrong results. Always test optimized code thoroughly.&lt;br /&gt;
&lt;br /&gt;
==Script Structure==&lt;br /&gt;
LSL scripts are comprised of expressions, functions, statements, event handlers and states. The LSL compiler mandates a certain structure to scripts:&lt;br /&gt;
&lt;br /&gt;
#User Defined Variables  (see [[LSL_Variables]])&lt;br /&gt;
#User Defined Functions (see [[User-defined_functions]])&lt;br /&gt;
#[[default]] State  (see [[State]])&lt;br /&gt;
#User Defined States&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193209</id>
		<title>LSL Style Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193209"/>
		<updated>2014-09-06T22:13:46Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Indent styles: */  - Reworded section on resilience to incorrect formats to be more neutral in tone.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{RightToc}}&lt;br /&gt;
&lt;br /&gt;
Every major open-source project has its own style guide: a &#039;&#039;&#039;set of conventions&#039;&#039;&#039; (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a &#039;&#039;&#039;consistent style&#039;&#039;&#039;. These guidelines, referred to collectively as a Style Guide, are not as rigid as the rules required by the language compiler but nonetheless are critical to creating maintainable code. The most critical aspect of a style is that you apply it consistently to the code you write.&lt;br /&gt;
&lt;br /&gt;
Effective programming in [[LSL Portal|LSL]] requires that developers use a disciplined approach towards formatting and other conventions in their scripts.&lt;br /&gt;
&lt;br /&gt;
{{LSL Tip| Applying a style guide to your code does not only help others read your code. &#039;&#039;&#039;It helps you as well&#039;&#039;&#039;, because in future when you return to the code you wrote before, you&#039;ll appreciate reading formatted and annotated code.}}&lt;br /&gt;
&lt;br /&gt;
== Use third party editors: ==&lt;br /&gt;
&lt;br /&gt;
There are many [[LSL Alternate Editors|third party editors]] with [[LSL Portal|LSL]] syntax files available. See an example below of what your workflow would look like using an editor that has syntax highlighting and autocomplete and also applies an indent style to your code.&lt;br /&gt;
&lt;br /&gt;
[[File:Pareto_principle_scripting.gif|thumb|700px|center|Writing and fixing scripts takes time and effort. &#039;&#039;&#039;Readability is key to being more productive!&#039;&#039;&#039; [[LSL_Alternate_Editors|Alternate Editors do help, too.]] ]]&lt;br /&gt;
&lt;br /&gt;
You can see now, that using [[LSL Alternate Editors|third party editors]] has a few advantages over using the editor in the viewers:&lt;br /&gt;
* Autocompletion helps you avoid typos.&lt;br /&gt;
* Autocompletion sometimes not only does a linear autocompletion as in autocompleting &amp;lt;code&amp;gt;llS&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSay&amp;lt;/code&amp;gt; but sometimes works even with fuzzy search by autocompleting &amp;lt;code&amp;gt;llslppf&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSetLinkPrimitiveParamsFast&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The syntax highlighting file colors the code exactly like the code you see in the official Linden Lab viewer making you not having to learn or adapt to a different coloring scheme.&lt;br /&gt;
* Autocompletion might also preformat code with indent styles when autocompleting states, events, conditional clauses etc.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Indent_style Indent styles]: ==&lt;br /&gt;
&lt;br /&gt;
Most people, when they start programming on their own, will have programs that are UGLY to look at - to put it nicely, sometimes mistakenly thinking that such scripts occupy less space when compiled. Such scripts typically look like the following:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;unstyled source code&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;default {state_entry(){llSay(0,&amp;quot;Hello World.&amp;quot;);}}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
However, that code is difficult to read (or at least to &#039;&#039;&#039;follow&#039;&#039;&#039;) - even more so when one is writing a couple hundred lines program. There are several [http://en.wikipedia.org/wiki/Indent_style indent styles] which are seen throughout various programming languages which are used to make code more readable and easier to work with. LSL is a C based language and as such proper formatting makes use of the Allman style of code as seen below:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;[http://en.wikipedia.org/wiki/Indent_style#Allman_style Allman style] (used in C based languages)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;Hello World.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It should be noted that LSL is resilient and as such will compile even if an incorrect formatting style for the language is used so long as the syntax is correct. This can be useful if you are coming from another language such as JavaScript which makes use of K&amp;amp;R style formatting and can allow for an easier transition to coding in LSL. It is however, good practice to avoid using any other formatting styles other than Allman as doing so will result in code which is obsfucated and harder to read in terms of how LSL is interpreted with parenthesis&#039; and some operators. If good coding habits are important to you or if LSL is your first step into programming, it is strongly suggested you use Allman for your formatting style.&lt;br /&gt;
&lt;br /&gt;
== Naming conventions: ==&lt;br /&gt;
&lt;br /&gt;
There are many naming conventions in Second Life. Only the most used ones will be listed below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Global Variables (variables used through out the entire program) should be lowercase. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer index = 0;&lt;br /&gt;
string  name  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Others prefer to distinguish between global and local variables by prefixing variable names with a character, defining globals in the following manner:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer gIndex;&lt;br /&gt;
string  gName  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Constant variables should be in ALL CAPS following the style guide used by Linden Labs. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer DIALOG_CHANNEL = -517265;&lt;br /&gt;
vector  RED            = &amp;lt;1.0, 0.0, 0.0&amp;gt;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments used within a [[Category:LSL User-Defined Functions|user defined function]] or one of the standard [[Event|events]] should be named with &#039;&#039;&#039;easily readable and meaningful&#039;&#039;&#039; names. When using [[Event|events]], please use the standard names as listed here on the official wiki. An [[Event|overview of all events can be found here]]. Below is an example as can be found for the [[Listen|listen event]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//  ...&lt;br /&gt;
&lt;br /&gt;
    listen(integer channel, string name, key id, string message)&lt;br /&gt;
    {&lt;br /&gt;
        key OwnerKey = llGetOwner();&lt;br /&gt;
    &lt;br /&gt;
        if (channel == 1 &amp;amp;&amp;amp; id == OwnerKey)&lt;br /&gt;
            llOwnerSay(&amp;quot;Hello Avatar&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
//  ...&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Separating code: ==&lt;br /&gt;
Some people put too many function calls on one line. As shown in this example, too many function calls on a single line makes the code hard to read and almost impossible to debug.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    lst;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
    touch_start(integer n) {&lt;br /&gt;
        integer i;&lt;br /&gt;
        integer index = llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]);&lt;br /&gt;
        if (!~llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]))&lt;br /&gt;
            lst += llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1));&lt;br /&gt;
        llOwnerSay(llList2CSV(lst));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now here is the code, with the exact same features, in a simpler way. While hardly anyone could tell you what the above code did, almost everyone can figure out what the below code does.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    listOfStrings;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
    touch_start(integer n) &lt;br /&gt;
    {&lt;br /&gt;
        key     owner      = llGetOwner();&lt;br /&gt;
        key     id         = llDetectedKey(0);&lt;br /&gt;
        string  name       = llDetectedName(0);// or llKey2Name(id)&lt;br /&gt;
&lt;br /&gt;
        list    nameAsList = llParseString2List(name, [&amp;quot; &amp;quot;], []);&lt;br /&gt;
        string  firstName  = llList2String(nameAsList, 0);&lt;br /&gt;
        string  startPart  = llToLower(llGetSubString(firstName, 0, numDigits - 1));&lt;br /&gt;
        integer index      = llListFindList(listOfStrings, [startPart]);&lt;br /&gt;
&lt;br /&gt;
//      if index is equal to -1&lt;br /&gt;
        if (index == ERR_GENERIC)&lt;br /&gt;
            listOfStrings += startPart;&lt;br /&gt;
&lt;br /&gt;
//      send a message to the owner, only reaches owner if online and within the same sim&lt;br /&gt;
        llRegionSayTo(owner, PUBLIC_CHANNEL, llList2CSV(listOfStrings));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LSL lacks an optimizing compiler. For this reason it may be necessary to balance the two style to get faster, more compact executable code. Line combination optimization should only be done after the code is working &amp;amp; bug free. Improper optimization can lead to wrong results. Always test optimized code thoroughly.&lt;br /&gt;
&lt;br /&gt;
==Script Structure==&lt;br /&gt;
LSL scripts are comprised of expressions, functions, statements, event handlers and states. The LSL compiler mandates a certain structure to scripts:&lt;br /&gt;
&lt;br /&gt;
#User Defined Variables  (see [[LSL_Variables]])&lt;br /&gt;
#User Defined Functions (see [[User-defined_functions]])&lt;br /&gt;
#[[default]] State  (see [[State]])&lt;br /&gt;
#User Defined States&lt;br /&gt;
&lt;br /&gt;
==LSL Portal Style==&lt;br /&gt;
&lt;br /&gt;
Here in the [[LSL Portal]] we expect consistent white-spacing and it should look similar to either &#039;&#039;&#039;K&amp;amp;R&#039;&#039;&#039; or &#039;&#039;&#039;Allman&#039;&#039;&#039;. We do not require strict adherence to either. We do not use tabs (as they take up an exorbitant amount of screen space) but some number of spaces, usually between 2 and 6, 4 being the most popular value and the value you will see almost everywhere. Generally speaking it&#039;s taboo to edit an article just to fix the white-spacing, unless it&#039;s inconsistent (the edit should make it consistent, it should not change the style). Generally speaking it&#039;s taboo to edit an article to change the style. Exceptions do exist, if you are making substantial changes to the majority of code in the article, and it makes sense to change the style of the rest of the code (such that it all matches), you may do so. The purpose of this restriction is to keep the peace, some people are really quite attached to their style. Considering that style is a personal preference of little consequence, nothing is gained by forcing one style onto the community, especially when they will go ahead and use whatever style they want disregarding what we mandate.&lt;br /&gt;
&lt;br /&gt;
If you find yourself desiring to make small changes to white-space despite it being frowned upon, we would ask you first consider adding an example to one of the articles that [[:Category:LSL_Needs_Example|needs an example]] or is missing some [[:Category:LSL FixMe|key content]].&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193208</id>
		<title>LSL Style Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LSL_Style_Guide&amp;diff=1193208"/>
		<updated>2014-09-06T16:53:44Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Indent styles: */ - LSL is a C based language. Let&amp;#039;s not try pretend that writing it as if it was JS based is equally valid, regardless of some people are in the habit of writing JS or not.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header|ml=*}}{{RightToc}}&lt;br /&gt;
&lt;br /&gt;
Every major open-source project has its own style guide: a &#039;&#039;&#039;set of conventions&#039;&#039;&#039; (sometimes arbitrary) about how to write code for that project. It is much easier to understand a large codebase when all the code in it is in a &#039;&#039;&#039;consistent style&#039;&#039;&#039;. These guidelines, referred to collectively as a Style Guide, are not as rigid as the rules required by the language compiler but nonetheless are critical to creating maintainable code. The most critical aspect of a style is that you apply it consistently to the code you write.&lt;br /&gt;
&lt;br /&gt;
Effective programming in [[LSL Portal|LSL]] requires that developers use a disciplined approach towards formatting and other conventions in their scripts.&lt;br /&gt;
&lt;br /&gt;
{{LSL Tip| Applying a style guide to your code does not only help others read your code. &#039;&#039;&#039;It helps you as well&#039;&#039;&#039;, because in future when you return to the code you wrote before, you&#039;ll appreciate reading formatted and annotated code.}}&lt;br /&gt;
&lt;br /&gt;
== Use third party editors: ==&lt;br /&gt;
&lt;br /&gt;
There are many [[LSL Alternate Editors|third party editors]] with [[LSL Portal|LSL]] syntax files available. See an example below of what your workflow would look like using an editor that has syntax highlighting and autocomplete and also applies an indent style to your code.&lt;br /&gt;
&lt;br /&gt;
[[File:Pareto_principle_scripting.gif|thumb|700px|center|Writing and fixing scripts takes time and effort. &#039;&#039;&#039;Readability is key to being more productive!&#039;&#039;&#039; [[LSL_Alternate_Editors|Alternate Editors do help, too.]] ]]&lt;br /&gt;
&lt;br /&gt;
You can see now, that using [[LSL Alternate Editors|third party editors]] has a few advantages over using the editor in the viewers:&lt;br /&gt;
* Autocompletion helps you avoid typos.&lt;br /&gt;
* Autocompletion sometimes not only does a linear autocompletion as in autocompleting &amp;lt;code&amp;gt;llS&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSay&amp;lt;/code&amp;gt; but sometimes works even with fuzzy search by autocompleting &amp;lt;code&amp;gt;llslppf&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;llSetLinkPrimitiveParamsFast&amp;lt;/code&amp;gt;.&lt;br /&gt;
* The syntax highlighting file colors the code exactly like the code you see in the official Linden Lab viewer making you not having to learn or adapt to a different coloring scheme.&lt;br /&gt;
* Autocompletion might also preformat code with indent styles when autocompleting states, events, conditional clauses etc.&lt;br /&gt;
&lt;br /&gt;
== [http://en.wikipedia.org/wiki/Indent_style Indent styles]: ==&lt;br /&gt;
&lt;br /&gt;
Most people, when they start programming on their own, will have programs that are UGLY to look at - to put it nicely, sometimes mistakenly thinking that such scripts occupy less space when compiled. Such scripts typically look like the following:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;unstyled source code&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;default {state_entry(){llSay(0,&amp;quot;Hello World.&amp;quot;);}}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
However, that code is difficult to read (or at least to &#039;&#039;&#039;follow&#039;&#039;&#039;) - even more so when one is writing a couple hundred lines program. There are several [http://en.wikipedia.org/wiki/Indent_style indent styles] which are seen throughout various programming languages which are used to make code more readable and easier to work with. LSL is a C based language and as such proper formatting makes use of the Allman style of code as seen below:&lt;br /&gt;
&lt;br /&gt;
{| width=&amp;quot;100%&amp;quot; {{Prettytable}}&lt;br /&gt;
|- {{Hl2}}&lt;br /&gt;
! &#039;&#039;&#039;[http://en.wikipedia.org/wiki/Indent_style#Allman_style Allman style] (used in C based languages)&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
||&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        llSay(0, &amp;quot;Hello World.&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
It should be noted that LSL is resilient, unlike many other languages to poor formatting on the scripter&#039;s part and for this reason some scripters choose to format their code in styles used with other languages, the most common being K&amp;amp;R which is used with Javascript based languages. This resilience allows the code to successfuly compile even if poorly formatted, but it should be noted that although other styles may be used, this in turn will result in code which does not accurately represent how LSL is interpreted with indentation and paranthesis.&lt;br /&gt;
&lt;br /&gt;
== Naming conventions: ==&lt;br /&gt;
&lt;br /&gt;
There are many naming conventions in Second Life. Only the most used ones will be listed below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Global Variables (variables used through out the entire program) should be lowercase. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer index = 0;&lt;br /&gt;
string  name  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Others prefer to distinguish between global and local variables by prefixing variable names with a character, defining globals in the following manner:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer gIndex;&lt;br /&gt;
string  gName  = &amp;quot;Please set one&amp;quot;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Constant variables should be in ALL CAPS following the style guide used by Linden Labs. For example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
integer DIALOG_CHANNEL = -517265;&lt;br /&gt;
vector  RED            = &amp;lt;1.0, 0.0, 0.0&amp;gt;;&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Arguments used within a [[Category:LSL User-Defined Functions|user defined function]] or one of the standard [[Event|events]] should be named with &#039;&#039;&#039;easily readable and meaningful&#039;&#039;&#039; names. When using [[Event|events]], please use the standard names as listed here on the official wiki. An [[Event|overview of all events can be found here]]. Below is an example as can be found for the [[Listen|listen event]]:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//  ...&lt;br /&gt;
&lt;br /&gt;
    listen(integer channel, string name, key id, string message)&lt;br /&gt;
    {&lt;br /&gt;
        key OwnerKey = llGetOwner();&lt;br /&gt;
    &lt;br /&gt;
        if (channel == 1 &amp;amp;&amp;amp; id == OwnerKey)&lt;br /&gt;
            llOwnerSay(&amp;quot;Hello Avatar&amp;quot;);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
//  ...&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Separating code: ==&lt;br /&gt;
Some people put too many function calls on one line. As shown in this example, too many function calls on a single line makes the code hard to read and almost impossible to debug.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    lst;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default {&lt;br /&gt;
    touch_start(integer n) {&lt;br /&gt;
        integer i;&lt;br /&gt;
        integer index = llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]);&lt;br /&gt;
        if (!~llListFindList(lst, [llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1))]))&lt;br /&gt;
            lst += llToLower(llGetSubString(llList2String(llParseString2List(llKey2Name(llDetectedKey(i)), [&amp;quot; &amp;quot;], []), 0), 0, numDigits - 1));&lt;br /&gt;
        llOwnerSay(llList2CSV(lst));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now here is the code, with the exact same features, in a simpler way. While hardly anyone could tell you what the above code did, almost everyone can figure out what the below code does.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
list    listOfStrings;&lt;br /&gt;
integer numDigits = 10;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
    touch_start(integer n) &lt;br /&gt;
    {&lt;br /&gt;
        key     owner      = llGetOwner();&lt;br /&gt;
        key     id         = llDetectedKey(0);&lt;br /&gt;
        string  name       = llDetectedName(0);// or llKey2Name(id)&lt;br /&gt;
&lt;br /&gt;
        list    nameAsList = llParseString2List(name, [&amp;quot; &amp;quot;], []);&lt;br /&gt;
        string  firstName  = llList2String(nameAsList, 0);&lt;br /&gt;
        string  startPart  = llToLower(llGetSubString(firstName, 0, numDigits - 1));&lt;br /&gt;
        integer index      = llListFindList(listOfStrings, [startPart]);&lt;br /&gt;
&lt;br /&gt;
//      if index is equal to -1&lt;br /&gt;
        if (index == ERR_GENERIC)&lt;br /&gt;
            listOfStrings += startPart;&lt;br /&gt;
&lt;br /&gt;
//      send a message to the owner, only reaches owner if online and within the same sim&lt;br /&gt;
        llRegionSayTo(owner, PUBLIC_CHANNEL, llList2CSV(listOfStrings));&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
LSL lacks an optimizing compiler. For this reason it may be necessary to balance the two style to get faster, more compact executable code. Line combination optimization should only be done after the code is working &amp;amp; bug free. Improper optimization can lead to wrong results. Always test optimized code thoroughly.&lt;br /&gt;
&lt;br /&gt;
==Script Structure==&lt;br /&gt;
LSL scripts are comprised of expressions, functions, statements, event handlers and states. The LSL compiler mandates a certain structure to scripts:&lt;br /&gt;
&lt;br /&gt;
#User Defined Variables  (see [[LSL_Variables]])&lt;br /&gt;
#User Defined Functions (see [[User-defined_functions]])&lt;br /&gt;
#[[default]] State  (see [[State]])&lt;br /&gt;
#User Defined States&lt;br /&gt;
&lt;br /&gt;
==LSL Portal Style==&lt;br /&gt;
&lt;br /&gt;
Here in the [[LSL Portal]] we expect consistent white-spacing and it should look similar to either &#039;&#039;&#039;K&amp;amp;R&#039;&#039;&#039; or &#039;&#039;&#039;Allman&#039;&#039;&#039;. We do not require strict adherence to either. We do not use tabs (as they take up an exorbitant amount of screen space) but some number of spaces, usually between 2 and 6, 4 being the most popular value and the value you will see almost everywhere. Generally speaking it&#039;s taboo to edit an article just to fix the white-spacing, unless it&#039;s inconsistent (the edit should make it consistent, it should not change the style). Generally speaking it&#039;s taboo to edit an article to change the style. Exceptions do exist, if you are making substantial changes to the majority of code in the article, and it makes sense to change the style of the rest of the code (such that it all matches), you may do so. The purpose of this restriction is to keep the peace, some people are really quite attached to their style. Considering that style is a personal preference of little consequence, nothing is gained by forcing one style onto the community, especially when they will go ahead and use whatever style they want disregarding what we mandate.&lt;br /&gt;
&lt;br /&gt;
If you find yourself desiring to make small changes to white-space despite it being frowned upon, we would ask you first consider adding an example to one of the articles that [[:Category:LSL_Needs_Example|needs an example]] or is missing some [[:Category:LSL FixMe|key content]].&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=LlList2String&amp;diff=1193153</id>
		<title>LlList2String</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=LlList2String&amp;diff=1193153"/>
		<updated>2014-08-31T00:20:08Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: Undo revision 1174262  Although this is indeed useful information. It should instead be added to the section in LSL List on iteration. Covering iteration is not relevant to this function.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL_Function&lt;br /&gt;
|inject-2={{LSL_Function/list/element|src|index|string|nf=*|return={{HoverText|null string|null string: &amp;quot;&amp;quot;}}}}&lt;br /&gt;
|func_id=188|func_sleep=0.0|func_energy=10.0&lt;br /&gt;
|func=llList2String|return_type=string|p1_type=list|p1_name=src|p2_type=integer|p2_name=index&lt;br /&gt;
|func_footnote&lt;br /&gt;
|func_desc&lt;br /&gt;
|return_text=that is at {{LSLP|index}} in {{LSLP|src}}.&lt;br /&gt;
|spec&lt;br /&gt;
|caveats=*When using this function to typecast a list element to a string it will truncated float based types to 6 decimal places.&lt;br /&gt;
|constants&lt;br /&gt;
|examples=&amp;lt;lsl&amp;gt;//This code demonstrates the differences in typecasting in LSL (and demonstrates how to use the llList2* functions).&lt;br /&gt;
// Best viewed in Chat History (ctrl-h)&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        list my_list = [&amp;quot;a&amp;quot;, &amp;quot;0xFF&amp;quot;, &amp;quot;0xFF.FF&amp;quot;, &amp;quot;1.0e3&amp;quot;, 1, 2.0, &amp;lt;1,2,3&amp;gt;, &amp;lt;1,2,3,4&amp;gt;, llGetOwner()];&lt;br /&gt;
        integer i = 0;&lt;br /&gt;
        integer end = llGetListLength(my_list);&lt;br /&gt;
        for (; i&amp;lt;end; ++i)&lt;br /&gt;
        {&lt;br /&gt;
            llOwnerSay(&amp;quot;string=&amp;quot; + llList2String(my_list,i)&lt;br /&gt;
                        + &amp;quot;\n   integer=&amp;quot; + (string)llList2Integer(my_list,i) + &amp;quot; OR &amp;quot; +(string)((integer)llList2String(my_list,i))&lt;br /&gt;
                        + &amp;quot;\n   float=&amp;quot; + (string)llList2Float(my_list,i) + &amp;quot; OR &amp;quot; +(string)((float)llList2String(my_list,i))&lt;br /&gt;
                        + &amp;quot;\n   vector=&amp;quot; + (string)llList2Vector(my_list,i) + &amp;quot; OR &amp;quot; +(string)((vector)llList2String(my_list,i))&lt;br /&gt;
                        + &amp;quot;\n   rot=&amp;quot; + (string)llList2Rot(my_list,i) + &amp;quot; OR &amp;quot; +(string)((rotation)llList2String(my_list,i))&lt;br /&gt;
                        + &amp;quot;\n   key=&amp;quot; + (string)llList2Key(my_list,i) + &amp;quot; OR &amp;quot; +(string)((key)llList2String(my_list,i)) );&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&amp;lt;/lsl&amp;gt;&lt;br /&gt;
|helpers&lt;br /&gt;
|also_functions={{LSL DefineRow||[[llDumpList2String]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llGetListEntryType]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llList2Float]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llList2Integer]]|}}&lt;br /&gt;
{{LSL DefineRow||[[llList2Key]]|}}&lt;br /&gt;
|also_events&lt;br /&gt;
|also_tests&lt;br /&gt;
|also_articles&lt;br /&gt;
|notes=*If you wish to extract a string from a list that you know will contain only a single item (for example if you extract a single entry from a list using [[llList2List|llList2List()]]), then instead of using &amp;lt;code&amp;gt;llList2String(myList, 0)&amp;lt;/code&amp;gt; you may wish to considering using the more efficient &amp;lt;code&amp;gt;(string)myList&amp;lt;/code&amp;gt; as it will produce the same result for single-entry lists with less memory usage due to eliminating a function-call.&lt;br /&gt;
*To convert a string of hexadecimal notation to integer, call [[llList2Integer]] and it will automatically cast the value as decimal integer. To convert that integer back to a string of hexadecimal notation, use a user function like [[hex]].&lt;br /&gt;
|permission&lt;br /&gt;
|cat1=List&lt;br /&gt;
|cat2&lt;br /&gt;
|cat3&lt;br /&gt;
|cat4&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192572</id>
		<title>3D Radar</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192572"/>
		<updated>2014-08-05T16:50:39Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Scan Ball Script */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header}}&lt;br /&gt;
&lt;br /&gt;
*[[User:Jesse_Barnett|Click Here]]  To see my page and more of my scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scripts have been corrected and working properly now==&lt;br /&gt;
&lt;br /&gt;
Rezzes a ball for each avatar in range. Each ball tracks it&#039;s on AV and displays distance.&lt;br /&gt;
&lt;br /&gt;
==Scanner/Rezzer Script==&lt;br /&gt;
Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.&lt;br /&gt;
&lt;br /&gt;
Suggestion: Create a sphere with a diameter of  2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it&#039;s avatar to a range of 96 meters.&lt;br /&gt;
&lt;br /&gt;
This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) &amp;amp; multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):&lt;br /&gt;
&lt;br /&gt;
1/96 = approximately 0.010417.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:43:28&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
integer Scan = TRUE;&lt;br /&gt;
string avKey;&lt;br /&gt;
integer list_pos;&lt;br /&gt;
list key_list;&lt;br /&gt;
integer key_chan;	//Key channel is generated randomly and passed to the scan ball&lt;br /&gt;
integer die_chan = -9423753;	//Hey pick your own channels and be sure to paste them into the scan balls too!&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer total_number) &lt;br /&gt;
	{&lt;br /&gt;
		if (Scan) &lt;br /&gt;
		{&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;, AGENT, 96, PI, 1);&lt;br /&gt;
			key_list =[];&lt;br /&gt;
			llListen(key_rem_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;on&amp;quot;);&lt;br /&gt;
			Scan = FALSE;&lt;br /&gt;
		}&lt;br /&gt;
		else &lt;br /&gt;
		{&lt;br /&gt;
			llSensorRemove();&lt;br /&gt;
			llRegionSay(die_chan, &amp;quot;die&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;off&amp;quot;);&lt;br /&gt;
			Scan = TRUE;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer iNum) &lt;br /&gt;
	{&lt;br /&gt;
		integer p = 0;&lt;br /&gt;
		for (p = 0; p &amp;lt; iNum; ++p) &lt;br /&gt;
		{&lt;br /&gt;
			avKey = llDetectedKey(p);&lt;br /&gt;
			list_pos = llListFindList(key_list, (list)avKey);&lt;br /&gt;
			if (list_pos == -1) &lt;br /&gt;
			{&lt;br /&gt;
				key_list += (list) avKey;&lt;br /&gt;
				key_chan = (integer) llFrand(-1000000) - 1000000;&lt;br /&gt;
				llRezObject(&amp;quot;scan ball&amp;quot;, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);&lt;br /&gt;
				llSleep(.25);&lt;br /&gt;
				llRegionSay(key_chan, avKey);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	listen(integer c, string name, key id, string msg) &lt;br /&gt;
	{&lt;br /&gt;
		integer r = llListFindList(key_list,[(key)msg]);&lt;br /&gt;
		key_list = llDeleteSubList(key_list, r, r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Scan Ball Script==&lt;br /&gt;
Place this script in a prim and make sure to name it &amp;quot;scan ball&amp;quot;. Then place the prim into the inventory of the Scanner/Rezzer. &lt;br /&gt;
&lt;br /&gt;
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:44:36&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
string avName;&lt;br /&gt;
integer avDistance;&lt;br /&gt;
key avKey;&lt;br /&gt;
integer avListen;&lt;br /&gt;
integer key_chan;&lt;br /&gt;
integer die_chan = -9423753;&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
vector avPos;&lt;br /&gt;
vector rPos;&lt;br /&gt;
key owner;&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		owner = llGetOwner(); // Lets check to see what the key of the owner of the object is and save it for later&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	on_rez(integer start_param)&lt;br /&gt;
	{&lt;br /&gt;
		rPos = llGetPos();&lt;br /&gt;
		key_chan = start_param;&lt;br /&gt;
		llListen(die_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		avListen = llListen(key_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	listen(integer c, string n, key id, string msg)&lt;br /&gt;
	{&lt;br /&gt;
		if (c == die_chan &amp;amp;&amp;amp; msg == &amp;quot;die&amp;quot; &amp;amp;&amp;amp; owner == llDetectedOwner(0)) //Lets check to see if the message we heard matches all the criteria for the kill command&lt;br /&gt;
		{                                                                 //(Right channel, right message and from radar owned by same owner)&lt;br /&gt;
			llDie();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
			avKey = (key) msg;&lt;br /&gt;
			avName = llKey2Name(avKey);&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, avKey, AGENT, 96, PI, 1.0);&lt;br /&gt;
			llListenRemove(avListen);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer n)&lt;br /&gt;
	{&lt;br /&gt;
		avPos = llDetectedPos(0);&lt;br /&gt;
		vector avDivPos = (avPos - rPos) / (96 / 1);	//Scan range/Radius of large sphere&lt;br /&gt;
		avDistance = (integer) llVecDist(rPos, llDetectedPos(0));&lt;br /&gt;
		llSetPos(rPos + avDivPos);&lt;br /&gt;
		llSetText(avName + &amp;quot;[&amp;quot; + (string) avDistance + &amp;quot;]&amp;quot;, &amp;lt;1, 1, 1 &amp;gt;, 1);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	no_sensor()&lt;br /&gt;
	{&lt;br /&gt;
		llRegionSay(key_rem_chan, avKey);&lt;br /&gt;
		llDie();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
{{LSLC|Library|3D Radar}}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192571</id>
		<title>3D Radar</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192571"/>
		<updated>2014-08-05T16:30:09Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Scan Ball Script */ Breaking up a comment into two lines&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header}}&lt;br /&gt;
&lt;br /&gt;
*[[User:Jesse_Barnett|Click Here]]  To see my page and more of my scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scripts have been corrected and working properly now==&lt;br /&gt;
&lt;br /&gt;
Rezzes a ball for each avatar in range. Each ball tracks it&#039;s on AV and displays distance.&lt;br /&gt;
&lt;br /&gt;
==Scanner/Rezzer Script==&lt;br /&gt;
Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.&lt;br /&gt;
&lt;br /&gt;
Suggestion: Create a sphere with a diameter of  2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it&#039;s avatar to a range of 96 meters.&lt;br /&gt;
&lt;br /&gt;
This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) &amp;amp; multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):&lt;br /&gt;
&lt;br /&gt;
1/96 = approximately 0.010417.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:43:28&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
integer Scan = TRUE;&lt;br /&gt;
string avKey;&lt;br /&gt;
integer list_pos;&lt;br /&gt;
list key_list;&lt;br /&gt;
integer key_chan;	//Key channel is generated randomly and passed to the scan ball&lt;br /&gt;
integer die_chan = -9423753;	//Hey pick your own channels and be sure to paste them into the scan balls too!&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer total_number) &lt;br /&gt;
	{&lt;br /&gt;
		if (Scan) &lt;br /&gt;
		{&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;, AGENT, 96, PI, 1);&lt;br /&gt;
			key_list =[];&lt;br /&gt;
			llListen(key_rem_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;on&amp;quot;);&lt;br /&gt;
			Scan = FALSE;&lt;br /&gt;
		}&lt;br /&gt;
		else &lt;br /&gt;
		{&lt;br /&gt;
			llSensorRemove();&lt;br /&gt;
			llRegionSay(die_chan, &amp;quot;die&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;off&amp;quot;);&lt;br /&gt;
			Scan = TRUE;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer iNum) &lt;br /&gt;
	{&lt;br /&gt;
		integer p = 0;&lt;br /&gt;
		for (p = 0; p &amp;lt; iNum; ++p) &lt;br /&gt;
		{&lt;br /&gt;
			avKey = llDetectedKey(p);&lt;br /&gt;
			list_pos = llListFindList(key_list, (list)avKey);&lt;br /&gt;
			if (list_pos == -1) &lt;br /&gt;
			{&lt;br /&gt;
				key_list += (list) avKey;&lt;br /&gt;
				key_chan = (integer) llFrand(-1000000) - 1000000;&lt;br /&gt;
				llRezObject(&amp;quot;scan ball&amp;quot;, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);&lt;br /&gt;
				llSleep(.25);&lt;br /&gt;
				llRegionSay(key_chan, avKey);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	listen(integer c, string name, key id, string msg) &lt;br /&gt;
	{&lt;br /&gt;
		integer r = llListFindList(key_list,[(key)msg]);&lt;br /&gt;
		key_list = llDeleteSubList(key_list, r, r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Scan Ball Script==&lt;br /&gt;
Place this script in a prim and then place the prim into the inventory of the Scanner/Rezzer. It will automatically name itself. &lt;br /&gt;
&lt;br /&gt;
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:44:36&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
string avName;&lt;br /&gt;
integer avDistance;&lt;br /&gt;
key avKey;&lt;br /&gt;
integer avListen;&lt;br /&gt;
integer key_chan;&lt;br /&gt;
integer die_chan = -9423753;&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
vector avPos;&lt;br /&gt;
vector rPos;&lt;br /&gt;
key owner;&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		owner = llGetOwner(); // Lets check to see what the key of the owner of the object is and save it for later&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	on_rez(integer start_param)&lt;br /&gt;
	{&lt;br /&gt;
		rPos = llGetPos();&lt;br /&gt;
		key_chan = start_param;&lt;br /&gt;
		llListen(die_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		avListen = llListen(key_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	listen(integer c, string n, key id, string msg)&lt;br /&gt;
	{&lt;br /&gt;
		if (c == die_chan &amp;amp;&amp;amp; msg == &amp;quot;die&amp;quot; &amp;amp;&amp;amp; owner == llDetectedOwner(0)) //Lets check to see if the message we heard matches all the criteria for the kill command&lt;br /&gt;
		{                                                                 //(Right channel, right message and from radar owned by same owner)&lt;br /&gt;
			llDie();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
			avKey = (key) msg;&lt;br /&gt;
			avName = llKey2Name(avKey);&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, avKey, AGENT, 96, PI, 1.0);&lt;br /&gt;
			llListenRemove(avListen);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer n)&lt;br /&gt;
	{&lt;br /&gt;
		avPos = llDetectedPos(0);&lt;br /&gt;
		vector avDivPos = (avPos - rPos) / (96 / 1);	//Scan range/Radius of large sphere&lt;br /&gt;
		avDistance = (integer) llVecDist(rPos, llDetectedPos(0));&lt;br /&gt;
		llSetPos(rPos + avDivPos);&lt;br /&gt;
		llSetText(avName + &amp;quot;[&amp;quot; + (string) avDistance + &amp;quot;]&amp;quot;, &amp;lt;1, 1, 1 &amp;gt;, 1);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	no_sensor()&lt;br /&gt;
	{&lt;br /&gt;
		llRegionSay(key_rem_chan, avKey);&lt;br /&gt;
		llDie();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
{{LSLC|Library|3D Radar}}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192570</id>
		<title>3D Radar</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192570"/>
		<updated>2014-08-05T16:28:52Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Scan Ball Script */ - Removed line of code that names the object. According to the rezzer script, this prim should already be named and the name has no effect on the operation of the script.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header}}&lt;br /&gt;
&lt;br /&gt;
*[[User:Jesse_Barnett|Click Here]]  To see my page and more of my scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scripts have been corrected and working properly now==&lt;br /&gt;
&lt;br /&gt;
Rezzes a ball for each avatar in range. Each ball tracks it&#039;s on AV and displays distance.&lt;br /&gt;
&lt;br /&gt;
==Scanner/Rezzer Script==&lt;br /&gt;
Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.&lt;br /&gt;
&lt;br /&gt;
Suggestion: Create a sphere with a diameter of  2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it&#039;s avatar to a range of 96 meters.&lt;br /&gt;
&lt;br /&gt;
This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) &amp;amp; multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):&lt;br /&gt;
&lt;br /&gt;
1/96 = approximately 0.010417.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:43:28&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
integer Scan = TRUE;&lt;br /&gt;
string avKey;&lt;br /&gt;
integer list_pos;&lt;br /&gt;
list key_list;&lt;br /&gt;
integer key_chan;	//Key channel is generated randomly and passed to the scan ball&lt;br /&gt;
integer die_chan = -9423753;	//Hey pick your own channels and be sure to paste them into the scan balls too!&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer total_number) &lt;br /&gt;
	{&lt;br /&gt;
		if (Scan) &lt;br /&gt;
		{&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;, AGENT, 96, PI, 1);&lt;br /&gt;
			key_list =[];&lt;br /&gt;
			llListen(key_rem_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;on&amp;quot;);&lt;br /&gt;
			Scan = FALSE;&lt;br /&gt;
		}&lt;br /&gt;
		else &lt;br /&gt;
		{&lt;br /&gt;
			llSensorRemove();&lt;br /&gt;
			llRegionSay(die_chan, &amp;quot;die&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;off&amp;quot;);&lt;br /&gt;
			Scan = TRUE;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer iNum) &lt;br /&gt;
	{&lt;br /&gt;
		integer p = 0;&lt;br /&gt;
		for (p = 0; p &amp;lt; iNum; ++p) &lt;br /&gt;
		{&lt;br /&gt;
			avKey = llDetectedKey(p);&lt;br /&gt;
			list_pos = llListFindList(key_list, (list)avKey);&lt;br /&gt;
			if (list_pos == -1) &lt;br /&gt;
			{&lt;br /&gt;
				key_list += (list) avKey;&lt;br /&gt;
				key_chan = (integer) llFrand(-1000000) - 1000000;&lt;br /&gt;
				llRezObject(&amp;quot;scan ball&amp;quot;, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);&lt;br /&gt;
				llSleep(.25);&lt;br /&gt;
				llRegionSay(key_chan, avKey);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	listen(integer c, string name, key id, string msg) &lt;br /&gt;
	{&lt;br /&gt;
		integer r = llListFindList(key_list,[(key)msg]);&lt;br /&gt;
		key_list = llDeleteSubList(key_list, r, r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Scan Ball Script==&lt;br /&gt;
Place this script in a prim and then place the prim into the inventory of the Scanner/Rezzer. It will automatically name itself. &lt;br /&gt;
&lt;br /&gt;
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:44:36&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
string avName;&lt;br /&gt;
integer avDistance;&lt;br /&gt;
key avKey;&lt;br /&gt;
integer avListen;&lt;br /&gt;
integer key_chan;&lt;br /&gt;
integer die_chan = -9423753;&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
vector avPos;&lt;br /&gt;
vector rPos;&lt;br /&gt;
key owner;&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		owner = llGetOwner(); // Lets check to see what the key of the owner of the object is and save it for later&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	on_rez(integer start_param)&lt;br /&gt;
	{&lt;br /&gt;
		rPos = llGetPos();&lt;br /&gt;
		key_chan = start_param;&lt;br /&gt;
		llListen(die_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		avListen = llListen(key_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	listen(integer c, string n, key id, string msg)&lt;br /&gt;
	{&lt;br /&gt;
		if (c == die_chan &amp;amp;&amp;amp; msg == &amp;quot;die&amp;quot; &amp;amp;&amp;amp; owner == llDetectedOwner(0)) //Lets check to see if the message we heard matches all the criteria for the kill command (Right channel, right message and from radar owned by same owner)&lt;br /&gt;
		{&lt;br /&gt;
			llDie();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
			avKey = (key) msg;&lt;br /&gt;
			avName = llKey2Name(avKey);&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, avKey, AGENT, 96, PI, 1.0);&lt;br /&gt;
			llListenRemove(avListen);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer n)&lt;br /&gt;
	{&lt;br /&gt;
		avPos = llDetectedPos(0);&lt;br /&gt;
		vector avDivPos = (avPos - rPos) / (96 / 1);	//Scan range/Radius of large sphere&lt;br /&gt;
		avDistance = (integer) llVecDist(rPos, llDetectedPos(0));&lt;br /&gt;
		llSetPos(rPos + avDivPos);&lt;br /&gt;
		llSetText(avName + &amp;quot;[&amp;quot; + (string) avDistance + &amp;quot;]&amp;quot;, &amp;lt;1, 1, 1 &amp;gt;, 1);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	no_sensor()&lt;br /&gt;
	{&lt;br /&gt;
		llRegionSay(key_rem_chan, avKey);&lt;br /&gt;
		llDie();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
{{LSLC|Library|3D Radar}}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192569</id>
		<title>3D Radar</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192569"/>
		<updated>2014-08-05T16:27:53Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Scanner/Rezzer Script */ - Improved readability and removed redundant code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header}}&lt;br /&gt;
&lt;br /&gt;
*[[User:Jesse_Barnett|Click Here]]  To see my page and more of my scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scripts have been corrected and working properly now==&lt;br /&gt;
&lt;br /&gt;
Rezzes a ball for each avatar in range. Each ball tracks it&#039;s on AV and displays distance.&lt;br /&gt;
&lt;br /&gt;
==Scanner/Rezzer Script==&lt;br /&gt;
Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.&lt;br /&gt;
&lt;br /&gt;
Suggestion: Create a sphere with a diameter of  2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it&#039;s avatar to a range of 96 meters.&lt;br /&gt;
&lt;br /&gt;
This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) &amp;amp; multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):&lt;br /&gt;
&lt;br /&gt;
1/96 = approximately 0.010417.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:43:28&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
integer Scan = TRUE;&lt;br /&gt;
string avKey;&lt;br /&gt;
integer list_pos;&lt;br /&gt;
list key_list;&lt;br /&gt;
integer key_chan;	//Key channel is generated randomly and passed to the scan ball&lt;br /&gt;
integer die_chan = -9423753;	//Hey pick your own channels and be sure to paste them into the scan balls too!&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
&lt;br /&gt;
default &lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	touch_start(integer total_number) &lt;br /&gt;
	{&lt;br /&gt;
		if (Scan) &lt;br /&gt;
		{&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;, AGENT, 96, PI, 1);&lt;br /&gt;
			key_list =[];&lt;br /&gt;
			llListen(key_rem_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;on&amp;quot;);&lt;br /&gt;
			Scan = FALSE;&lt;br /&gt;
		}&lt;br /&gt;
		else &lt;br /&gt;
		{&lt;br /&gt;
			llSensorRemove();&lt;br /&gt;
			llRegionSay(die_chan, &amp;quot;die&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;off&amp;quot;);&lt;br /&gt;
			Scan = TRUE;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer iNum) &lt;br /&gt;
	{&lt;br /&gt;
		integer p = 0;&lt;br /&gt;
		for (p = 0; p &amp;lt; iNum; ++p) &lt;br /&gt;
		{&lt;br /&gt;
			avKey = llDetectedKey(p);&lt;br /&gt;
			list_pos = llListFindList(key_list, (list)avKey);&lt;br /&gt;
			if (list_pos == -1) &lt;br /&gt;
			{&lt;br /&gt;
				key_list += (list) avKey;&lt;br /&gt;
				key_chan = (integer) llFrand(-1000000) - 1000000;&lt;br /&gt;
				llRezObject(&amp;quot;scan ball&amp;quot;, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);&lt;br /&gt;
				llSleep(.25);&lt;br /&gt;
				llRegionSay(key_chan, avKey);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	listen(integer c, string name, key id, string msg) &lt;br /&gt;
	{&lt;br /&gt;
		integer r = llListFindList(key_list,[(key)msg]);&lt;br /&gt;
		key_list = llDeleteSubList(key_list, r, r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Scan Ball Script==&lt;br /&gt;
Place this script in a prim and then place the prim into the inventory of the Scanner/Rezzer. It will automatically name itself. &lt;br /&gt;
&lt;br /&gt;
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:44:36&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
string avName;&lt;br /&gt;
integer avDistance;&lt;br /&gt;
key avKey;&lt;br /&gt;
integer avListen;&lt;br /&gt;
integer key_chan;&lt;br /&gt;
integer die_chan = -9423753;&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
vector avPos;&lt;br /&gt;
vector rPos;&lt;br /&gt;
key owner;&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		llSetObjectName(&amp;quot;scan ball&amp;quot;); //Renames the object to &amp;quot;scan ball&amp;quot;&lt;br /&gt;
		owner = llGetOwner(); // Lets check to see what the key of the owner of the object is and save it for later&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	on_rez(integer start_param)&lt;br /&gt;
	{&lt;br /&gt;
		rPos = llGetPos();&lt;br /&gt;
		key_chan = start_param;&lt;br /&gt;
		llListen(die_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		avListen = llListen(key_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	listen(integer c, string n, key id, string msg)&lt;br /&gt;
	{&lt;br /&gt;
		if (c == die_chan &amp;amp;&amp;amp; msg == &amp;quot;die&amp;quot; &amp;amp;&amp;amp; owner == llDetectedOwner(0)) //Lets check to see if the message we heard matches all the criteria for the kill command (Right channel, right message and from radar owned by same owner)&lt;br /&gt;
		{&lt;br /&gt;
			llDie();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
			avKey = (key) msg;&lt;br /&gt;
			avName = llKey2Name(avKey);&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, avKey, AGENT, 96, PI, 1.0);&lt;br /&gt;
			llListenRemove(avListen);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer n)&lt;br /&gt;
	{&lt;br /&gt;
		avPos = llDetectedPos(0);&lt;br /&gt;
		vector avDivPos = (avPos - rPos) / (96 / 1);	//Scan range/Radius of large sphere&lt;br /&gt;
		avDistance = (integer) llVecDist(rPos, llDetectedPos(0));&lt;br /&gt;
		llSetPos(rPos + avDivPos);&lt;br /&gt;
		llSetText(avName + &amp;quot;[&amp;quot; + (string) avDistance + &amp;quot;]&amp;quot;, &amp;lt;1, 1, 1 &amp;gt;, 1);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	no_sensor()&lt;br /&gt;
	{&lt;br /&gt;
		llRegionSay(key_rem_chan, avKey);&lt;br /&gt;
		llDie();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
{{LSLC|Library|3D Radar}}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192568</id>
		<title>3D Radar</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192568"/>
		<updated>2014-08-05T16:22:41Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Scan Ball Script */ Improved readability and removed some redundant code (actually did it properly this time)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header}}&lt;br /&gt;
&lt;br /&gt;
*[[User:Jesse_Barnett|Click Here]]  To see my page and more of my scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scripts have been corrected and working properly now==&lt;br /&gt;
&lt;br /&gt;
Rezzes a ball for each avatar in range. Each ball tracks it&#039;s on AV and displays distance.&lt;br /&gt;
&lt;br /&gt;
==Scanner/Rezzer Script==&lt;br /&gt;
Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.&lt;br /&gt;
&lt;br /&gt;
Suggestion: Create a sphere with a diameter of  2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it&#039;s avatar to a range of 96 meters.&lt;br /&gt;
&lt;br /&gt;
This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) &amp;amp; multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):&lt;br /&gt;
&lt;br /&gt;
1/96 = approximately 0.010417.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:43:28&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
integer Scan = TRUE;&lt;br /&gt;
string avKey;&lt;br /&gt;
integer list_pos;&lt;br /&gt;
list key_list;&lt;br /&gt;
integer key_chan;	//Key channel is generated randomly and passed to the scan ball&lt;br /&gt;
integer die_chan = -9423753;	//Hey pick your own channels and be sure to paste them into&lt;br /&gt;
						//the scan balls too!&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
default {&lt;br /&gt;
	state_entry() {&lt;br /&gt;
		llSetObjectName(&amp;quot;3D Radar&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer total_number) {&lt;br /&gt;
		if (Scan) {&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;, AGENT, 96, PI, 1);&lt;br /&gt;
			key_list =[];&lt;br /&gt;
			llListen(key_rem_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;on&amp;quot;);&lt;br /&gt;
			Scan = FALSE;&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			llSensorRemove();&lt;br /&gt;
			llRegionSay(die_chan, &amp;quot;die&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;off&amp;quot;);&lt;br /&gt;
			Scan = TRUE;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	sensor(integer iNum) {&lt;br /&gt;
		integer p = 0;&lt;br /&gt;
		for (p = 0; p &amp;lt; iNum; ++p) {&lt;br /&gt;
			avKey = llDetectedKey(p);&lt;br /&gt;
			list_pos = llListFindList(key_list, (list)avKey);&lt;br /&gt;
			if (list_pos == -1) {&lt;br /&gt;
				key_list += (list) avKey;&lt;br /&gt;
				key_chan = (integer) llFrand(-1000000) - 1000000;&lt;br /&gt;
				llRezObject(&amp;quot;scan ball&amp;quot;, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);&lt;br /&gt;
				llSleep(.25);&lt;br /&gt;
				llRegionSay(key_chan, avKey);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	listen(integer c, string name, key id, string msg) {&lt;br /&gt;
		integer r = llListFindList(key_list,[(key)msg]);&lt;br /&gt;
		key_list = llDeleteSubList(key_list, r, r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
==Scan Ball Script==&lt;br /&gt;
Place this script in a prim and then place the prim into the inventory of the Scanner/Rezzer. It will automatically name itself. &lt;br /&gt;
&lt;br /&gt;
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:44:36&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
string avName;&lt;br /&gt;
integer avDistance;&lt;br /&gt;
key avKey;&lt;br /&gt;
integer avListen;&lt;br /&gt;
integer key_chan;&lt;br /&gt;
integer die_chan = -9423753;&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
vector avPos;&lt;br /&gt;
vector rPos;&lt;br /&gt;
key owner;&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		llSetObjectName(&amp;quot;scan ball&amp;quot;); //Renames the object to &amp;quot;scan ball&amp;quot;&lt;br /&gt;
		owner = llGetOwner(); // Lets check to see what the key of the owner of the object is and save it for later&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	on_rez(integer start_param)&lt;br /&gt;
	{&lt;br /&gt;
		rPos = llGetPos();&lt;br /&gt;
		key_chan = start_param;&lt;br /&gt;
		llListen(die_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		avListen = llListen(key_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	listen(integer c, string n, key id, string msg)&lt;br /&gt;
	{&lt;br /&gt;
		if (c == die_chan &amp;amp;&amp;amp; msg == &amp;quot;die&amp;quot; &amp;amp;&amp;amp; owner == llDetectedOwner(0)) //Lets check to see if the message we heard matches all the criteria for the kill command (Right channel, right message and from radar owned by same owner)&lt;br /&gt;
		{&lt;br /&gt;
			llDie();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
			avKey = (key) msg;&lt;br /&gt;
			avName = llKey2Name(avKey);&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, avKey, AGENT, 96, PI, 1.0);&lt;br /&gt;
			llListenRemove(avListen);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer n)&lt;br /&gt;
	{&lt;br /&gt;
		avPos = llDetectedPos(0);&lt;br /&gt;
		vector avDivPos = (avPos - rPos) / (96 / 1);	//Scan range/Radius of large sphere&lt;br /&gt;
		avDistance = (integer) llVecDist(rPos, llDetectedPos(0));&lt;br /&gt;
		llSetPos(rPos + avDivPos);&lt;br /&gt;
		llSetText(avName + &amp;quot;[&amp;quot; + (string) avDistance + &amp;quot;]&amp;quot;, &amp;lt;1, 1, 1 &amp;gt;, 1);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	no_sensor()&lt;br /&gt;
	{&lt;br /&gt;
		llRegionSay(key_rem_chan, avKey);&lt;br /&gt;
		llDie();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
{{LSLC|Library|3D Radar}}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192567</id>
		<title>3D Radar</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192567"/>
		<updated>2014-08-05T16:20:39Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: Undo revision 1192566 by Terk Resident (Talk) - Derp, accidentally wiped a section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header}}&lt;br /&gt;
&lt;br /&gt;
*[[User:Jesse_Barnett|Click Here]]  To see my page and more of my scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scripts have been corrected and working properly now==&lt;br /&gt;
&lt;br /&gt;
Rezzes a ball for each avatar in range. Each ball tracks it&#039;s on AV and displays distance.&lt;br /&gt;
&lt;br /&gt;
==Scanner/Rezzer Script==&lt;br /&gt;
Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.&lt;br /&gt;
&lt;br /&gt;
Suggestion: Create a sphere with a diameter of  2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it&#039;s avatar to a range of 96 meters.&lt;br /&gt;
&lt;br /&gt;
This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) &amp;amp; multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):&lt;br /&gt;
&lt;br /&gt;
1/96 = approximately 0.010417.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:43:28&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
integer Scan = TRUE;&lt;br /&gt;
string avKey;&lt;br /&gt;
integer list_pos;&lt;br /&gt;
list key_list;&lt;br /&gt;
integer key_chan;	//Key channel is generated randomly and passed to the scan ball&lt;br /&gt;
integer die_chan = -9423753;	//Hey pick your own channels and be sure to paste them into&lt;br /&gt;
						//the scan balls too!&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
default {&lt;br /&gt;
	state_entry() {&lt;br /&gt;
		llSetObjectName(&amp;quot;3D Radar&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer total_number) {&lt;br /&gt;
		if (Scan) {&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;, AGENT, 96, PI, 1);&lt;br /&gt;
			key_list =[];&lt;br /&gt;
			llListen(key_rem_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;on&amp;quot;);&lt;br /&gt;
			Scan = FALSE;&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			llSensorRemove();&lt;br /&gt;
			llRegionSay(die_chan, &amp;quot;die&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;off&amp;quot;);&lt;br /&gt;
			Scan = TRUE;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	sensor(integer iNum) {&lt;br /&gt;
		integer p = 0;&lt;br /&gt;
		for (p = 0; p &amp;lt; iNum; ++p) {&lt;br /&gt;
			avKey = llDetectedKey(p);&lt;br /&gt;
			list_pos = llListFindList(key_list, (list)avKey);&lt;br /&gt;
			if (list_pos == -1) {&lt;br /&gt;
				key_list += (list) avKey;&lt;br /&gt;
				key_chan = (integer) llFrand(-1000000) - 1000000;&lt;br /&gt;
				llRezObject(&amp;quot;scan ball&amp;quot;, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);&lt;br /&gt;
				llSleep(.25);&lt;br /&gt;
				llRegionSay(key_chan, avKey);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	listen(integer c, string name, key id, string msg) {&lt;br /&gt;
		integer r = llListFindList(key_list,[(key)msg]);&lt;br /&gt;
		key_list = llDeleteSubList(key_list, r, r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
==Scan Ball Script==&lt;br /&gt;
Place this script in a prim and then place the prim into the inventory of the Scanner/Rezzer. It will automatically name itself. &lt;br /&gt;
&lt;br /&gt;
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:44:36&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
string avName;&lt;br /&gt;
integer avDistance;&lt;br /&gt;
key avKey;&lt;br /&gt;
integer avListen;&lt;br /&gt;
integer key_chan;&lt;br /&gt;
integer die_chan = -9423753;&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
vector avPos;&lt;br /&gt;
vector rPos;&lt;br /&gt;
default {&lt;br /&gt;
	state_entry() {&lt;br /&gt;
		llSetObjectName(&amp;quot;scan ball&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	on_rez(integer start_param) {&lt;br /&gt;
		rPos = llGetPos();&lt;br /&gt;
		key_chan = start_param;&lt;br /&gt;
		llListen(die_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		avListen = llListen(key_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	listen(integer c, string n, key id, string msg) {&lt;br /&gt;
		if (c == die_chan &amp;amp;&amp;amp; msg == &amp;quot;die&amp;quot;) {&lt;br /&gt;
			key owner = llGetOwner();&lt;br /&gt;
  			if (owner == llDetectedOwner(0)) {&lt;br /&gt;
				llDie();&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			avKey = (key) msg;&lt;br /&gt;
			avName = llKey2Name(avKey);&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, avKey, AGENT, 96, PI, 1.0);&lt;br /&gt;
			llListenRemove(avListen);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	sensor(integer n) {&lt;br /&gt;
		avPos = llDetectedPos(0);&lt;br /&gt;
		vector avDivPos = (avPos - rPos) / (96 / 1);	//Scan range/Radius of large sphere&lt;br /&gt;
		avDistance = (integer) llVecDist(rPos, llDetectedPos(0));&lt;br /&gt;
		llSetPos(rPos + avDivPos);&lt;br /&gt;
		llSetText(avName + &amp;quot;[&amp;quot; + (string) avDistance + &amp;quot;]&amp;quot;, &amp;lt;1, 1, 1 &amp;gt;, 1);&lt;br /&gt;
	}&lt;br /&gt;
	no_sensor() {&lt;br /&gt;
		llRegionSay(key_rem_chan, avKey);&lt;br /&gt;
		llDie();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
{{LSLC|Library|3D Radar}}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192566</id>
		<title>3D Radar</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192566"/>
		<updated>2014-08-05T16:19:01Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Scan Ball Script */ Improved readability and removed some redundant code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header}}&lt;br /&gt;
&lt;br /&gt;
*[[User:Jesse_Barnett|Click Here]]  To see my page and more of my scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scripts have been corrected and working properly now==&lt;br /&gt;
&lt;br /&gt;
Rezzes a ball for each avatar in range. Each ball tracks it&#039;s on AV and displays distance.&lt;br /&gt;
&lt;br /&gt;
==Scanner/Rezzer Script==&lt;br /&gt;
Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.&lt;br /&gt;
&lt;br /&gt;
Suggestion: Create a sphere with a diameter of  2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it&#039;s avatar to a range of 96 meters.&lt;br /&gt;
&lt;br /&gt;
This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) &amp;amp; multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):&lt;br /&gt;
&lt;br /&gt;
1/96 = approximately 0.010417.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:43:28&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
integer Scan = TRUE;&lt;br /&gt;
string avKey;&lt;br /&gt;
integer list_pos;&lt;br /&gt;
list key_list;&lt;br /&gt;
integer key_chan;	//Key channel is generated randomly and passed to the scan ball&lt;br /&gt;
integer die_chan = -9423753;	//Hey pick your own channels and be sure to paste them into&lt;br /&gt;
						//the scan balls too!&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
default {&lt;br /&gt;
	state_entry() {&lt;br /&gt;
		llSetObjectName(&amp;quot;3D Radar&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer total_number) {&lt;br /&gt;
		if (Scan) {&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;, AGENT, 96, PI, 1);&lt;br /&gt;
			key_list =[];&lt;br /&gt;
			llListen(key_rem_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;on&amp;quot;);&lt;br /&gt;
			Scan = FALSE;&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			llSensorRemove();&lt;br /&gt;
			llRegionSay(die_chan, &amp;quot;die&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;off&amp;quot;);&lt;br /&gt;
			Scan = TRUE;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	sensor(integer iNum) {&lt;br /&gt;
		integer p = 0;&lt;br /&gt;
		for (p = 0; p &amp;lt; iNum; ++p) {&lt;br /&gt;
			avKey = llDetectedKey(p);&lt;br /&gt;
			list_pos = llListFindList(key_list, (list)avKey);&lt;br /&gt;
			if (list_pos == -1) {&lt;br /&gt;
				key_list += (list) avKey;&lt;br /&gt;
				key_chan = (integer) llFrand(-1000000) - 1000000;&lt;br /&gt;
				llRezObject(&amp;quot;scan ball&amp;quot;, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);&lt;br /&gt;
				llSleep(.25);&lt;br /&gt;
				llRegionSay(key_chan, avKey);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	listen(integer c, string name, key id, string msg) {&lt;br /&gt;
		integer r = llListFindList(key_list,[(key)msg]);&lt;br /&gt;
		key_list = llDeleteSubList(key_list, r, r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
string avName;&lt;br /&gt;
integer avDistance;&lt;br /&gt;
key avKey;&lt;br /&gt;
integer avListen;&lt;br /&gt;
integer key_chan;&lt;br /&gt;
integer die_chan = -9423753;&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
vector avPos;&lt;br /&gt;
vector rPos;&lt;br /&gt;
key owner;&lt;br /&gt;
 &lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
	state_entry()&lt;br /&gt;
	{&lt;br /&gt;
		llSetObjectName(&amp;quot;scan ball&amp;quot;); //Renames the object to &amp;quot;scan ball&amp;quot;&lt;br /&gt;
		owner = llGetOwner(); // Lets check to see what the key of the owner of the object is and save it for later&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	on_rez(integer start_param)&lt;br /&gt;
	{&lt;br /&gt;
		rPos = llGetPos();&lt;br /&gt;
		key_chan = start_param;&lt;br /&gt;
		llListen(die_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		avListen = llListen(key_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	listen(integer c, string n, key id, string msg)&lt;br /&gt;
	{&lt;br /&gt;
		if (c == die_chan &amp;amp;&amp;amp; msg == &amp;quot;die&amp;quot; &amp;amp;&amp;amp; owner == llDetectedOwner(0)) //Lets check to see if the message we heard matches all the criteria for the kill command (Right channel, right message and from radar owned by same owner)&lt;br /&gt;
		{&lt;br /&gt;
			llDie();&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		else&lt;br /&gt;
		{&lt;br /&gt;
			avKey = (key) msg;&lt;br /&gt;
			avName = llKey2Name(avKey);&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, avKey, AGENT, 96, PI, 1.0);&lt;br /&gt;
			llListenRemove(avListen);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	sensor(integer n)&lt;br /&gt;
	{&lt;br /&gt;
		avPos = llDetectedPos(0);&lt;br /&gt;
		vector avDivPos = (avPos - rPos) / (96 / 1);	//Scan range/Radius of large sphere&lt;br /&gt;
		avDistance = (integer) llVecDist(rPos, llDetectedPos(0));&lt;br /&gt;
		llSetPos(rPos + avDivPos);&lt;br /&gt;
		llSetText(avName + &amp;quot;[&amp;quot; + (string) avDistance + &amp;quot;]&amp;quot;, &amp;lt;1, 1, 1 &amp;gt;, 1);&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	no_sensor()&lt;br /&gt;
	{&lt;br /&gt;
		llRegionSay(key_rem_chan, avKey);&lt;br /&gt;
		llDie();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
	<entry>
		<id>https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192565</id>
		<title>3D Radar</title>
		<link rel="alternate" type="text/html" href="https://wiki.secondlife.com/w/index.php?title=3D_Radar&amp;diff=1192565"/>
		<updated>2014-08-05T15:36:41Z</updated>

		<summary type="html">&lt;p&gt;Terk Resident: /* Scan Ball Script */  - Fixed broken and badly implemented if statement before running llDie() on the scan ball.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{LSL Header}}&lt;br /&gt;
&lt;br /&gt;
*[[User:Jesse_Barnett|Click Here]]  To see my page and more of my scripts&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Scripts have been corrected and working properly now==&lt;br /&gt;
&lt;br /&gt;
Rezzes a ball for each avatar in range. Each ball tracks it&#039;s on AV and displays distance.&lt;br /&gt;
&lt;br /&gt;
==Scanner/Rezzer Script==&lt;br /&gt;
Place this script in a prim along with the scan ball. When touched it will scan the surrounding area and rezz a ball for each avatar.&lt;br /&gt;
&lt;br /&gt;
Suggestion: Create a sphere with a diameter of  2 meters. Set transparency about 60. Create another sphere about 0.05 diameter, color a dark color and put it in the center of the large prim. Select small prim 1st and then large prim and link them. This will give you a center point to reference. The scan ball script is set to scan for it&#039;s avatar to a range of 96 meters.&lt;br /&gt;
&lt;br /&gt;
This formula: vector avDivPos = (avPos - rPos) * 0.010417; Takes the (avatars position - position of scanner) &amp;amp; multiplies by (radius of the distance you want the balls to go(2 meter sphere = 1 meter radius)/scan range(96meters)):&lt;br /&gt;
&lt;br /&gt;
1/96 = approximately 0.010417.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:43:28&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
integer Scan = TRUE;&lt;br /&gt;
string avKey;&lt;br /&gt;
integer list_pos;&lt;br /&gt;
list key_list;&lt;br /&gt;
integer key_chan;	//Key channel is generated randomly and passed to the scan ball&lt;br /&gt;
integer die_chan = -9423753;	//Hey pick your own channels and be sure to paste them into&lt;br /&gt;
						//the scan balls too!&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
default {&lt;br /&gt;
	state_entry() {&lt;br /&gt;
		llSetObjectName(&amp;quot;3D Radar&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	touch_start(integer total_number) {&lt;br /&gt;
		if (Scan) {&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, &amp;quot;&amp;quot;, AGENT, 96, PI, 1);&lt;br /&gt;
			key_list =[];&lt;br /&gt;
			llListen(key_rem_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;on&amp;quot;);&lt;br /&gt;
			Scan = FALSE;&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			llSensorRemove();&lt;br /&gt;
			llRegionSay(die_chan, &amp;quot;die&amp;quot;);&lt;br /&gt;
			llOwnerSay(&amp;quot;off&amp;quot;);&lt;br /&gt;
			Scan = TRUE;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	sensor(integer iNum) {&lt;br /&gt;
		integer p = 0;&lt;br /&gt;
		for (p = 0; p &amp;lt; iNum; ++p) {&lt;br /&gt;
			avKey = llDetectedKey(p);&lt;br /&gt;
			list_pos = llListFindList(key_list, (list)avKey);&lt;br /&gt;
			if (list_pos == -1) {&lt;br /&gt;
				key_list += (list) avKey;&lt;br /&gt;
				key_chan = (integer) llFrand(-1000000) - 1000000;&lt;br /&gt;
				llRezObject(&amp;quot;scan ball&amp;quot;, llGetPos(), ZERO_VECTOR, ZERO_ROTATION, key_chan);&lt;br /&gt;
				llSleep(.25);&lt;br /&gt;
				llRegionSay(key_chan, avKey);&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	listen(integer c, string name, key id, string msg) {&lt;br /&gt;
		integer r = llListFindList(key_list,[(key)msg]);&lt;br /&gt;
		key_list = llDeleteSubList(key_list, r, r);&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
==Scan Ball Script==&lt;br /&gt;
Place this script in a prim and then place the prim into the inventory of the Scanner/Rezzer. It will automatically name itself. &lt;br /&gt;
&lt;br /&gt;
Suggestion; Create a sphere prim of 0.05 diameter with glow set about .80.&lt;br /&gt;
&amp;lt;lsl&amp;gt;&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
//				3D Radar 2.5&lt;br /&gt;
// 				&amp;quot;Oct 15 2008&amp;quot;, &amp;quot;18:44:36&amp;quot;&lt;br /&gt;
// 				Creator: Jesse Barnett&lt;br /&gt;
//				Released into the Public Domain&lt;br /&gt;
//////////////////////////////////////////////////////////////////////////////////////////////////////&lt;br /&gt;
&lt;br /&gt;
string avName;&lt;br /&gt;
integer avDistance;&lt;br /&gt;
key avKey;&lt;br /&gt;
integer avListen;&lt;br /&gt;
integer key_chan;&lt;br /&gt;
integer die_chan = -9423753;&lt;br /&gt;
integer key_rem_chan = -49222879;&lt;br /&gt;
vector avPos;&lt;br /&gt;
vector rPos;&lt;br /&gt;
default {&lt;br /&gt;
	state_entry() {&lt;br /&gt;
		llSetObjectName(&amp;quot;scan ball&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	on_rez(integer start_param) {&lt;br /&gt;
		rPos = llGetPos();&lt;br /&gt;
		key_chan = start_param;&lt;br /&gt;
		llListen(die_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		avListen = llListen(key_chan, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
	}&lt;br /&gt;
	listen(integer c, string n, key id, string msg) {&lt;br /&gt;
		if (c == die_chan &amp;amp;&amp;amp; msg == &amp;quot;die&amp;quot;) {&lt;br /&gt;
			key owner = llGetOwner();&lt;br /&gt;
  			if (owner == llDetectedOwner(0)) {&lt;br /&gt;
				llDie();&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
		else {&lt;br /&gt;
			avKey = (key) msg;&lt;br /&gt;
			avName = llKey2Name(avKey);&lt;br /&gt;
			llSensorRepeat(&amp;quot;&amp;quot;, avKey, AGENT, 96, PI, 1.0);&lt;br /&gt;
			llListenRemove(avListen);&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	sensor(integer n) {&lt;br /&gt;
		avPos = llDetectedPos(0);&lt;br /&gt;
		vector avDivPos = (avPos - rPos) / (96 / 1);	//Scan range/Radius of large sphere&lt;br /&gt;
		avDistance = (integer) llVecDist(rPos, llDetectedPos(0));&lt;br /&gt;
		llSetPos(rPos + avDivPos);&lt;br /&gt;
		llSetText(avName + &amp;quot;[&amp;quot; + (string) avDistance + &amp;quot;]&amp;quot;, &amp;lt;1, 1, 1 &amp;gt;, 1);&lt;br /&gt;
	}&lt;br /&gt;
	no_sensor() {&lt;br /&gt;
		llRegionSay(key_rem_chan, avKey);&lt;br /&gt;
		llDie();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/lsl&amp;gt;&lt;br /&gt;
{{LSLC|Library|3D Radar}}&lt;/div&gt;</summary>
		<author><name>Terk Resident</name></author>
	</entry>
</feed>