Don't click here unless you want to be banned.

LSL Wiki : llGetNumberOfPrims

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
integer llGetNumberOfPrims()

Returns the number of prims in (and avatars seated on) the object the script is in.

Note: this function works regardless of whether the script is in the parent or a child prim in a linked set.

//Returns the number of agents on the object
integer GetNumberOfAgents()
{//ignores avatars.
    integer a = llGetNumberOfPrims();
    integer b = a;
    if(1 < a)
        while(llGetAgentSize(llGetLinkKey(a)))
            --a;
    return b - a;
}

//Returns the number of prims in the object
integer GetNumberOfPrims()
{//ignores avatars.
    integer a = llGetNumberOfPrims();
    if(1 < a)
        while(llGetAgentSize(llGetLinkKey(a)))
            --a;
    return a;
}

More streamlined versions of these above functions from LSL Portal:
//Returns the number of agents on the object
integer GetNumberOfAgents()
{
    return llGetNumberOfPrims() - llGetObjectPrimCount(llGetKey()); //counts avatars
}
 
//Returns the number of prims in the object
integer GetNumberOfPrims()
{
    return llGetObjectPrimCount(llGetKey()); //ignores avatars
}


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Object | Prim | Link
There is no comment on this page. [Display comments/form]