WARNING and DISCLAMER: Running this will most likely crash the sim you start it in. Trust me I had Linden personnel inform me of this the first time I accidentally set it off. Lets put it this way. This scrip can generate hundreds of objects in a matter of seconds. If you use it you will probably bet written up and or banned. So be warned. I am posting this as an example of self replicating objects and what not to do with them.
to use simply place in an object then place a copy of that object in it self so.
OBJECT: obj - contents
->this script
->obj - contents
->this script
CODE
//bad idea v1.5
//just because its a bad idea dosent mean i cant make it worse
//thus a quote by our fav invader ZIM
//you made the fires worse!!!
//ZIM - Worse or better??
vector generate_position()
{
vector v_pos = llGetPos();
float f_rand_x = llFrand(10) - 5;
float f_rand_y = llFrand(10) - 5;
float f_rand_z = llFrand(10) - 5;
while((v_pos.x + f_rand_x) > 254 || (v_pos.x + f_rand_x) < 1 )
{
f_rand_x = llFrand(10) - 5;
}
while((v_pos.y + f_rand_y) > 254 || (v_pos.y +f_rand_y) < 1 )
{
f_rand_y = llFrand(10) - 5;
}
while((v_pos.z + f_rand_z) > 254 || (v_pos.z + f_rand_z) < 1 )
{
f_rand_z = llFrand(10) - 5;
}
return v_pos + <f_rand_x,f_rand_y,f_rand_z>;
}
default
{
state_entry()
{
}
touch_start(integer total_number)
{
llRezObject("obj",generate_position(),<0,0,0>,<0,0,0,0>,0);
}
object_rez(key id)
{
llGiveInventory(id,"obj");
}
changed(integer change)
{
state spawn;
}
}
state spawn
{
state_entry()
{
llListen(4,"",NULL_KEY,"");
llRezObject("obj",generate_position(),<0,0,0>,<0,0,0,0>,0);
}
object_rez(key id)
{
llGiveInventory(id,"obj");
llRezObject("obj",generate_position(),<0,0,0>,<0,0,0,0>,0);
}
listen(integer chan,string name,key id,string msg)
{
if(msg == "killall")
{
llSay(4,"killall");
llDie();
}
}
}
well thats all folks. IM me if u got any questions