Difference between revisions of "User:PixelProphet Lane/Scripts"

From Second Life Wiki
Jump to navigation Jump to search
Line 357: Line 357:
         }
         }
   
   
    }
}
</lsl>
}}
{{box|Show Agent Script Count and memory|
This script will display the amount of script attached to the avatar that touches the prim this script is in, and will display the amount of memory used by those scripts.
<lsl>
//Agent Script Count and memory usage by PixelProphet Lane
string bytesToSize(integer bytes)
{
    list units = ["Bytes", "KiloBytes", "MegaBytes", "GigaBytes", "TerraBytes"];
    if (bytes == 0) return "n/a";
    integer i = llFloor(llLog(bytes) / llLog(1024));
    string val = (string)llRound(bytes / llPow(1024, i));
    return val + " " + llList2String(units,i);
}
string ONAME;
default
{
    on_rez(integer arg)
    {
        llResetScript();
    }
   
    state_entry()
    {
        ONAME = llGetObjectName();
        llSay(0,llGetEnv("sim_channel") + " " + llGetEnv("sim_version"));       
    }
    touch_start(integer total_number)
    {
        llSetObjectName(llDetectedName(0));
        list data = llGetObjectDetails(llDetectedKey(0),[OBJECT_TOTAL_SCRIPT_COUNT,OBJECT_SCRIPT_MEMORY]);
        string scripts = llList2String(data,0);
        integer mem = llList2Integer(data,1);
        string memory = bytesToSize(mem);
        llSay(0,"/me has "+scripts+" scripts attached using a total of "+memory);
        llSetObjectName(ONAME);
     }
     }
}
}
</lsl>
</lsl>
}}
}}

Revision as of 13:01, 7 December 2010

Fast List Prim Contents


Real Object Inventory To Dialog


Show Agent Script Count and memory