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

LSL Wiki : LibraryFixRepeatsPerMeter

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
Make a building by roughly positioning walls, then drop this script on each prim. It rescales to grid, positions to grid, and fixes repeats per meter, then deletes self.

default
{
    state_entry()
    {
        // round position to grid
        float grid = 0.125;
        vector pos = llGetPos();
        pos.x = grid * llRound(pos.x / grid);
        pos.y = grid * llRound(pos.y / grid);
        pos.z = 27.750;
        llSetPos(pos);

        // round scale to twice grid
        grid *= 2.0;
        vector scale = llGetScale();
        scale.x = grid * llRound(scale.x / grid);
        if (scale.x == 0) { scale.x = grid; }
        scale.y = grid * llRound(scale.y / grid);
        if (scale.y == 0) { scale.y = grid; }
        scale.z = 3.0;
        llSetScale(scale);
        llSay(0, "scale " + (string)scale);
        
        // repeats per meter
        float r = 0.5;
        llScaleTexture(r*scale.x, r*scale.z, 1);
        llScaleTexture(r*scale.y, r*scale.z, 2);
        llScaleTexture(r*scale.x, r*scale.z, 3);
        llScaleTexture(r*scale.y, r*scale.z, 4);
        
        //string me = llGetInventoryName(INVENTORY_SCRIPT, 0);
        //llRemoveInventory(me);
        llRemoveInventory(llGetScriptName());
    }
}

ScriptLibrary
There is no comment on this page. [Display comments/form]