OpenSimWorld is the directory of 3D Virtual Worlds based on OpenSimulator and connected through the HyperGrid. Learn More

The Amazing Device. Have you ever backed up oars for a long period of time, lost several of the original, but hey that's ok! You've got the more recent ones! But then you discover a horrible secret. When you move an item, the exact same item is still in the same spot, so you move that one, and Lo and behold, another one? I recently found that my hallmark sim known as DragonFyre had 3 copies of every object in the exact same spot. Like I had loaded an oar 3 times. Only the problem was, I hadn't done that. I had loaded one oar. The problem is that at some point long ago I must have loaded the oar on top of itself multiple times SOMEHOW....??? So now how to fix it? I've got 3 copies of every item on this sim in the exact same spot. And every oar I've saved for over 3 years has this exact same problem. So I created the amazing device. All you do is enable console commands in osslenable (for region god only). Then put this script in a box and let it run. Over time the box will move all around your sim finding those duplicated items and remove them leaving just 1 original in that exact spot. So your sim still looks the same but now there is only one copy of the item in that spot instead of 2 or more... Here's the script:
integer gIntDist = 4;
integer gIntXStart = 4;
integer gIntYStart = 4;
integer gIntZStart = 4;
integer intX;
integer intY;
integer intZ;
integer gIntSwitch = 0;
list gLstObjectVectors;
list gLstObjectKeys;
float range = 96;
float rate = 10.0;
vector gVecPos;

integer fnKeyInList( key KyThisObjKey )
{
integer len = llGetListLength( gLstObjectKeys );
integer i;
for( i = 0; i < len; i++ )
{
if( llList2Key(gLstObjectKeys, i) == KyThisObjKey )
{
return TRUE;
}
}
return FALSE;
}

default
{
state_entry()
{

}

touch_start(integer p)
{
gIntSwitch =! gIntSwitch;
if (gIntSwitch == 1)
{
llSensorRepeat( "", "", PASSIVE, range, TWO_PI, rate );
llOwnerSay(" Sensor On.");
llSetTimerEvent(120);
}
if (gIntSwitch == 0)
{
llSensorRemove();
llOwnerSay(" Sensor Off.");
llSetTimerEvent(0);
}
}

sensor( integer number_detected )
{
integer i;
for( i = 0; i < number_detected; i++ )
{
key kyThisObjKey = llDetectedKey( i );
if( fnKeyInList( kyThisObjKey ) == FALSE )
{
gLstObjectKeys += kyThisObjKey;
}
else
{

}
}
for (i=0; i < number_detected; i++)
{
gLstObjectVectors = gLstObjectVectors + llList2List(llGetObjectDetails(llList2Key(gLstObjectKeys,i),[OBJECT_POS]),0,0);
}
for (i=0; i < number_detected; i++)
{
integer j;
for (j=j+i+1; j< number_detected; j++)
{
if (llList2Vector(gLstObjectVectors,i) == llList2Vector(gLstObjectVectors,j))
{
string command = "delete object id";
command = command + " " + llList2Key(gLstObjectKeys,j);
integer result = osConsoleCommand(command);
if (result == TRUE)
{
llSay(PUBLIC_CHANNEL, "Command \"" + command + "\" executed with success ...");
}
else
{
llSay(PUBLIC_CHANNEL, "Command \"" + command + "\" executed without success ...");
}
gLstObjectVectors = llDeleteSubList(gLstObjectVectors,j,j);
gLstObjectKeys = llDeleteSubList(gLstObjectKeys,j,j);
}
}
}
gLstObjectVectors = "";
gLstObjectKeys = "";
}

timer()
{
intX = intX + gIntDist;
if (intX > 250)
{
intX = gIntXStart;
intY = intY + gIntDist;
if (intY > 250)
{
intY = gIntYStart;
intZ = intZ + gIntDist;
if (intZ > 250)
{
intZ = gIntZStart;
}
}
}
gVecPos = ;
llSetRegionPos(gVecPos);
}
}