Determine Region Type by Script
|
|
Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
|
11-09-2008 05:07
Here's a little function to return a region type. Formerly it did normal regions and openspace, but now it differentiates normal, homestead, and openspace. integer getRegionType() { // returns 0 for normal region // returns 1 for homestead region // returns 2 for openspace region integer actualPrims = llGetParcelMaxPrims(llGetPos(), FALSE); integer parcelSize = llList2Integer(llGetParcelDetails(llGetPos(), [PARCEL_DETAILS_AREA]), 0); // integer homesteadPrims = (parcelSize * 572) / 10000; // bang-on accuracy // integer openspacePrims = (parcelSize * 572) / 49980; // bang-on accuracy integer homesteadPrims = (parcelSize * 572) / 8000; // includes 25% margin of error integer openspacePrims = (parcelSize * 572) / 40000; // includes 25% margin of error if(actualPrims < openspacePrims) return 2; if(actualPrims < homesteadPrims) return 1; return 0; }
Pretty self explanetory, just call it as "integer n = getRegionType()" Cheers! -Atashi
_____________________
Visit Atashi's Art and Oddities Store and the Waikiti Motor Works at beautiful Waikiti.
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-09-2008 06:19
does max prims report differently if fed the region corner, might save some math
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
|
11-09-2008 07:43
I don't think it matters - it's just looking at the actual prims available for the parcel the script is on when it runs, and compares that against what it would expect to find if the parcel were on a 750-prim region or a 3750-prim region.
Math-wise I thought it was actually pretty simple. None of the functions incurr a forced delay either so it should return the region type more-or-less instantly.
-Atashi
_____________________
Visit Atashi's Art and Oddities Store and the Waikiti Motor Works at beautiful Waikiti.
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-09-2008 07:58
Very nice contribution Atashi.
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
11-09-2008 09:03
I just meant you wouldn't have to calculate prims/parcel if max count will return the whole region max using the region corner... though I don't know if that even works, just a thought...
it is a good idea though, I'm betting some cataloger will add that to their info script.
_____________________
| | . "Cat-Like Typing Detected" | . This post may contain errors in logic, spelling, and | . grammar known to the SL populace to cause confusion | | - Please Use PHP tags when posting scripts/code, Thanks. | - Can't See PHP or URL Tags Correctly? Check Out This Link... | - 
|
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
11-17-2008 14:44
Took and tweaked it for the non scripters to use in this thread: /327/59/293244/1.html //Based on Atashi Toshihiko's work //http://forums.secondlife.com/showthread.php?t=291872 default { state_entry() { integer actualPrims = llGetParcelMaxPrims(llGetPos(), FALSE); integer parcelSize = llList2Integer(llGetParcelDetails(llGetPos(),[PARCEL_DETAILS_AREA]), 0); integer homesteadPrims = (parcelSize * 572) / 8000; // includes 25% margin of error integer openspacePrims = (parcelSize * 572) / 40000; // includes 25% margin of error if (actualPrims < openspacePrims) llOwnerSay("Openspace Region"); else if (actualPrims < homesteadPrims) llOwnerSay("Homestead Region"); else llOwnerSay("Normal Region"); llDie(); } }
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime. From: someone I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
11-18-2008 12:11
How is this affected by the option an estate owner/manager has of increasing a parcel's quota of prims?
|