User:Cow Taurog/Prim count

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Shows how many prims the parcel holds, and how many are left with hovertext.

vector gvColor=<0,0.5,1>;
integer giMaxPrims;
integer giPrimCount;
integer giPrimsLeft;
float gfDelay=1;
 
default{
    state_entry(){
        giMaxPrims = llGetParcelMaxPrims(llGetPos(),FALSE);
        giPrimCount = llGetParcelPrimCount(llGetPos(),0,FALSE);
        giPrimsLeft = (giMaxPrims - giPrimCount);
        llSetText((string)giPrimsLeft + " prims left.",gvColor,1);
        llSetTimerEvent(gfDelay);
    }
 
    timer(){
        giMaxPrims = llGetParcelMaxPrims(llGetPos(),FALSE);
        giPrimCount = llGetParcelPrimCount(llGetPos(),0,FALSE);
        giPrimsLeft = (giMaxPrims - giPrimCount);
        llSetText((string)giPrimsLeft + " prims left.",gvColor,1);
    }
}