Jump to content

Ghost Prim Utility


Void Singer
 Share

You are about to reply to a thread that has been inactive for 4724 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

just a small utility to check for ghost prims on a parcel. Requires the owner to have the ability to return parcel owner prims (Deeding works for group owned parcels). it can be inaccurate if it a rez occurs while it's running, but it's an unlikely event, if you do get a detection rerun it to confirm the results.

(note that the prim expects to be rezzed and will delete itself in most cases, so use a copyable prim)

 

/*( Ghost Prim Utility v1.1 )*/
//-- based on the code by JJValero Writer found @ http://jira.secondlife.com/browse/SVC-255#comment-224241

key     gKeyQry;
list    gLstOwn;
integer gIntCnt;


uDetectGhosts(){
    //-- parcel prim owners only works for the current parcel and includes temps/selected/sat-upon
    gLstOwn = llGetParcelPrimOwners( llGetLocalPos() );
    //-- need to grab the total + temp (which includes selcted/sat-upon) to match owners, but only for this parcel so use false
    gIntCnt = llGetParcelPrimCount( llGetLocalPos(), PARCEL_COUNT_TOTAL, FALSE ) +
              llGetParcelPrimCount( llGetLocalPos(), PARCEL_COUNT_TEMP, FALSE );
    integer vIntTmp = (integer)llListStatistics( LIST_STAT_SUM, llList2ListStrided( llDeleteSubList( gLstOwn, 0, 0 ), 0, -1, 2 ) );
    //-- ghosts don't show up in parcel prims owners, so get the difference to count ghosts
    llWhisper( 0, "\nTotal Prim(s): " + (string)gIntCnt +
                  "\nOwned Prims: " + (string)vIntTmp + 
                  "\nGhost Prims: " + (string)(gIntCnt - vIntTmp) );
    //-- ([] != gLstOwn) == -llGetListLength( gLstOwn );
    gKeyQry = llRequestAgentData( llList2Key( gLstOwn, gIntCnt = ([] != gLstOwn) ), DATA_NAME );
    llSetTimerEvent( 2.0 ); //-- fast timeout, so we aren't waiting on silently failed group keys later
}


default{
    changed( integer vBitChg ){
        if (CHANGED_OWNER & vBitChg){ //-- auto start detection if owner is parcel owner after owner change
            if (llGetOwner() == llList2Key( llGetParcelDetails( llGetPos(), [PARCEL_DETAILS_OWNER] ), 0 ) && !gIntCnt){
                uDetectGhosts();
            }
        }
    }
    
    on_rez( integer vIntBgn ){ //-- owner is same as parcel owner, autostart
        if (llGetOwner() == llList2Key( llGetParcelDetails( llGetPos(), [PARCEL_DETAILS_OWNER] ), 0 )){
            uDetectGhosts();
        }else{ //-- otherwise warn about permissions
            llOwnerSay( "Will not work properly if you do not have full permissions to return objects on this land.
If you do, touch the object, otherwise, deeding it to the group that owns the land will work.
You can touch and hold for 3 seconds to delete this object if you are the owner or have activated your group title for the same group" );
        }
    }
    
    touch_start( integer vIntTch ){
        llResetTime();
    } //-- touch-hold trigger setup
    
    touch_end( integer vIntTch ){ //-- only take touches from same group
        if (llGetOwner() == llDetectedKey( 0 ) || llDetectedGroup( 0 )){
            if (llGetTime() > 1.0){ //-- check if theis is a held touch and die
                llDie(); //-- provided in case a person has deed power but not return/mod for group items or something somehow fails
            }else{ //-- otherwise it a normal touch and we run detection
                uDetectGhosts();
            }
        }
    }
    
    dataserver( key vKeyQID, string vStrDta ){
        if (gKeyQry == vKeyQID){
            llWhisper( 0, vStrDta + ": " + llList2String( gLstOwn, ++gIntCnt ) + " prims" );
            if (++gIntCnt){
                gKeyQry = llRequestAgentData( llList2Key( gLstOwn, gIntCnt ), DATA_NAME );
                llSetTimerEvent( 2.0 );
            }else{ //-- die when done
                llDie();
            }
        }
    }
    
    timer(){
        //-- timeout means dataserver failed or was slow, assume it's group key failure and linke to the group for confirmation
        llWhisper( 0, "(Group Owned?): " + llList2String( gLstOwn, ++gIntCnt ) +
                      " prims [ secondlife:///app/group/"+ llList2String( gLstOwn, gIntCnt ) + "/about ]" );
        if (++gIntCnt){
            gKeyQry = llRequestAgentData( llList2Key( gLstOwn, gIntCnt ), DATA_NAME );
            llSetTimerEvent( 3.0 );
        }else{ //-- die when done
            llDie();
        }        
    }
}

 

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4724 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...