Scripted Agents attachment detector

Répondre
Partager Rechercher
Hi,

i have found this:

Code:
//***********************************************************************************************************
//                                                                                                          *
//                                     --Scripted Attachment Detector--                                     *
//                                                                                                          *
//***********************************************************************************************************
// www.lsleditor.org  by Alphons van der Heijden (SL: Alphons Jano)
//Creator: Bobbyb30 Swashbuckler
//Attribution: None required, but it is appreciated.
//Created: December 13, 2009
//Last Modified: December 13, 2009
//Released: Tuesday, December 15, 2009
//License: Public Domain
 
//Status: Fully Working/Production Ready
//Version: 1.0.2
 
//Name: Scripted Attachment Detector.lsl
//Purpose: To show scripted avatars within the sensor's radius
//Technical Overview: Uses a sensor and exclusion list.
//Description: This script will shows 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 avatars. It can also show their distances. It will
//             reset when rezzed, or first worn.
//Directions: Create a prim. Place this script in the prim. Modify the parameters as needed. Save the script. Enjoy.
//Compatible: Mono & LSL compatible
//Other items required:
//Notes: Uses a sensorrepeat. This will cover up to 16 avatars that are in range.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/////////////////////////
//global user variables, you may change these
 
//hovertext
vector hovercolor = <1.0,1.0,1.0>;//color of hovertext
float hoveralpha = 1.0;//alpha of hovertext, 1 for solid, or 0 to not show hovertext
 
//sensor
float range = 96.0;//how far to scan out in meters up to 96...(this is the radius)
float interval = 30.0;//how often to scan for in seconds 
 
//distance
integer showdistance = TRUE;//TRUE/FALSE whether to show the distance of the avatar next to their name
//example: Billy Joe (4m)
 
//exclude list
// CaSe does *NOT* matter, but spelling counts!
list exclude = ["John Doe","Santa Clause","Barrack Obama","Homeland Security", "Saddam Hussain","Big Oil"];//'people' to exclude
 
 
///////////////////////////////////
//global variables...don't change below
list scriptedavatars;//names of avatars who are scripted
list correctedexclusion;//the exclusion list in lowercase+owner
 
///////////////////
//user functions, dont change
hovertext(string input)//sets the hovertext
{
    llSetText(input,hovercolor,hoveralpha);
}
 
default
{
    on_rez(integer start_param)
    {
        if(!llGetAttached())//its not attatched, but was rezzed on the ground
            llResetScript();
    }
    attach(key attached)
    {
        if(attached != NULL_KEY)//they just put it on
            llResetScript();
    }
    state_entry()
    {
        llSensorRepeat("","",AGENT,range,TWO_PI,interval);//scan every so many seconds
 
        //add owner to exclude list
        exclude += llKey2Name(llGetOwner());
 
        //correct case on exclude list to lowercase and copy to correctexclusion list
        integer counter;
        integer excludelength = llGetListLength(exclude);
        do
        {
            correctedexclusion += llToLower(llList2String(exclude,counter));//add lowercase version to corrected exclusion
        }while(++counter < excludelength);
 
        //empty the exclude list to save memory
        exclude = [];//clears exclude list
        llOwnerSay("Scripted Attatchment.lsl (Public Domain 2009) by Bobbyb30 Swashbuckler running.");
        llOwnerSay("I will scan " + (string)llRound(range) + "m every " + (string)llRound(interval) + " seconds.");
 
    }
    touch_start(integer total_number)
    {
        if(llDetectedKey(0) == llGetOwner())//make sure owner touched
            llOwnerSay("The following avatar(s) have scripted attatchments: \n" +
            llDumpList2String(scriptedavatars,", "));//if you want one per line, do "\n"
    }
    sensor(integer total_number)//avatars were found
    {
        //llOwnerSay((string)llGetListLength(exclude));
 
        //set scriptedavatars to nothing, and then rebuild list based on new finds
        scriptedavatars = [];//clean up old list
 
        //build scriptedavatars list
        integer counter;
        vector mypos = llGetPos();//for use in determining distance, faster to call once, though less accurate I guess
        do
        {
            string detectedavatarname = llDetectedName(counter);//avatar name
            if(llListFindList(correctedexclusion,[llToLower(detectedavatarname)]) == -1)//check if they are excluded
            {
                if(llGetAgentInfo(llDetectedKey(counter)) & AGENT_SCRIPTED)//if the agent is scripted, add to list
                {
                    if(showdistance)//if showdistance == TRUE, append detectedavatarname with avatar distance
                        detectedavatarname += "(" + (string)llRound(llVecDist(llDetectedPos(counter),mypos)) + ")";//add avatar distance
                    scriptedavatars += detectedavatarname;//not excluded and scripted so add to list
                }
            }
        }while(++counter < total_number);
        //end of build
 
 
        //display scripted avatars in hovertext if any
 
        //get the length of scriptedavatars list to see if anyone was scripted
        integer scriptedavatarslength = llGetListLength(scriptedavatars);//
 
        if(scriptedavatarslength)//the list isn't empty so someone must have been scripted
            hovertext("* " + (string)llGetListLength(scriptedavatars) + " scripted avatars found *\n" +
            llDumpList2String(scriptedavatars,"\n"));//set the hovertext to display the scripted avatars, will truncate at x chrs
        else//no scripted avatars found
            hovertext("* No scripted avatars found *");
    }
    no_sensor()//this shouldn't trigger as its meant to be an attatchment, but if no avatars, this will trigger
    {
        hovertext("* No avatars detected *");//display no avatars for hovertext
    }
    changed(integer change)
    {
        if(change & CHANGED_OWNER)//new owner, reset script
            llResetScript();
    }
}


It can be used as rezzed and as a hud, but i don't want any text above the prim (i deleted the lines), but it doesn't, output anything in main chat,
i only get this line:
'The following avatar (s) have scripted attatchments:'

I would like to have the output of scripted agent in chat ^^

Dernière modification par SphinxRa ; 08/02/2021 à 16h26.
hey, this is......absolutely nothing! you can trash it....or maybe, you missed to copy a script or a part of it.....for now....it isn't a script at all...so, ther's nothing to do with it
put this in a clean prim or mesh (no hovertext)

vector hovercolor = <1.0,1.0,1.0>;//color of hovertext
float hoveralpha = 1.0;//alpha of hovertext, 1 for solid, or 0 to not show hovertext

//sensor
float range = 96.0;//how far to scan out in meters up to 96...(this is the radius)
float interval = 30.0;//how often to scan for in seconds

//distance
integer showdistance = TRUE;//TRUE/FALSE whether to show the distance of the avatar next to their name
//example: Billy Joe (4m)

//exclude list
// CaSe does *NOT* matter, but spelling counts!
list exclude = ["John Doe","Santa Clause","Barrack Obama","Homeland Security", "Saddam Hussain","Big Oil"];//'people' to exclude


///////////////////////////////////
//global variables...don't change below
list scriptedavatars;//names of avatars who are scripted
list correctedexclusion;//the exclusion list in lowercase+owner

///////////////////
default
{
on_rez(integer start_param)
{
if(!llGetAttached())//its not attatched, but was rezzed on the ground
llResetScript();
}
attach(key attached)
{
if(attached != NULL_KEY)//they just put it on
llResetScript();
}
state_entry()
{
llSensorRepeat("","",AGENT,range,TWO_PI,interval);//scan every so many seconds

//add owner to exclude list
exclude += llKey2Name(llGetOwner());

//correct case on exclude list to lowercase and copy to correctexclusion list
integer counter;
integer excludelength = llGetListLength(exclude);
do
{
correctedexclusion += llToLower(llList2String(exclude,counter));//add lowercase version to corrected exclusion
}while(++counter < excludelength);

//empty the exclude list to save memory
exclude = [];//clears exclude list
llOwnerSay("Scripted Attatchment.lsl (Public Domain 2009) by Bobbyb30 Swashbuckler running.");
llOwnerSay("I will scan " + (string)llRound(range) + "m every " + (string)llRound(interval) + " seconds.");

}
touch_start(integer total_number)
{
if(llDetectedKey(0) == llGetOwner())//make sure owner touched
llOwnerSay("The following avatar(s) have scripted attatchments: \n" +
llDumpList2String(scriptedavatars,", "));//if you want one per line, do "\n"
}
sensor(integer total_number)//avatars were found
{
//llOwnerSay((string)llGetListLength(exclude));

//set scriptedavatars to nothing, and then rebuild list based on new finds
scriptedavatars = [];//clean up old list

//build scriptedavatars list
integer counter;
vector mypos = llGetPos();//for use in determining distance, faster to call once, though less accurate I guess
do
{
string detectedavatarname = llDetectedName(counter);//avatar name
if(llListFindList(correctedexclusion,[llToLower(detectedavatarname)]) == -1)//check if they are excluded
{
if(llGetAgentInfo(llDetectedKey(counter)) & AGENT_SCRIPTED)//if the agent is scripted, add to list
{
if(showdistance)//if showdistance == TRUE, append detectedavatarname with avatar distance
detectedavatarname += "(" + (string)llRound(llVecDist(llDetectedPos(counter),mypos)) + ")";//add avatar distance
scriptedavatars += detectedavatarname;//not excluded and scripted so add to list
}
}
}while(++counter < total_number);
//end of build


//display scripted avatars in hovertext if any

//get the length of scriptedavatars list to see if anyone was scripted
integer scriptedavatarslength = llGetListLength(scriptedavatars);//

if(scriptedavatarslength)//the list isn't empty so someone must have been scripted
llSay(0,"* " + (string)llGetListLength(scriptedavatars) + " scripted avatars found *\n" +
llDumpList2String(scriptedavatars,"\n"));//set the hovertext to display the scripted avatars, will truncate at x chrs
else//no scripted avatars found
llSay(0,"* No scripted avatars found *");
}
no_sensor()//this shouldn't trigger as its meant to be an attatchment, but if no avatars, this will trigger
{
llSay(0,"* No avatars detected *");//display no avatars for hovertext
}
changed(integer change)
{
if(change & CHANGED_OWNER)//new owner, reset script
llResetScript();
}
}
Hi works, ty again, but it does now scan every few seconds, i would like to add this in my own AIO hud, so press / touch it and see the scripted avatars (including owner )
and only owner sees it only, as now everybody can see in chat^^
vector hovercolor = <1.0,1.0,1.0>;//color of hovertext
float hoveralpha = 1.0;//alpha of hovertext, 1 for solid, or 0 to not show hovertext

//sensor
float range = 96.0;//how far to scan out in meters up to 96...(this is the radius)
float interval = 30.0;//how often to scan for in seconds

//distance
integer showdistance = TRUE;//TRUE/FALSE whether to show the distance of the avatar next to their name
//example: Billy Joe (4m)

//exclude list
// CaSe does *NOT* matter, but spelling counts!
list exclude = ["John Doe","Santa Clause","Barrack Obama","Homeland Security", "Saddam Hussain","Big Oil"];//'people' to exclude


///////////////////////////////////
//global variables...don't change below
list scriptedavatars;//names of avatars who are scripted
list correctedexclusion;//the exclusion list in lowercase+owner

///////////////////
default
{
on_rez(integer start_param)
{
if(!llGetAttached())//its not attatched, but was rezzed on the ground
llResetScript();
}
attach(key attached)
{
if(attached != NULL_KEY)//they just put it on
llResetScript();
}
state_entry()
{
//correct case on exclude list to lowercase and copy to correctexclusion list
integer counter;
integer excludelength = llGetListLength(exclude);
do
{
correctedexclusion += llToLower(llList2String(exclude,counter));//add lowercase version to corrected exclusion
}while(++counter < excludelength);

//empty the exclude list to save memory
exclude = [];//clears exclude list
llOwnerSay("Scripted Attatchment.lsl (Public Domain 2009) by Bobbyb30 Swashbuckler running.");
llOwnerSay("I will scan " + (string)llRound(range) + "m on click");

}
touch_start(integer total_number)
{
if(llDetectedKey(0) == llGetOwner())//make sure owner touched
{
llSensor( "", "", AGENT, range, TWO_PI);
llOwnerSay("The following avatar(s) have scripted attatchments: \n" +
llDumpList2String(scriptedavatars,", "));//if you want one per line, do "\n"
}
}
sensor(integer total_number)//avatars were found
{
//llOwnerSay((string)llGetListLength(exclude));

//set scriptedavatars to nothing, and then rebuild list based on new finds
scriptedavatars = [];//clean up old list

//build scriptedavatars list
integer counter;
vector mypos = llGetPos();//for use in determining distance, faster to call once, though less accurate I guess
do
{
string detectedavatarname = llDetectedName(counter);//avatar name
if(llListFindList(correctedexclusion,[llToLower(detectedavatarname)]) == -1)//check if they are excluded
{
if(llGetAgentInfo(llDetectedKey(counter)) & AGENT_SCRIPTED)//if the agent is scripted, add to list
{
if(showdistance)//if showdistance == TRUE, append detectedavatarname with avatar distance
detectedavatarname += "(" + (string)llRound(llVecDist(llDetectedPos(counter),mypos)) + ")";//add avatar distance
scriptedavatars += detectedavatarname;//not excluded and scripted so add to list
}
}
}while(++counter < total_number);
//end of build


//display scripted avatars in hovertext if any

//get the length of scriptedavatars list to see if anyone was scripted
integer scriptedavatarslength = llGetListLength(scriptedavatars);//

if(scriptedavatarslength)//the list isn't empty so someone must have been scripted
llOwnerSay("* " + (string)llGetListLength(scriptedavatars) + " scripted avatars found *\n" +
llDumpList2String(scriptedavatars,"\n"));//set the hovertext to display the scripted avatars, will truncate at x chrs
else//no scripted avatars found
llOwnerSay("* No scripted avatars found *");
}
no_sensor()//this shouldn't trigger as its meant to be an attatchment, but if no avatars, this will trigger
{
llOwnerSay("* No avatars detected *");//display no avatars for hovertext
}
changed(integer change)
{
if(change & CHANGED_OWNER)//new owner, reset script
llResetScript();
}
}
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés