Jump to content

Prim Counter for Multiple (but not all) Avatars on Same Parcel?


Recommended Posts

I am attempting to script a prim counter that will count only the prims rezzed by specific team members (not every single prim owner on the parcel) and it gets their UUIDs from a notecard provided by the user. I understand that the below code will get the prim count for a single user (where "Builder" is the key/UUID of an avatar.) But I'm stumped as to how to make "Builder" rotate through the UUIDs from the list to get the counts of only the few specified avatars in the list.

OwnersCounts = llGetParcelPrimOwners(llGetPos());
string Prims = llList2String(OwnersCounts,llListFindList(OwnersCounts,[Builder])+1);

The above only works for one avatar so I tried the following, where "gLines" is how many UUIDs are in my list (currently 4) and "builder_UUIDs" is the list created from the notecard (notecard reader part all properly tested and working as intended), but "string Prims" returns the one same UUID for all 4 lines and not a prim count at all. Any help pointed in the right direction is greatly appreciated! Thank you!

integer x;
for(;x < gLines; ++x)
    {
        Builder = llList2Key(builder_UUIDs, x);
        string Prims = llList2String(OwnersCounts,llListFindList(OwnersCounts,[Builder])+1);
    }

 

Edited by Ember Ember
Link to post
Share on other sites

I think your issue might be the index given by llListFindList. When it can't find a result, it returns -1. Then +1 is added and it becomes index 0, AKA the first item in the list.

Judging by the code you've shown, your list is sorted like this: [uuid, string, uuid, string, ...] and that's why you're getting the same UUID every time.

And I suspect the reason why llListFindList can't find Builder is because they're strings (not keys) when you're reading the notecard lines into the list.

Your problem then, is the fact that "779e1d56-5500-4e22-940a-cd7b5adddbe0" is not (key)"779e1d56-5500-4e22-940a-cd7b5adddbe0"

Try replacing llList2Key with llList2String.

Edited by Wulfie Reanimator
  • Like 1
Link to post
Share on other sites
30 minutes ago, Wulfie Reanimator said:

Try replacing llList2Key with llList2String.

Hmm I tried this and made sure I changed the global variable from "key Builder;" to "string Builder;" but yielded the same results.
 

integer x;
    for(;x < gLines; ++x)
    {
        Builder = llList2String(builder_UUIDs, x);
        llOwnerSay("Builder = "+ Builder);
        string Prims = llList2String(OwnersCounts,llListFindList(OwnersCounts,[Builder])+1);
        llOwnerSay("Prims = "+Prims);
    }

llOwnerSay output:

[13:25:47] Prim Counter: Builder =  40f0a24b-d94e-4c6e-8575-716d586bc62a 
[13:25:47] Prim Counter: Prims = 0f6747a6-ea64-4f41-ba4f-30df2ddbb370
[13:25:47] Prim Counter: Builder =  0f6747a6-ea64-4f41-ba4f-30df2ddbb370 
[13:25:47] Prim Counter: Prims = 0f6747a6-ea64-4f41-ba4f-30df2ddbb370
[13:25:47] Prim Counter: Builder =  c9088b10-94b0-99b2-9e66-e6f936506033 
[13:25:47] Prim Counter: Prims = 0f6747a6-ea64-4f41-ba4f-30df2ddbb370
[13:25:47] Prim Counter: Builder =  d8f9f59d-a86e-20f8-151c-aa9262e2495c 
[13:25:47] Prim Counter: Prims = 0f6747a6-ea64-4f41-ba4f-30df2ddbb370

Link to post
Share on other sites
4 minutes ago, Ember Ember said:

Hmm I tried this and made sure I changed the global variable from "key Builder;" to "string Builder;" but yielded the same results.
 


integer x;
    for(;x < gLines; ++x)
    {
        Builder = llList2String(builder_UUIDs, x);
        llOwnerSay("Builder = "+ Builder);
        string Prims = llList2String(OwnersCounts,llListFindList(OwnersCounts,[Builder])+1);
        llOwnerSay("Prims = "+Prims);
    }

llOwnerSay output:

[13:25:47] Prim Counter: Builder =  40f0a24b-d94e-4c6e-8575-716d586bc62a 
[13:25:47] Prim Counter: Prims = 0f6747a6-ea64-4f41-ba4f-30df2ddbb370
[13:25:47] Prim Counter: Builder =  0f6747a6-ea64-4f41-ba4f-30df2ddbb370 
[13:25:47] Prim Counter: Prims = 0f6747a6-ea64-4f41-ba4f-30df2ddbb370
[13:25:47] Prim Counter: Builder =  c9088b10-94b0-99b2-9e66-e6f936506033 
[13:25:47] Prim Counter: Prims = 0f6747a6-ea64-4f41-ba4f-30df2ddbb370
[13:25:47] Prim Counter: Builder =  d8f9f59d-a86e-20f8-151c-aa9262e2495c 
[13:25:47] Prim Counter: Prims = 0f6747a6-ea64-4f41-ba4f-30df2ddbb370

At this point it'd be easier to see an example of what the notecard looks like, and the full script. What is the +1 for the index there for?

  • Like 1
Link to post
Share on other sites
8 minutes ago, Wulfie Reanimator said:

At this point it'd be easier to see an example of what the notecard looks like, and the full script. What is the +1 for the index there for?

The +1 is so that it returns the prim-count value, not the UUID value in the list. And thank you for making me look at the notecard because that was the issue all along! There were spaces in it in front of each UUID, so "Builder" was showing an additional space in front of each UUID. *facepalm* Thanks for opening my eyes wide enough to find that. 😅 It works as intended now. I really appreciate your help Wulfie!

  • Like 2
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...