Difference between revisions of "LlOverMyLand"

From Second Life Wiki
Jump to navigation Jump to search
m (lsl code tagging)
m (<lsl> tag to <source>)
 
(13 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{LSL Function/object|id|avatar or object|sim=*}}
{{LSL_Function
{{LSL_Function
|inject-2={{LSL Function/uuid|id|object=*|sim=*}}
|func_id=215|func_sleep=0.0|func_energy=10.0
|func_id=215|func_sleep=0.0|func_energy=10.0
|sort=OverMyLand
|sort=OverMyLand
Line 6: Line 6:
|func_footnote=On group {{HoverText|deeded|owned}} land the object containing the script must be deeded to the same group. (It is not enough to set the script to the group.)
|func_footnote=On group {{HoverText|deeded|owned}} land the object containing the script must be deeded to the same group. (It is not enough to set the script to the group.)
|func_desc
|func_desc
|return_text={{HoverText|boolean|TRUE or FALSE}}, {{LSL Const|TRUE|integer|1}} if '''id ''' is over land owned by the script owner, {{LSL Const|FALSE|integer|0}} otherwise.
|return_text={{HoverText|boolean|TRUE or FALSE}}, {{LSL Const|TRUE|integer|1}} if {{LSLP|id}} is over land owned by the script owner, {{LSL Const|FALSE|integer|0}} otherwise.
|spec
|spec
|caveats
|caveats
|constants
|constants
|examples=
|examples=
<lsl>
<source lang="lsl2">
//--// private land message //--//
//--// private land message //--//


//-- @@ = Contains code optimizations, see the following page for details
//-- list of people not to pester, lower case only
//-- http://wiki.secondlife.com/wiki/User_talk:Void_Singer#Coding_Practices_Part_2_.28optimizations.29
list gLstIgnore = ["void singer"];
key  gKeyAv;
 
default{
    state_entry(){
        llOwnerSay( "I'll pester anyone on your land I can find,"
                    + " unless they're in your ignore list." );
        llSensorRepeat( "", "", AGENT, 96, PI, 30 );
    }
 
    sensor( integer vIntFound ){
        do{
            gKeyAv = llDetectedKey( --vIntFound );  //-- Decrement sensor variable to walk backwards through all detections
            //-- check if they are over our land
            if (llOverMyLand( gKeyAv )){ //-- the return value is automatically tested by the if statemnt
                //-- check if they are in the ignore list
                if (!~llListFindList( gLstIgnore, (list)llToLower( llDetectedName( vIntFound ) ) )){ //-- '!~llListFindList' == 'not found in the list'
                    //-- pester everyone not in the ignore list !!!
                    llInstantMessage( gKeyAv, "You are on private land, please leave this parcel" );
                }
            }
        }while (vIntFound);
    }
}
</source>
 
This following example is a variation of the previous one. It will email you a daily visitor log. This is useful to determine how much traffic your parcel is attracting each day, and who is visiting you regularly.  The [[llOverMyLand]] function is used to prevented the script from counting people on other parcels. 
 
<source lang="lsl2">
// This script will email you a daily count of new visitors and repeat visitors.
// Visitors are counted once per email update cycle.


//-- list of people not to pester, lower case only
// -----------------------------------
list vgLstIgnore = ["void singer"];
// Configuration: customize this script here.
// Change this to your email address.
string MyEmail = "you@example.com";
// This is a number 0 to 96 meters, anything farther away than that will not be noticed. 
float SensorRange = 96.0;
// How often to send email updates.
integer UpdateFrequency = 86400; // Number of seconds in 1 day.
// -----------------------------------
 
// Internal Variables -- Do not change.
list todayVisitors = [];
list allVisitors = [];
list repeatVisitors = [];
list firstTimers = [];
integer newVisitors = 0;
integer returnVisitors = 0;
string ParcelName;


default
default
Line 24: Line 70:
     state_entry()
     state_entry()
     {
     {
         llOwnerSay( "I'll pester anyone on your land I can find,"
         list parcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
                  + " unless they're in your ignore list, or a Linden" );
        ParcelName = llList2String(parcelDetails, 0);
         llSensorRepeat( "", "", AGENT, 96, PI, 30 );
         llSensorRepeat( "", "", AGENT, SensorRange, PI, 20);
        llSetTimerEvent(UpdateFrequency); // Email me a regular report.
        llOwnerSay("Visitor Log Started.");
     }
     }
 
     sensor( integer vIntFound )
     sensor(integer avsFound)
     {
     {
         integer vIntCounter = 0;
        key  avKey;
         do{
         integer avNum;
             string vStrName = llToLower( llDetectedName( vIntCounter ) );
        for(avNum=0; avNum<avsFound; avNum++)
 
         {
            //-- if they are over our land, check 'em
             avKey = llDetectedKey(avNum);
             if (llOverMyLand( llDetectedKey( vIntCounter ) ))
             if (llOverMyLand(avKey))
             {
             {
                 //-- don't pester people in the ignore list
                 string whom = llDetectedName(avNum);
                 if (!~llListFindList( vgLstIgnore, (list)vStrName )) //-- @@ x 2
                 if (!~llListFindList(todayVisitors, [whom]))
                 {
                 {
                     //-- don't pester lindens, they might get testy
                     // This person hasn't been seen yet today.
                     //-- note the space, can't be faked that I know of!
                     todayVisitors += [whom];
                     if (!~llSubStringIndex( vStrName, " linden" )) //-- @@
                     if (~llListFindList(allVisitors, [whom]))
                    {
                        // This is a returning visitor.
                        returnVisitors++;
                        repeatVisitors += [whom];
                    }
                    else
                     {
                     {
                         //-- pester everyone else !!!
                         // This is a first-time visitor.
                         llInstantMessage( llDetectedKey( vIntCounter ),
                        newVisitors++;
                              "You are on private land, please leave this parcel" );
                         allVisitors = [whom] + allVisitors;
                        firstTimers += [whom];
                     }
                     }
                 }
                 }
             }
             }
         }while (++vIntCounter < vIntFound); //-- @@
         }
    }
   
    timer()
    {
        list parcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
        ParcelName = llList2String(parcelDetails, 0);
        string subj = "Visitor Log for " + ParcelName;
        string body = "Number of Visitors Total: " + (string)(newVisitors + returnVisitors)
            + "\nReturning Visitors: " + (string)returnVisitors
            + "\nNew Visitors: " + (string)newVisitors
            + "\n\nList of New Visitors:\n\t" + llDumpList2String(firstTimers, "\n\t")
            + "\n\nList of Returning Visitors:\n\t" + llDumpList2String(repeatVisitors, "\n\t");
        newVisitors = 0;
        returnVisitors = 0;
        todayVisitors = [];
        repeatVisitors = [];
        firstTimers = [];
        if (llGetListLength(allVisitors)>500)
        {
            allVisitors = llList2List(allVisitors, 0, 499);
        }
        llEmail(MyEmail, subj, body);
     }
     }
}
}
</lsl>
</source>
[[User:Void Singer|Void Singer]] 02:04, 15 October 2007 (PDT)
|helpers
|helpers
|also_functions
|also_functions={{LSL DefineRow||[[llReturnObjectsByID]]|}}
|also_events
|also_events
|also_articles
|also_articles
Line 65: Line 141:
|cat3
|cat3
|cat4
|cat4
|history={{LSL Added|0.6.0|remote=http://secondlife.wikia.com/wiki/Version_0.6.0}}
}}
}}

Latest revision as of 13:05, 22 January 2015

Summary

Function: integer llOverMyLand( key id );
0.0 Forced Delay
10.0 Energy

Returns an integer boolean, TRUE if id is over land owned by the script owner, FALSE otherwise.

• key id group, avatar or object UUID that is in the same region

On group deeded land the object containing the script must be deeded to the same group. (It is not enough to set the script to the group.)

Examples

//--// private land message //--//

//-- list of people not to pester, lower case only
list gLstIgnore = ["void singer"];
key  gKeyAv;

default{
    state_entry(){
        llOwnerSay( "I'll pester anyone on your land I can find,"
                    + " unless they're in your ignore list." );
        llSensorRepeat( "", "", AGENT, 96, PI, 30 );
    }

    sensor( integer vIntFound ){
        do{
            gKeyAv = llDetectedKey( --vIntFound );  //-- Decrement sensor variable to walk backwards through all detections
             //-- check if they are over our land
            if (llOverMyLand( gKeyAv )){ //-- the return value is automatically tested by the if statemnt
                 //-- check if they are in the ignore list
                if (!~llListFindList( gLstIgnore, (list)llToLower( llDetectedName( vIntFound ) ) )){ //-- '!~llListFindList' == 'not found in the list'
                     //-- pester everyone not in the ignore list !!!
                    llInstantMessage( gKeyAv, "You are on private land, please leave this parcel" );
                }
            }
        }while (vIntFound);
    }
}

This following example is a variation of the previous one. It will email you a daily visitor log. This is useful to determine how much traffic your parcel is attracting each day, and who is visiting you regularly. The llOverMyLand function is used to prevented the script from counting people on other parcels.

// This script will email you a daily count of new visitors and repeat visitors.
// Visitors are counted once per email update cycle.

// -----------------------------------
// Configuration: customize this script here.
// Change this to your email address.
string MyEmail = "you@example.com";
// This is a number 0 to 96 meters, anything farther away than that will not be noticed.  
float SensorRange = 96.0;
// How often to send email updates.
integer UpdateFrequency = 86400; // Number of seconds in 1 day.
// -----------------------------------

// Internal Variables -- Do not change.
list todayVisitors = [];
list allVisitors = [];
list repeatVisitors = [];
list firstTimers = [];
integer newVisitors = 0;
integer returnVisitors = 0;
string ParcelName;

default
{
    state_entry()
    {
        list parcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
        ParcelName = llList2String(parcelDetails, 0);
        llSensorRepeat( "", "", AGENT, SensorRange, PI, 20);
        llSetTimerEvent(UpdateFrequency); // Email me a regular report.
        llOwnerSay("Visitor Log Started.");
    }
 
    sensor(integer avsFound)
    {
        key  avKey;
        integer avNum;
        for(avNum=0; avNum<avsFound; avNum++)
        {
            avKey = llDetectedKey(avNum);
            if (llOverMyLand(avKey))
            {
                string whom = llDetectedName(avNum);
                if (!~llListFindList(todayVisitors, [whom]))
                {
                    // This person hasn't been seen yet today.
                    todayVisitors += [whom];
                    if (~llListFindList(allVisitors, [whom]))
                    {
                        // This is a returning visitor.
                        returnVisitors++;
                        repeatVisitors += [whom];
                    }
                    else
                    {
                        // This is a first-time visitor.
                        newVisitors++;
                        allVisitors = [whom] + allVisitors;
                        firstTimers += [whom];
                    }
                }
            }
        }
    }
    
    timer() 
    {
        list parcelDetails = llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_NAME]);
        ParcelName = llList2String(parcelDetails, 0);
        string subj = "Visitor Log for " + ParcelName;
        string body = "Number of Visitors Total: " + (string)(newVisitors + returnVisitors)
            + "\nReturning Visitors: " + (string)returnVisitors
            + "\nNew Visitors: " + (string)newVisitors 
            + "\n\nList of New Visitors:\n\t" + llDumpList2String(firstTimers, "\n\t")
            + "\n\nList of Returning Visitors:\n\t" + llDumpList2String(repeatVisitors, "\n\t");
        newVisitors = 0;
        returnVisitors = 0;
        todayVisitors = [];
        repeatVisitors = [];
        firstTimers = [];
        if (llGetListLength(allVisitors)>500)
        {
            allVisitors = llList2List(allVisitors, 0, 499);
        }
        llEmail(MyEmail, subj, body);
    }
}

See Also

Functions

•  llReturnObjectsByID

Deep Notes

History

Footnotes

  1. ^ Early release notes were not very accurate or thorough, they sometimes included information about features added in previous releases or failed to include information about features added in that release.

Signature

function integer llOverMyLand( key id );