From fb8faa8336ddb795ccd6840259b06a2608350a57 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 12 Jan 2009 18:00:46 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2913 * Add the KanEd scripts to the standard library * Thanks Fly-Man- --- bin/assets/ScriptsAssetSet/KanEd-Test04.lsl | 51 +++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 bin/assets/ScriptsAssetSet/KanEd-Test04.lsl (limited to 'bin/assets/ScriptsAssetSet/KanEd-Test04.lsl') diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test04.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test04.lsl new file mode 100644 index 0000000..5aa25af --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test04.lsl @@ -0,0 +1,51 @@ +integer counter; +integer second; +vector startPosition; + +default +{ + state_entry() + { + llSay( 0, "Hello, Avatar! Touch to change position."); + counter = 0; + startPosition = llGetPos(); + } + + touch_start(integer total_number) + { + counter = counter + 1; + + llSay( 0, "Touched by angel number " + (string)counter); + + llSetTimerEvent( 1 ); // arrange for a "timer event" every second. + } + + timer() // do these instructions every time the timer event occurs. + { + second++; + + // choose three random distances between 0. and 10.0. + float X_distance = llFrand( 10.0 ); + float Y_distance = llFrand( 10.0 ); + float Z_distance = llFrand( 10.0 ); + + // combine these distance components into a vector and use it + // to increment the starting position and reposition the object. + vector increment = < X_distance, Y_distance, Z_distance >; + vector newPosition = startPosition + increment; + llSetPos( newPosition ); // reposition object. + + if ( second > 19 ) // then time to wrap this up. + { + // move object back to starting position... + while ( llVecDist( llGetPos(), startPosition ) > 0.001) + { + llSetPos( startPosition ); + } + + llSay( 0, "Object now resting and resetting script." ); + llResetScript(); // return object to ready state. + } + } +} + -- cgit v1.1