LlGetParcelPrimCount: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
LI |
||
| Line 11: | Line 11: | ||
|func_footnote | |func_footnote | ||
|func_desc | |func_desc | ||
|return_text=that is the | |return_text=that is the total [http://community.secondlife.com/t5/English-Knowledge-Base/Calculating-land-impact/ta-p/974163 land impact] of objects on the parcel at {{LSLP|pos}} of the given {{LSLP|category}} | ||
|spec=If {{LSLP|sim_wide}} is... | |spec=If {{LSLP|sim_wide}} is... | ||
*{{#var:TRUE}} then the return is the combined | *{{#var:TRUE}} then the return is the combined object land impact used on all parcels in the sim owned by the specified parcel's owner of the category requested.{{Footnote|handle=non-zero}} | ||
*{{#var:FALSE}} then the return is the | *{{#var:FALSE}} then the return is the object land impact used of the category requested on the parcel specified. | ||
|caveats | |caveats | ||
|constants | |constants | ||
| Line 36: | Line 36: | ||
llSay(PUBLIC_CHANNEL, | llSay(PUBLIC_CHANNEL, | ||
" | "The total land impact of objects on this parcel is " + primCountThisParcel(PARCEL_COUNT_TOTAL) + "."); | ||
llSay(PUBLIC_CHANNEL, | llSay(PUBLIC_CHANNEL, | ||
primCountThisParcel(PARCEL_COUNT_OWNER) + " | primCountThisParcel(PARCEL_COUNT_OWNER) + " LI for objects owned by the parcel owner."); | ||
llSay(PUBLIC_CHANNEL, | llSay(PUBLIC_CHANNEL, | ||
primCountThisParcel(PARCEL_COUNT_GROUP) + " | primCountThisParcel(PARCEL_COUNT_GROUP) + " LI for objects set to or owned by the parcel's group."); | ||
llSay(PUBLIC_CHANNEL, | llSay(PUBLIC_CHANNEL, | ||
primCountThisParcel(PARCEL_COUNT_OTHER) + " | primCountThisParcel(PARCEL_COUNT_OTHER) + " LI for objects not set to the parcel group or owned by the parcel owner."); | ||
llSay(PUBLIC_CHANNEL, | llSay(PUBLIC_CHANNEL, | ||
primCountThisParcel(PARCEL_COUNT_SELECTED) + " | primCountThisParcel(PARCEL_COUNT_SELECTED) + " LI for selected objects."); | ||
llSay(PUBLIC_CHANNEL, | llSay(PUBLIC_CHANNEL, | ||
primCountThisParcel(PARCEL_COUNT_TEMP) + " | primCountThisParcel(PARCEL_COUNT_TEMP) + " LI for temp-on-rez objects."); | ||
} | } | ||
} | } | ||
| Line 122: | Line 122: | ||
{ | { | ||
llSetObjectName(gObjName); | llSetObjectName(gObjName); | ||
llRegionSayTo(llGetOwner(),0,"Scan finished. Total | 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); | llSetText("Touch to start scan",<1.0,1.0,0.0>,1.0); | ||
llResetScript(); | llResetScript(); | ||
} | } | ||
} | } | ||
} | } | ||
</lsl> | </lsl> | ||
Revision as of 02:56, 23 December 2013
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: integer llGetParcelPrimCount( vector pos, integer category, integer sim_wide );| 0.0 | Forced Delay |
| 10.0 | Energy |
Returns an integer that is the total land impact of objects on the parcel at pos of the given category
| • vector | pos | – | position in region coordinates (z component is ignored) | |
| • integer | category | – | a PARCEL_COUNT_* flag | |
| • integer | sim_wide | – | boolean, TRUE[1] searches parcels in the region with the same owner as the targeted parcel, FALSE searches only the targeted parcel |
Specification
Examples
<lsl> // gives prim usage information when touched
string primCountThisParcel(integer flag) {
vector currentPosition = llGetPos();
return
(string)llGetParcelPrimCount(currentPosition, flag, FALSE);
}
default {
touch_start(integer total_number)
{
// PUBLIC_CHANNEL has the integer value 0
llSay(PUBLIC_CHANNEL,
"The total land impact of objects on this parcel is " + primCountThisParcel(PARCEL_COUNT_TOTAL) + ".");
llSay(PUBLIC_CHANNEL,
primCountThisParcel(PARCEL_COUNT_OWNER) + " LI for objects owned by the parcel owner.");
llSay(PUBLIC_CHANNEL,
primCountThisParcel(PARCEL_COUNT_GROUP) + " LI for objects set to or owned by the parcel's group.");
llSay(PUBLIC_CHANNEL,
primCountThisParcel(PARCEL_COUNT_OTHER) + " LI for objects not set to the parcel group or owned by the parcel owner.");
llSay(PUBLIC_CHANNEL,
primCountThisParcel(PARCEL_COUNT_SELECTED) + " LI for selected objects.");
llSay(PUBLIC_CHANNEL,
primCountThisParcel(PARCEL_COUNT_TEMP) + " LI for temp-on-rez objects.");
}
} </lsl> <lsl> //Sim-wide scanner to count prim use in each parcel list gPrclID; integer gTotPrims; float gX; float gY; string gObjName; integer gNUM;
default {
state_entry()
{
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;
}
on_rez(integer start)
{
llSetPos(llGetPos() + <0.0,0.0,0.5>);
llSetText("Touch to start scan",<1.0,1.0,0.0>,1.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 < 256.0)
{
gX +=8.0;
}
if (gX > 256.0)
{
gY += 8.0;
gX = 4.0;
}
if (gY > 256.0) // Reached NE corner
{
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();
}
}
}
</lsl>See Also
Functions
| • | llGetParcelMaxPrims |