Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
04-18-2004 05:38
would be nice to have a function that returns the number of linked prims in the object the script is in. don't really want to have to use integer t; while(llGetLinkKey(t)) t++;
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Xylor Baysklef
Scripting Addict
Join date: 4 May 2003
Posts: 109
|
04-18-2004 07:11
I agree, this would be useful, along with a function to get the number of lines in a notecard. Here is what I use in the meantime: integer GetNumberOfPrims() { // First check for the case that this is unlinked. if (llGetLinkNumber() == 0) return 1;
// This figures out how many prims are in the set. // It uses a binary search. integer UpperBound = 256; integer LowerBound = 0; integer CurrentLink = 128;
key LinkKey; integer Done = FALSE; while (!Done) { LinkKey = llGetLinkKey(CurrentLink);
// If this is NULL_KEY, then this is not in the set (too big). if (LinkKey == NULL_KEY) { // Change our upper bound, and try a lower link. UpperBound = CurrentLink - 1; } else { // Change our lower bound, and try a higher link. LowerBound = CurrentLink + 1; }
// Check if we have finished searching. if (UpperBound < LowerBound) { Done = TRUE; // See if this final test was a null key or not. if (LinkKey == NULL_KEY) CurrentLink--; } else CurrentLink = (UpperBound + LowerBound) / 2; }
return CurrentLink; }
Xylor
|
Bino Arbuckle
Registered User
Join date: 31 Dec 2002
Posts: 369
|
04-18-2004 23:59
Xylor, this appears to only work for a script in the object.
I'd be interested in something along the lines of the llDetected* functions used for sensors and whatnot.
Would make an accurate prim usage counting for landlords possible.
|
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
|
04-19-2004 00:29
*worship* I was thinking of using a binary search but was to lazy to code it.
*runs off with code*
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river. - Cyril Connolly
Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence. - James Nachtwey
|
Oz Spade
ReadsNoPostLongerThanHand
Join date: 23 Sep 2003
Posts: 2,708
|
04-19-2004 03:37
I endorse this idea/feature. Would definitly come in handy.
_____________________
"Don't anticipate outcome," the man said. "Await the unfolding of events. Remain in the moment." - Konrad
|
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
|
04-19-2004 08:11
Almost as nice would be my proposed UI change to the land window that would break down object use on a per-owner basis... With a return button for each separate player. And a profile button. Browse list, note resident X has too many prims for their apartment, click profile, click IM, "You have 160 too many prims in use in your apartment, dude! Delete the ten 16-prim lamps or I will!!!  "
_____________________
~ Tiger Crossing ~ (Nonsanity)
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
04-19-2004 18:30
From: someone Originally posted by Bino Arbuckle Xylor, this appears to only work for a script in the object.
I'd be interested in something along the lines of the llDetected* functions used for sensors and whatnot.
Would make an accurate prim usage counting for landlords possible. I support this suggestion.  *Anything* to improve sensors. WE STILL NEED llDetectedScale!!!!!!
|