Touchbox (fun)

Written by Kitsune
// OPEN SOURCE!! DO NOT RESELL!!
// © 2008 by FoxSan Yosuke
 
integer second;
vector startPosition;
 
default
{
    state_entry()
    {
        llSetText("I am just a box. \n But whatever you do, do NOT touch me! D:", <1,1,1>, 1.5);
        startPosition = llGetPos();
    }
 
on_rez(integer start_param)
    {
       llResetScript();
    }
 
    touch_start(integer total_number)
    {
        llSay(0, "OMG! You touched me! D: RAEP! HEEELP! O.o");
        llPlaySound("Sound1", 1.0);
        llPlaySound("Sound1", 1.0);
        llSetTimerEvent( 0.5 );
    }
 
timer()
  {
      second++;
      float X_dis = llFrand( 10.0 );
      float Y_dis = llFrand( 10.0 );
      float Z_dis = llFrand( 10.0 );
      vector displacement = < X_dis, Y_dis, Z_dis >;
      vector newPosition = startPosition + displacement;
      llSetPos( newPosition );
      if ( second > 15 )
      {
          while ( llVecDist( llGetPos(), startPosition ) > 0.001)
          {
              llSetPos( startPosition );
          }
          llSay( 0, "I feel SO violated! ._." );
          llPlaySound("Sound2", 1.0);
          llResetScript();
      }
  }
}