User:Cow Taurog/Prim count

From Second Life Wiki
Jump to navigation Jump to search

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);
    }
}