https://wiki.secondlife.com/w/index.php?title=Scripted_Attachment_Detector.lsl&feed=atom&action=historyScripted Attachment Detector.lsl - Revision history2024-03-29T06:25:39ZRevision history for this page on the wikiMediaWiki 1.36.1https://wiki.secondlife.com/w/index.php?title=Scripted_Attachment_Detector.lsl&diff=1195136&oldid=prevObviousAltIsObvious Resident: <lsl> tag to <source>2015-01-25T15:55:11Z<p><lsl> tag to <source></p>
<table style="background-color: #fff; color: #202122;" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr class="diff-title" lang="en">
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 15:55, 25 January 2015</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l31">Line 31:</td>
<td colspan="2" class="diff-lineno">Line 31:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=Scripted Attachment Detector.lsl=</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>=Scripted Attachment Detector.lsl=</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br/></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div><<del style="font-weight: bold; text-decoration: none;">lsl</del>></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><<ins style="font-weight: bold; text-decoration: none;">source lang="lsl2"</ins>></div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>//***********************************************************************************************************</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>//***********************************************************************************************************</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>// *</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>// *</div></td></tr>
<tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l179">Line 179:</td>
<td colspan="2" class="diff-lineno">Line 179:</td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> }</div></td></tr>
<tr><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td><td class="diff-marker"></td><td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>}</div></td></tr>
<tr><td class="diff-marker" data-marker="−"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div></<del style="font-weight: bold; text-decoration: none;">lsl</del>></div></td><td class="diff-marker" data-marker="+"></td><td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div></<ins style="font-weight: bold; text-decoration: none;">source</ins>></div></td></tr>
</table>ObviousAltIsObvious Residenthttps://wiki.secondlife.com/w/index.php?title=Scripted_Attachment_Detector.lsl&diff=687592&oldid=prevBobbyb30 Swashbuckler: created scripted attachment detection script2009-12-15T14:01:19Z<p>created scripted attachment detection script</p>
<p><b>New page</b></p><div>{{LSL Header}}{{RightToc}}<br />
<br />
Scripted Attachment Dectector.lsl - Linden Scripting Language (LSL)<br />
Version 1.0.2<br />
<br />
=Description=<br />
This script will show up to 16 scripted avatars within the sensor's reach and display their name in hovertext. You may also touch the prim to get a list of the scripted avatars. It can also show their distances. It will reset when rezzed, worn, or transferred to a new owner. It is LSL & Mono compatible.<br />
<br />
Please note: It does not show its owner, whether or not they are scripted.<br />
<br />
It was written in LSLEditor.<br />
<br />
= Creator =<br />
*{{User|Bobbyb30 Swashbuckler}} -- Devolper<br />
<br />
= Contributors =<br />
If you modify/improve upon the script, please add your name here.<br />
<br />
= License =<br />
This work is hereby released in Public Domain.<br />
<br />
= Disclaimer =<br />
This program is distributed in the hope that it will be useful, but '''WITHOUT ANY WARRANTY'''; without even the implied warranty of '''MERCHANTABILITY''' or '''FITNESS FOR A PARTICULAR PURPOSE'''.<br />
<br />
=Purpose=<br />
* To display a hovertext of which avatars are scripted.<br />
<br />
= Documentation =<br />
Create a prim. Drop this script in. Modify the global user variables. Compile in mono. Attach of leave as rezzed prim. Enjoy.=D<br />
<br />
=Scripted Attachment Detector.lsl=<br />
<br />
<lsl><br />
//***********************************************************************************************************<br />
// *<br />
// --Scripted Attachment Detector-- *<br />
// *<br />
//***********************************************************************************************************<br />
// www.lsleditor.org by Alphons van der Heijden (SL: Alphons Jano)<br />
//Creator: Bobbyb30 Swashbuckler<br />
//Attribution: None required, but it is appreciated.<br />
//Created: December 13, 2009<br />
//Last Modified: December 13, 2009<br />
//Released: Tuesday, December 15, 2009<br />
//License: Public Domain<br />
<br />
//Status: Fully Working/Production Ready<br />
//Version: 1.0.2<br />
<br />
//Name: Scripted Attachment Detector.lsl<br />
//Purpose: To show scripted avatars within the sensor's radius<br />
//Technical Overview: Uses a sensor and exclusion list.<br />
//Description: This script will shows scripted avatars within the sensor's reach and display their name in hovertext.<br />
// You may also touch the prim to get a list of the avatars. It can also show their distances. It will<br />
// reset when rezzed, or first worn.<br />
//Directions: Create a prim. Place this script in the prim. Modify the parameters as needed. Save the script. Enjoy.<br />
//Compatible: Mono & LSL compatible<br />
//Other items required:<br />
//Notes: Uses a sensorrepeat. This will cover up to 16 avatars that are in range.<br />
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////<br />
<br />
/////////////////////////<br />
//global user variables, you may change these<br />
<br />
//hovertext<br />
vector hovercolor = <1.0,1.0,1.0>;//color of hovertext<br />
float hoveralpha = 1.0;//alpha of hovertext, 1 for solid, or 0 to not show hovertext<br />
<br />
//sensor<br />
float range = 96.0;//how far to scan out in meters up to 96...(this is the radius)<br />
float interval = 30.0;//how often to scan for in seconds <br />
<br />
//distance<br />
integer showdistance = TRUE;//TRUE/FALSE whether to show the distance of the avatar next to their name<br />
//example: Billy Joe (4m)<br />
<br />
//exclude list<br />
// CaSe does *NOT* matter, but spelling counts!<br />
list exclude = ["John Doe","Santa Clause","Barrack Obama","Homeland Security", "Saddam Hussain","Big Oil"];//'people' to exclude<br />
<br />
<br />
///////////////////////////////////<br />
//global variables...don't change below<br />
list scriptedavatars;//names of avatars who are scripted<br />
list correctedexclusion;//the exclusion list in lowercase+owner<br />
<br />
///////////////////<br />
//user functions, dont change<br />
hovertext(string input)//sets the hovertext<br />
{<br />
llSetText(input,hovercolor,hoveralpha);<br />
}<br />
<br />
default<br />
{<br />
on_rez(integer start_param)<br />
{<br />
if(!llGetAttached())//its not attatched, but was rezzed on the ground<br />
llResetScript();<br />
}<br />
attach(key attached)<br />
{<br />
if(attached != NULL_KEY)//they just put it on<br />
llResetScript();<br />
}<br />
state_entry()<br />
{<br />
llSensorRepeat("","",AGENT,range,TWO_PI,interval);//scan every so many seconds<br />
<br />
//add owner to exclude list<br />
exclude += llKey2Name(llGetOwner());<br />
<br />
//correct case on exclude list to lowercase and copy to correctexclusion list<br />
integer counter;<br />
integer excludelength = llGetListLength(exclude);<br />
do<br />
{<br />
correctedexclusion += llToLower(llList2String(exclude,counter));//add lowercase version to corrected exclusion<br />
}while(++counter < excludelength);<br />
<br />
//empty the exclude list to save memory<br />
exclude = [];//clears exclude list<br />
llOwnerSay("Scripted Attatchment.lsl (Public Domain 2009) by Bobbyb30 Swashbuckler running.");<br />
llOwnerSay("I will scan " + (string)llRound(range) + "m every " + (string)llRound(interval) + " seconds.");<br />
<br />
}<br />
touch_start(integer total_number)<br />
{<br />
if(llDetectedKey(0) == llGetOwner())//make sure owner touched<br />
llOwnerSay("The following avatar(s) have scripted attatchments: \n" +<br />
llDumpList2String(scriptedavatars,", "));//if you want one per line, do "\n"<br />
}<br />
sensor(integer total_number)//avatars were found<br />
{<br />
//llOwnerSay((string)llGetListLength(exclude));<br />
<br />
//set scriptedavatars to nothing, and then rebuild list based on new finds<br />
scriptedavatars = [];//clean up old list<br />
<br />
//build scriptedavatars list<br />
integer counter;<br />
vector mypos = llGetPos();//for use in determining distance, faster to call once, though less accurate I guess<br />
do<br />
{<br />
string detectedavatarname = llDetectedName(counter);//avatar name<br />
if(llListFindList(correctedexclusion,[llToLower(detectedavatarname)]) == -1)//check if they are excluded<br />
{<br />
if(llGetAgentInfo(llDetectedKey(counter)) & AGENT_SCRIPTED)//if the agent is scripted, add to list<br />
{<br />
if(showdistance)//if showdistance == TRUE, append detectedavatarname with avatar distance<br />
detectedavatarname += "(" + (string)llRound(llVecDist(llDetectedPos(counter),mypos)) + ")";//add avatar distance<br />
scriptedavatars += detectedavatarname;//not excluded and scripted so add to list<br />
}<br />
}<br />
}while(++counter < total_number);<br />
//end of build<br />
<br />
<br />
//display scripted avatars in hovertext if any<br />
<br />
//get the length of scriptedavatars list to see if anyone was scripted<br />
integer scriptedavatarslength = llGetListLength(scriptedavatars);//<br />
<br />
if(scriptedavatarslength)//the list isn't empty so someone must have been scripted<br />
hovertext("* " + (string)llGetListLength(scriptedavatars) + " scripted avatars found *\n" +<br />
llDumpList2String(scriptedavatars,"\n"));//set the hovertext to display the scripted avatars, will truncate at x chrs<br />
else//no scripted avatars found<br />
hovertext("* No scripted avatars found *");<br />
}<br />
no_sensor()//this shouldn't trigger as its meant to be an attatchment, but if no avatars, this will trigger<br />
{<br />
hovertext("* No avatars detected *");//display no avatars for hovertext<br />
}<br />
changed(integer change)<br />
{<br />
if(change & CHANGED_OWNER)//new owner, reset script<br />
llResetScript();<br />
}<br />
}<br />
</lsl></div>Bobbyb30 Swashbuckler