Total prims in use in world

Ask questions about creating worlds, using worlds, etc.
User avatar
Ilan Tochner
Posts: 6503
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4942 times
Been thanked: 4454 times
Contact:

Re: Total prims in use in world

Post by Ilan Tochner »

If Selby is seeing a number out of 180,00 when using scenegate in the same location inworld that you're seeing some other number using Firestorm then this is very likely a Firestorm issue that needs to be fixed. Selby's viewer wouldn't know the correct value to display if it wasn't provided by the server.
These users thanked the author Ilan Tochner for the post (total 2):
Snoots DwagonAlexina Proctor
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Total prims in use in world

Post by Graham Mills »

Haven't tried it but there's a sample script might be a good starting point http://wiki.secondlife.com/wiki/LlGetParcelPrimCount
These users thanked the author Graham Mills for the post:
Alexina Proctor
User avatar
Snoots Dwagon
Posts: 422
Joined: Mon Jul 30, 2018 9:45 pm
Has thanked: 442 times
Been thanked: 779 times

Re: Total prims in use in world

Post by Snoots Dwagon »

For those having trouble getting that script (I did until I figured out the trick), here it is in full. I tweaked the startup a bit to make it more interactive and informative.

Code: Select all

//Sim-wide scanner to count prim use in each parcel
list gPrclID;
integer gTotPrims;
float gX;
float gY;
string gObjName;
integer gNUM;
 
default
{

    on_rez(integer start)
    { llResetScript();
    }


    state_entry()
    {
        llSetPos(llGetPos() + <0.0,0.0,0.5>);
        llSetText("Touch to start scan",<1.0,1.0,0.0>,1.0);
        gObjName = llGetObjectName();
        gPrclID = [];
        gTotPrims = 0;
        // Begin scanning at the SW <0.0,0.0,0.0> corner of the sim
        gX = 4.0;
        gY = 4.0;
    }

 
    touch_start(integer total_number)
    {
        llSetText("Scanning ....",<1.0,1.0,0.0>,1.0);
        gNUM = 0;
        llRegionSayTo(llGetOwner(),0,"Scan started on " + llGetRegionName());
        llSetTimerEvent(0.1);
    }
 
    timer()
    {
        //Grab the parcel's ID and name at position <gX, gY, 100.0>
        list parcel = llGetParcelDetails(<gX,gY,100.0>,[PARCEL_DETAILS_ID,PARCEL_DETAILS_NAME]);
        key temp = llList2Key(parcel,0);
        string parcel_name = llList2String(parcel,1);
        if (parcel_name == "")
        {
            parcel_name = "(no name)";
        }
        if (!~llListFindList(gPrclID,[temp]))   //Scan at this location if this parcel was not scanned earlier
        {
            ++gNUM;
            llSetObjectName((string)gNUM);
            integer Count = llGetParcelPrimCount(<gX,gY,100>,PARCEL_COUNT_TOTAL,FALSE); //Do not include other parcels owned by llGetOwner()
            gTotPrims += Count;
            llRegionSayTo(llGetOwner(),0, "/me "+ parcel_name + " @ <"+(string)gX+","+(string)gY+",Z>  = " + (string)Count);
            gPrclID += [temp];  //Add this parcel to the "previously scanned" list
        }
        // Increment X and Y in successive scans to look at the entire sim in 8m square blocks
        if (gX < 2048.0)  // was 256
        {
            gX +=8.0;
        }
        if (gX > 2048.0)  // was 256
        {
            gY += 8.0;
            gX = 4.0;
        }
        if (gY > 2048.0) // Reached NE corner,  Was 256
        {
            llSetObjectName(gObjName);
            llRegionSayTo(llGetOwner(),0,"Scan finished.  Total land impact = " + (string)gTotPrims + " in " + (string)llGetListLength(gPrclID) + " parcels (not counting temp rez prims).");
            llSetText("Touch to start scan",<1.0,1.0,0.0>,1.0);
            llResetScript();
        }
    }
}


However, I ran this in the middle of Wellspring and it died of old age. I guess it doesn't like MegaRegions. :mrgreen:

So I changed the 256 to 2048 and got some results...but they are very slow in coming and erratic and prone to failure. Perhaps someone with a little time can finesse this script a bit. I'm swamped today.
These users thanked the author Snoots Dwagon for the post (total 3):
Iain McCrackenSelby EvansAlexina Proctor
~~~~~~~
I'm a dwagon in real life too. (Ask my sister, who totally agrees.)

~~~~~~~
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: Total prims in use in world

Post by Graham Mills »

Maybe have more than one prim actively scanning at a time or place a unique marker in each parcel for it to find?
Snoots Dwagon wrote:
Wed Apr 07, 2021 8:46 pm
For those having trouble getting that script (I did until I figured out the trick), here it is in full. I tweaked the startup a bit to make it more interactive and informative.

Code: Select all

//Sim-wide scanner to count prim use in each parcel
list gPrclID;
integer gTotPrims;
float gX;
float gY;
string gObjName;
integer gNUM;
 
default
{

    on_rez(integer start)
    { llResetScript();
    }


    state_entry()
    {
        llSetPos(llGetPos() + <0.0,0.0,0.5>);
        llSetText("Touch to start scan",<1.0,1.0,0.0>,1.0);
        gObjName = llGetObjectName();
        gPrclID = [];
        gTotPrims = 0;
        // Begin scanning at the SW <0.0,0.0,0.0> corner of the sim
        gX = 4.0;
        gY = 4.0;
    }

 
    touch_start(integer total_number)
    {
        llSetText("Scanning ....",<1.0,1.0,0.0>,1.0);
        gNUM = 0;
        llRegionSayTo(llGetOwner(),0,"Scan started on " + llGetRegionName());
        llSetTimerEvent(0.1);
    }
 
    timer()
    {
        //Grab the parcel's ID and name at position <gX, gY, 100.0>
        list parcel = llGetParcelDetails(<gX,gY,100.0>,[PARCEL_DETAILS_ID,PARCEL_DETAILS_NAME]);
        key temp = llList2Key(parcel,0);
        string parcel_name = llList2String(parcel,1);
        if (parcel_name == "")
        {
            parcel_name = "(no name)";
        }
        if (!~llListFindList(gPrclID,[temp]))   //Scan at this location if this parcel was not scanned earlier
        {
            ++gNUM;
            llSetObjectName((string)gNUM);
            integer Count = llGetParcelPrimCount(<gX,gY,100>,PARCEL_COUNT_TOTAL,FALSE); //Do not include other parcels owned by llGetOwner()
            gTotPrims += Count;
            llRegionSayTo(llGetOwner(),0, "/me "+ parcel_name + " @ <"+(string)gX+","+(string)gY+",Z>  = " + (string)Count);
            gPrclID += [temp];  //Add this parcel to the "previously scanned" list
        }
        // Increment X and Y in successive scans to look at the entire sim in 8m square blocks
        if (gX < 2048.0)  // was 256
        {
            gX +=8.0;
        }
        if (gX > 2048.0)  // was 256
        {
            gY += 8.0;
            gX = 4.0;
        }
        if (gY > 2048.0) // Reached NE corner,  Was 256
        {
            llSetObjectName(gObjName);
            llRegionSayTo(llGetOwner(),0,"Scan finished.  Total land impact = " + (string)gTotPrims + " in " + (string)llGetListLength(gPrclID) + " parcels (not counting temp rez prims).");
            llSetText("Touch to start scan",<1.0,1.0,0.0>,1.0);
            llResetScript();
        }
    }
}


However, I ran this in the middle of Wellspring and it died of old age. I guess it doesn't like MegaRegions. :mrgreen:

So I changed the 256 to 2048 and got some results...but they are very slow in coming and erratic and prone to failure. Perhaps someone with a little time can finesse this script a bit. I'm swamped today.
These users thanked the author Graham Mills for the post (total 2):
Selby EvansAlexina Proctor
User avatar
Snoots Dwagon
Posts: 422
Joined: Mon Jul 30, 2018 9:45 pm
Has thanked: 442 times
Been thanked: 779 times

Re: Total prims in use in world

Post by Snoots Dwagon »

If one wishes to place a parcel counter all over a world, one might as well just fly parcel to parcel and start tallying stats.

What is ideally sought here is somewhere that a World Owner or Estate Manager can go to see the overall use of prims on the entire world... one figure that tells how many prims are still available, disregarding parcel readings. That way if World prim use starts getting too high, the World owner can decide if it's time to start trimming some builds, or look for excessive use of prims.

What I'd really love to see in addition to this (I guess this is a "New Feature Request"... is a function that would list:

* Parcel name / owner
* Parcel prim allowance
* Parcel prims used
* Parcel prims remaining

... all in a nice list that includes every parcel on the world. After all these years I'm kinda surprised this function doesn't already exist. Even back in the days of single-region SL that would have come in really handy for land barons. ; )
These users thanked the author Snoots Dwagon for the post (total 2):
Selby EvansAlexina Proctor
~~~~~~~
I'm a dwagon in real life too. (Ask my sister, who totally agrees.)

~~~~~~~
Post Reply