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

LSL Wiki : llGetNumberOfSides

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl805.us.archive.org
integer llGetNumberOfSides()

Returns the number of sides of the prim containing this script.

Each face of a primitive can be referenced to, from 0 to n - 1, where n is the value returned from this function. Each face can have a different texture, color, and opacity (alpha).

Examples:
// Indicates number of sides using llSetText.
default
{
    changed(integer change)
    {
        if(change & CHANGED_SHAPE)
        {
            integer sides = llGetNumberOfSides();
            llSetText((string)sides + llList2String([" side"," sides"],(sides != 1)),<1,1,1>,1);
        }
    }
}


// this rotates the texture of each side to match its sidenumber in degrees
// after running this script, you can select each texture (using "Select Texture")
// in the edit dialog and read it's side number in the "Rotation (degrees)" field.
default {
    state_entry() {
        integer    i;
        integer    sides;
        
        sides = llGetNumberOfSides();
        for (i = 0; i < sides; i++) {
            llRotateTexture(i * DEG_TO_RAD, i); // rotate by side number degrees
        }
    }
}


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

Functions | Texture | Side
Comments [Hide comments/form]
Added a simple side script since previous one seemed a bit complex. The jump loop might not be the most efficient way to do it (and perhaps there's a way to only run the loop when side-related changes occur?) but it's all I know so far.
-- EepQuirk (2005-02-03 18:08:05)
BAD
Those are really bad coding practices.

You should *only* use jumps when script logic is too complex to represent any other way without compromising the readability of the code (or making it infinately complex).

If you want an infinite loop try
while(1){;}
and you shouldn't be using infinite loops.

*shakes fist*
this is why we have a page on clever coding.
-- BlindWanderer (2005-02-03 18:37:28)