Counter – Adds one by Touch

Expired

integer x = 0;
 
default
{
    state_entry()
    {
        llSay( 0, "x has a value of: " + (string)x );
    }
 
    touch_start(integer total_number)
    {
        {
            x = x + 1;
            llSetText((string)x,<1 ,1,1>,1);
        }
    }
}

 

Screen Flicker

Expired

default
{
    state_entry()
    {
        llOffsetTexture(0.0, 0.0, ALL_SIDES);
        llScaleTexture(10.0, 10.0, ALL_SIDES);
        llSetTextureAnim(ANIM_ON|LOOP,ALL_SIDES,10,10,0,0,50);
//        llSetTextureAnim(ANIM_ON|LOOP,ALL_SIDES,1,5,0,5,30);
    }
}

 

Timed Repeater

Expired

default
{
    state_entry()
    {
       llSetTimerEvent( 360 );
    }
    timer ()
        {
            llSay(0,"/me is repeating him/herself.");
        }
}

 

Capturing Control Inputs

Expired

// Bromley College 
// Linden Script Exhibition
 
// Code for poster 35
 
integer count;
vector startPosition;
float groundLevel;
 
default
{
 
     state_entry()
   {
       llSetTimerEvent( 0 ); //disable timer
       startPosition = llGetPos();
       groundLevel = llGround( startPosition );
 
   }
 
    touch_start(integer total_number) //wait for an avatar to touch chair
    {
        llSay(0, "Respond to the dialog box and then sit on the chair. Once sat touch the chair again");
        llRequestPermissions(llDetectedKey(0), PERMISSION_TAKE_CONTROLS); //ask permission to take control of the agent's keys.
        state new; 
    }
}
 
state new
{
  touch_start(integer total_number)
    {    
         count == 0;      // zero count
        llSetTimerEvent( 1 ); //enable one second timer event
    if ((llGetPermissions() & PERMISSION_TAKE_CONTROLS)) //if take control permission has been given 
 
                {
            llSay(0, "Control Granted. You can now use your forward and back arrow keys to control the chair");
              llTakeControls( CONTROL_FWD | CONTROL_BACK, TRUE, FALSE );            
            //state default;   
        }    
        if (! (llGetPermissions() & PERMISSION_TAKE_CONTROLS)) //if control permission has not been given
        {
             llSay(0, "Agent has not given permission");
             llResetScript();  
        }
    }
 
    control( key id, integer held, integer change )  // event for processing key press.
        { 
            vector position = llGetPos();
 
                if ( change & held & CONTROL_FWD ) 
            {   // the "move forward" control has been activated.
                    if( position.z <(startPosition.z + 10.0) )
                        {
                       llSetPos( llGetPos() + < 0, 0, 1.0 >); // move up
                        }
            } 
            else if ( change & held & CONTROL_BACK ) 
            {   // the "move backward" key has been activated.
                    if( position.z > groundLevel + 1.0 ) 
                    {
                           llSetPos( llGetPos() + <0, 0, -1.0 >); // move down
                    }
            }
        }
 
  timer ()  // Reset the object to it's original position after 20 seconds
  {
      count ++;     //increment count
      if(count > 20) // reset after 20 secs
      {
         llSetPos( startPosition );
         llResetScript(); 
      }
  }
}
 
// End of code;