All pastes #838232 Raw Edit

Something

public text v1 · immutable
#838232 ·published 2007-12-30 06:41 UTC
rendered paste body
using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;namespace SecondLife { public class Script : OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass { public Script() { }  
int counter;
int second;



    public void default_event_state_entry()
    {
        llSay( 0, "Hello, Avatar! Touch to change color and size.");
        counter = 0;
    }

    public void default_event_touch_start(int total_number)
    {
        counter = counter + 1;        
        
        llSay( 0, "Touched by angel number " + counter.ToString());

        llSetTimerEvent( 2 );  // create a "timer event" every 2 seconds.
    }

    public void default_event_timer()  // do these instructions every time the timer event occurs.
    {
        second++;

        // choose three random RGB color components between 0. and 1.0.
        double red = llFrand( 1.0 );  
        double green = llFrand( 1.0 );
        double blue = llFrand( 1.0 );
        
        // combine color components into a vector and use that vector
        // to set object color.
        LSL_Types.Vector3 prim_color = new LSL_Types.Vector3( red, green, blue );  
        llSetColor( prim_color, ALL_SIDES );   // set object color to new color.
        
        // a choose random number between 0. and 10 for use as a scale factor.
        double new_scale = llFrand( 10.0 );  
        llSetScale(new LSL_Types.Vector3( new_scale, new_scale, new_scale ) ); // set object scale.
       
        if ( second > 400 )  // then time to wrap this up.
        {         
            // turn object black, print "resting" message, and reset object....
            llSetColor( new LSL_Types.Vector3( 0, 0, 0 ), ALL_SIDES );
            
            llSay( 0, "Object now resting and resetting script." );
            llResetScript();  // return object to ready state.
        }
    }

} }