llGetParcelPrimOwners for land scanner
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
12-01-2006 00:32
"list llGetParcelPrimOwners(vector pos) Returns a list of up to 100 agents who own objects in the parcel, and the number of objects they own" It returns Key,Integer,Key, Integer... But I need Names Since Key2Name does not work for offline users it looks like I have to use the dataserver. llRequestAgentData(KeyIn, DATA_NAME); dataserver(key queryid, string data) { m_OwnerName = data; }
Edit: I’ll update the wiki Edit: now the wilki says my account is suspended. ??? Earlier it simply got a 404 error Edit again: The wiki is back up.
|
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
|
12-01-2006 00:37
From: grumble Loudon "list llGetParcelPrimOwners(vector pos) Returns a list of up to 100 agents who own objects in the parcel, and the number of objects they own" It returns Key,Integer,Key, Integer... But I need Names Since Key2Name does not work for offline users it looks like I have to use the dataserver. llRequestAgentData(KeyIn, DATA_NAME); dataserver(key queryid, string data) { m_OwnerName = data; }
Edit: I’ll update the wiki Hmm.. I never thought about it much, but if the list were actually 100 agents along with the other values, could a script even call the function without crashing? EDIT: Nevermind, my ignorance is showing again. It's pretty easily possible, though a worst-case scenario will knock you down by like 6k.
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
12-01-2006 00:52
I've broken my task into 5 scripts.
1. The main script turn off the other scripts when not in use. 2. The scanner script passes one key and count at a time to the key to name script 3. The Key to name script calls the data server and cahce's names 4. The notecard script reads the notecard into a list and compares names to allowed prim counts 5. The email script gathers the results and sends a email when done.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-01-2006 08:39
LOL. I'm working on something identical for a friend So here's a question. I gave him the script last night (it's pretty much a 3 line script... touch it, it gets the list, if the toucher's key is in it, it tells him the number of prims he owns). I tested it on one of the islands he owns, with one of his tenants. She could touch the object and it would print the correct number. I hadn't deeded the object - it was owned by me. So he put it out on a different estate. Then he had a tenant complain that it worked as long as my friend (the land owner) was around, but if he was gone, the script returned 0 prims. Any ideas? The Wiki has a comment that says something like "will work for agents who could see this data anyway". Could the two estates be set up differently w.r.t. land/permissions, in a way that would affect this?
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
cool that we are all at about the same progress...have mine working now 
12-01-2006 10:49
My scanner is working and sends IMs/notecards to the prim offenders too. I too am working on integration with allowed prim counts, but going another way to keep track (I have about 85 condos that I rent out - so a notecard with names and prim counts is out of the question). My dataserver is inline with the scanner - so when I find a person of interest (prim count beyond a certain threshold), I then query for the person's name and online status. This minimizes dataserver events by querying only for people that I really want to contact. The code is a little messy in some part...but link messages and some abstractions go a long way  hmm..I'd suggest that we share our code here, but the race seems to be on  -2fast
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
12-01-2006 21:31
Mine is targeted at sites where you are running a collaborative building project so it's not so much to tell when someone goes over a limit, it's more for telling when you have new clutter to check. I have 70 some different people who own objects on my land and I am looking for both detecting when someone adds something and when something disappears. To bad there isn’t a Key2Pos function Here is where I am at. Sorry about the messy code The main script sets the running state of the other scripts when not in use. The link messages go round robbin with the main script listing in for a link message from the email script in order to send a "next" message. The main script will also have a timeout so that I don't have to have a timer in each module. Here is the scanner module for referance //Land Prim count monitor, Scanner // //Released into the public domain by grumble Loudon and LaserFur Leonov // //V0.0 // // //Recieves a Linkmessages and then sends one entry at a time // //integer = 1 for commands // Comands = "start" // Comands = "next" // Comands = "end" //Sends // integer = 2 for data // name;Primcount,key? // empty string if done
//************************************************************************************ integer m_ListPtr = 0; integer m_ListCount2 = 0; //count *2 list m_List;
//************************************************************************************ LoadList(){ //load list m_ListPtr = 0; m_List = llGetParcelPrimOwners(llGetPos()); //key,integer // Returns a list of up to 100 agents who own objects in the parcel, // and the number of objects they own. m_ListCount2 = llGetListLength(m_List); //llOwnerSay((string)(m_ListCount2 / 2)); } //load list //************************************************************************************ SendNext(){ //get next and send it string datstr = ""; if (m_ListPtr < m_ListCount2){ key id = llList2Key(m_List,m_ListPtr); string str = (string)llList2Integer(m_List,m_ListPtr+1); llMessageLinked(LINK_SET, 2, str, id); }else{ llMessageLinked(LINK_SET, 2, "", NULL_KEY); }; m_ListPtr += 2; } //************************************************************************************ DumpList(){ //Frees memory m_List = []; m_ListCount2 = 0; m_ListPtr = 0; } //************************************************************************************ default { state_entry() { DumpList(); } link_message(integer sender_num,integer num,string str,key id){ if (num == 1){ //command if (str == "start"){ LoadList(); SendNext(); }else if (str == "next"){ SendNext(); }else if (str == "end"){ DumpList(); };//str };//num }//Link }//default
Here is my Key2Name function. (The cache is not done) //Land Prim count monitor, Key to name (with cache option) // //Released into the public domain by grumble Loudon and LaserFur Leonov // //V0.0 // //Linkmessages // //In //integer,String ,Key // 2 ,primcount,OwnerKey //Out // 3 ,"name=Primcount",OwnerKey // //Passes on blank requests for done
//************************************************************************************ //list m_CacheKey; //list m_CacheName; //integer m_CacheCount = 0;
key m_OwnerKey; integer m_OwnerCount; string m_OwnerName; key m_dataRequestID; //************************************************************************************ SendResult(){ string Msg = (string)m_OwnerName + "=" + (string)m_OwnerCount; llOwnerSay(Msg+ (string)m_OwnerKey); llMessageLinked(LINK_SET,3,Msg,m_OwnerKey); } //************************************************************************************ default { //************************************************************************************ state_entry() { } //************************************************************************************ link_message(integer sender_num,integer num,string str,key id){ if (num == 2){ //Data from scanner m_OwnerKey = id; m_OwnerCount = (integer)str; m_OwnerName = ""; if (id == NULL_KEY){ llMessageLinked(LINK_SET,3,"",NULL_KEY); //pass }else{ //list KeyFind = m_OwnerKey; //if (ListFindList // m_OwnerName = // SendResult(){ //else m_dataRequestID = llRequestAgentData(m_OwnerKey, DATA_NAME); // }; };//num }//Link //************************************************************************************ dataserver(key queryid, string data) { if(m_dataRequestID == queryid) { m_OwnerName = data; //add to cache SendResult(); }; } //************************************************************************************ }//default
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
12-01-2006 21:36
From: Ziggy Puff So he put it out on a different estate. Then he had a tenant complain that it worked as long as my friend (the land owner) was around, but if he was gone, the script returned 0 prims. It seems that you have to have the "Deed to group" option. You don't have to deed it to the group, but you have to have the ability to. I am guessing the sim is caching that data and in order to have it work reliably you will have to actually deed it to the group. I see breaking the task up into separate prims as you only get the prims on that divided parcel and not the whole estate.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-01-2006 23:35
I was only looking for the prims on that parcel. I tried deeding it to the group. Nothing worked on the mainland. It worked without deeding to group on the island (for me). Though one of his tenants complained that it didn't work on the island either. I think there's some relationship to who is trying to run this, the group the land is set/deeded to, the group the object is set/deeded to, etc. I haven't figured the pattern out yet though  Have you got this to work on the mainland?
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
12-02-2006 06:51
From: Ziggy Puff Have you got this to work on the mainland? I am on the mainland and it works on one parcel where I am a group owner, but it does not work on land where I am in the "Everyone" catagory.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-02-2006 09:02
Thanks. That's a start. Could you set this to trigger on touch, put it in an object that you own, on the land where you're a group owner, and then have someone else who's just a group member (but has prims on that parcel) try to run it? That's what I can't get to work, apparently. Or, there's a bug in my script:: default { touch_start(integer total_number) { key toucher = llDetectedKey(0); string name = llDetectedName(0); llWhisper(0, "Please wait, retrieving prim count for " + name + "..."); list l = llGetParcelPrimOwners(llGetPos()); integer index = llListFindList(l, [toucher]); integer num; if (index == -1) { num = 0; } else { num = llList2Integer(l, index + 1); } llWhisper(0, name + " has " + (string)num + " prim(s) on this parcel."); } }
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
12-02-2006 09:29
It shure looks like the owner has to be logged in for it to work.
|
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
|
12-02-2006 09:43
I still haven't finished checking just what all llGetParcelPrimOwners can and can not do. Unfortunately we may not know for a couple of more days. Even on land I own, a database query fails silently about 50% of the time right now. This happens when the DB is strained. 
_____________________
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
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-02-2006 11:13
Thanks. That seems to mirror what I've found - if I have "About land -> Objects -> Refresh List" permissions on a parcel, then the script works for me, and for anyone else who touches the object as long as I'm around. If I log off, it looks like at some point it stops working. If anyone figures this out, or finds out more information about how this works, please post here 
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-04-2006 12:38
So... has anyone been able to get this to work on group owned land? The Wiki now has a comment saying this completely does not work if it's deeded to the group. I've tried objects deeded to the group, and also owned by group officers, and they only seem to work if the owner is online.
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
Owner must be in same sim
12-04-2006 13:00
I had a few ideas for this so I did some testing with an alt account. I found that deeding the containing object to the group of group-owned land just messes this up the result of llGetListLength( llGetParcelPrimOwners (llGetPos() ) ) is always zero. The key difference is in where the owner (avatar) of the land is when llGetParcelPrimOwners gets invoked: * If the owner is not in the same sim, llGetListLength( llGetParcelPrimOwners (llGetPos() ) ) is always zero * If the owner IS PRESENT in the same sim, llGetListLength( llGetParcelPrimOwners (llGetPos() ) ) returns up to 100, as described. * If the owner was present and went away, llGetListLength( llGetParcelPrimOwners (llGetPos() ) ) returns up to 100, as described for 1-2 minutes. It then always returns zero. * If llGetListLength( llGetParcelPrimOwners (llGetPos() ) ) is zero becasue the owner is not in the same sim, the call works immediately when the owner appears in the same sim. I tested this on my estate - my mainland land is too laggy to test with, thanks to a club in the next sim  . So this is great for land owners, but it looks like its use for products that could be used when the parcel owner is absent is out of the question. This is too bad since, if the parcel owner provides the capability for others to use llGetParcelPrimOwners, the intent is clearly to expose that information to non-owners. Perhaps the behavior of llGetParcelPrimOwners may change in the future. -2fast
|
Dragon Eccleston
Registered User
Join date: 25 Dec 2005
Posts: 42
|
12-04-2006 13:25
Wiki has been updated to say this only works when the owner is in the sim, this call is now pretty much useless for automated land management.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-04-2006 13:26
From: someone Perhaps the behavior of llGetParcelPrimOwners may change in the future. I hope so. I can see how it would be useful for a land owner to create an object that his tenants could use to check their own prim use. That way they could police themselves, instead of having group officers run regular prim count scans and notify the residents. So I guess the function in its existing form could be used with a 'map' of some sort - if it knew the locations of the parcels, it could run a check and generate a report when a group officer used the script. That's better than nothing, but an object that could be placed in each parcel would be a lot better, IMO.
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
12-04-2006 14:03
From: Ziggy Puff ...if it knew the locations of the parcels, it could run a check and generate a report when a group officer used the script... This is exactly what I have now - the script checks prim usage, looks for certain prim usages, and the sends IMs and gives notecards to residents that are over their prim limit. The script also notifies me with a report by email so that I can follow-up if necessary. This has improved things a great deal for my operations since all I need to do is click a box and it does what used to take me upwards of 30 minutes to do, twice a day. It has helped me recover 'orphaned' prims (things that belong to people no longer renting or in the group) and tighten up on overall compliance. The real value is, as you described, allowing tennants to check their own prim usage on demand since this is the most often requested information. A middle-of-the-road solution is to have the checking script report prim usage to all tennants so at least they have some feedback about how many prims they are using without having to ask. -2fast
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-04-2006 14:13
So... you're using a list of position vectors that cover all parcels in your estate? Or is the script smarter, and scans the entire sim and figured out where the parcels are?  It's been a long time since I tried any map generation/traversal algorithms. Linked lists / trees in LSL, anyone?  Time to hit the Wiki, I have no idea what functions we have for dealing with sims/parcels. From: someone A middle-of-the-road solution is to have the checking script report prim usage to all tennants so at least they have some feedback about how many prims they are using without having to ask. That's a good idea.
|
Dragon Eccleston
Registered User
Join date: 25 Dec 2005
Posts: 42
|
12-04-2006 14:58
I use llOverMyLand() but that has to be in a script owned by the land owner, so if it's owned by group it requires a 2 prim solution. The Grey Goo Stopper is an open source script that's ready to roll, well, cept for that annoying "doesn't work when the owner is away" problem
|
2fast4u Nabob
SL-ice.net
Join date: 28 Dec 2005
Posts: 542
|
12-04-2006 15:47
From: Ziggy Puff So... you're using a list of position vectors that cover all parcels in your estate? Or is the script smarter... For my mainland holdings, I do as you mentioned - I hard coded the locations of my parcels of land within the sim and have the script query prim usage. I don't bother traversing a map or anything cool like that since I have owned the same parcels of land for many months now and don't expect them to move on their own  I take a just in time approach to handling resident name resolution since it involves the infamous dataserver event. I also recently extended the solution to compare allowed limits with actual usage; however that is based on static information (soon to be dynamic). As for my estate, I have a large, common area as opposed to plots of land becuase I mostly lease condo apartments there. As a result, a single scanner placed anywhere on my estate does the trick. I am ahead in my RL project today, so I have been working on the script today (offline) - looking forward to testing some cool new functionality. One thing you need to watch for is using this llGetParcelPrimOwners in already existing, relatively large scripts. The list of resident/prim useage pairs can take a lot of memory, so you might want to implement this in a separate script and use link messages to communicate/pass data to avoid the ever helpful "Stack Heap Collision" error when you run out of memory. This approach especially necessary if you plan to convert keys to resident names and save them for use later. -2fast
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-04-2006 16:11
Thanks. That's all good advice. Is there a 4m x 4m minimum parcel size, or am I remembering that wrong? I was thinking of a script that checked parcel names for the whole sim, and built up a list of names and coordinates for each new name it found. If I use 1m increments, that's 64K vectors to check  Being able to move in 4m increments brings that down to a much more managable 4K. And yes, this data should be cached, or written to chat so the owner could stick it into a notecard or something. The rest of it would work the way you're describing. Think this might be a useful tool to develop? I'm assuming many estate owners would like to have this ability. It'll only run when the owner is present, but that's still better than what they can do today, right, cause that involves physically walking around all the parcels? I'll try and get started on some of this tonight. Edit: I was thinking of using llGetParcelDetails in a 2D loop. This is synchronous, doesn't seem to have a time penalty, and will return the parcel name at a given location.
|
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
|
12-04-2006 20:34
OK, I'm going to bug report this. Kelly says it should work the way we think it should work. /139/66/152819/1.html#post1351253
|
grumble Loudon
A Little bit a lion
Join date: 30 Nov 2005
Posts: 612
|
12-06-2006 04:19
For now use the Key2Name hack to check to see if the owner is online and then run then.
I see it still being usefull since I can log in and have it email me the owners names, whose prims that I have to hunt down.
|