OBJECT_SCRIPT_TIME
The script info in the land pane has been very useful to me since it arrived last year (Babbage wrote it I believe). Most recently I've used it to cut down script impact on pieces of my robot avatar (whgich has things like an arm that has a rotating spiral and pincers that clench/unclench when I walk, etc.). The most recent script impact assessment tool came out last week, though, and it's the ability to find out OBJECT_SCRIPT_TIME with lsl.
Chalice Yao has a nice forum post with scripts for objects and avatars over at SLU - thank you, Chalice.
Here's the one for objects:
key kTarget;
string sTarget;
integer iTemp;
string sTemp;
list lTemp;
default
{
state_entry()
{
llSetTimerEvent(0.01);
sTarget=llKey2Name(kTarget=llGetObjectDesc());
}
timer()
{
llSensor("","",ACTIVE,96,PI);
}
sensor(integer foo)
{
iTemp=0;
do
{
if(llDetectedType(iTemp) & SCRIPTED)
{
sTemp="";
sTemp+=llDetectedName(iTemp)+"\n";
sTemp+="Time: "+llGetSubString((string)(llList2Float(lTemp=llGetObjectDetails(llDetectedKey(iTemp),[OBJECT_SCRIPT_MEMORY,OBJECT_SCRIPT_TIME,OBJECT_TOTAL_SCRIPT_COUNT]),1)*1000),0,4)+"ms\n";
sTemp+="Memory: "+(string)(llList2Integer(lTemp,0)/1024)+"kb\n";
sTemp+="Amount: "+llList2String(lTemp,2);
llSetText(sTemp,<1,1,1>,1);
jump a;
}
}
while((iTemp=-~iTemp) < foo); @a; } no_sensor() { llSetText("",<1,1,1>,0);
}
}
string sTarget;
integer iTemp;
string sTemp;
list lTemp;
default
{
state_entry()
{
llSetTimerEvent(0.01);
sTarget=llKey2Name(kTarget=llGetObjectDesc());
}
timer()
{
llSensor("","",ACTIVE,96,PI);
}
sensor(integer foo)
{
iTemp=0;
do
{
if(llDetectedType(iTemp) & SCRIPTED)
{
sTemp="";
sTemp+=llDetectedName(iTemp)+"\n";
sTemp+="Time: "+llGetSubString((string)(llList2Float(lTemp=llGetObjectDetails(llDetectedKey(iTemp),[OBJECT_SCRIPT_MEMORY,OBJECT_SCRIPT_TIME,OBJECT_TOTAL_SCRIPT_COUNT]),1)*1000),0,4)+"ms\n";
sTemp+="Memory: "+(string)(llList2Integer(lTemp,0)/1024)+"kb\n";
sTemp+="Amount: "+llList2String(lTemp,2);
llSetText(sTemp,<1,1,1>,1);
jump a;
}
}
while((iTemp=-~iTemp) < foo); @a; } no_sensor() { llSetText("",<1,1,1>,0);
}
}
Post a Comment
PLZ LEEVE A MEZZAGE KTHNXBAI