Add new files
This commit is contained in:
82
Script Tests/Script tests/Object/GrafittiBoard.lsl
Normal file
82
Script Tests/Script tests/Object/GrafittiBoard.lsl
Normal file
@@ -0,0 +1,82 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
// Grafitti board 0.0.2 for OpenSim
|
||||
// By Justin Clark-Casey (justincc)
|
||||
// http://justincc.wordpress.com
|
||||
|
||||
// This script is available under the BSD License
|
||||
|
||||
string text = "";
|
||||
|
||||
integer LISTENING_CHANNEL = 43;
|
||||
|
||||
// XXX Only putting this here as well to get around OpenSim's int -> string casting oddness
|
||||
string LISTENING_CHANNEL_STRING = "43";
|
||||
|
||||
// FIXME: Should be dynamic!
|
||||
integer CHARS_WIDTH = 42;
|
||||
|
||||
// Add some additional graffiti
|
||||
addGraffiti(string message)
|
||||
{
|
||||
while (llStringLength(message) > CHARS_WIDTH)
|
||||
{
|
||||
text += "\n\n" + llGetSubString(message, 0, CHARS_WIDTH - 1);
|
||||
message = llDeleteSubString(message, 0, CHARS_WIDTH - 1);
|
||||
}
|
||||
|
||||
text += "\n\n" + message;
|
||||
}
|
||||
|
||||
// Clear the existing graffiti
|
||||
clearGraffiti()
|
||||
{
|
||||
text = "";
|
||||
}
|
||||
|
||||
// Actually fires the graffiti out to the dynamic texture module
|
||||
draw()
|
||||
{
|
||||
//llSay(0, text);
|
||||
string drawList = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text " + text + ";";
|
||||
|
||||
osSetDynamicTextureData("", "vector", drawList, "1024", 0);
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSetText(
|
||||
"Say /" + LISTENING_CHANNEL_STRING + " <message> to add text."
|
||||
+ " Say /" + LISTENING_CHANNEL_STRING
|
||||
+ " !clear to clear board",
|
||||
<0.0, 1.0, 0.0>, 1.0);
|
||||
|
||||
llListen(LISTENING_CHANNEL, "", NULL_KEY, "");
|
||||
|
||||
addGraffiti("justincc's graffiti board v0.0.2");
|
||||
addGraffiti("Now with primitive word wrap!");
|
||||
draw();
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string message)
|
||||
{
|
||||
if (message == "!clear")
|
||||
{
|
||||
clearGraffiti();
|
||||
}
|
||||
else
|
||||
{
|
||||
addGraffiti(message);
|
||||
}
|
||||
|
||||
draw();
|
||||
}
|
||||
}
|
||||
22
Script Tests/Script tests/Object/KanEd-Test01.lsl
Normal file
22
Script Tests/Script tests/Object/KanEd-Test01.lsl
Normal file
@@ -0,0 +1,22 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar!");
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llSay( 0, "Touched.");
|
||||
}
|
||||
}
|
||||
|
||||
40
Script Tests/Script tests/Object/KanEd-Test02.lsl
Normal file
40
Script Tests/Script tests/Object/KanEd-Test02.lsl
Normal file
@@ -0,0 +1,40 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
integer counter;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar! Touch to change color and size.");
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{ // do these instructions when the object is touched.
|
||||
counter = counter + 1;
|
||||
|
||||
// choose three random RGB color components between 0. and 1.0.
|
||||
float redness = llFrand( 1.0 );
|
||||
float greenness = llFrand( 1.0 );
|
||||
float blueness = llFrand( 1.0 );
|
||||
|
||||
// combine color components into a vector and use that vector
|
||||
// to set object color.
|
||||
vector prim_color = < redness, greenness, blueness >;
|
||||
llSetColor( prim_color, ALL_SIDES ); // set object color to new color.
|
||||
|
||||
// choose a random number between 0. and 10. for use as a scale factor.
|
||||
float new_scale = llFrand(10.0) + 1.0;
|
||||
llSetScale(< new_scale, new_scale, new_scale > ); // set object scale.
|
||||
llSay( 0, "Touched by angel number " + (string)counter);
|
||||
}
|
||||
}
|
||||
|
||||
58
Script Tests/Script tests/Object/KanEd-Test03.lsl
Normal file
58
Script Tests/Script tests/Object/KanEd-Test03.lsl
Normal file
@@ -0,0 +1,58 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
integer counter;
|
||||
integer second;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar! Touch to change color and size.");
|
||||
counter = 0;
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
counter = counter + 1;
|
||||
|
||||
llSay( 0, "Touched by angel number " + (string)counter);
|
||||
|
||||
llSetTimerEvent( 2 ); // create a "timer event" every 2 seconds.
|
||||
}
|
||||
|
||||
timer() // do these instructions every time the timer event occurs.
|
||||
{
|
||||
second++;
|
||||
|
||||
// choose three random RGB color components between 0. and 1.0.
|
||||
float red = llFrand( 1.0 );
|
||||
float green = llFrand( 1.0 );
|
||||
float blue = llFrand( 1.0 );
|
||||
|
||||
// combine color components into a vector and use that vector
|
||||
// to set object color.
|
||||
vector prim_color = < 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.
|
||||
float new_scale = llFrand( 10.0 );
|
||||
llSetScale(< new_scale, new_scale, new_scale > ); // set object scale.
|
||||
|
||||
if ( second > 19 ) // then time to wrap this up.
|
||||
{
|
||||
// turn object black, print "resting" message, and reset object....
|
||||
llSetColor( < 0, 0, 0 >, ALL_SIDES );
|
||||
|
||||
llSay( 0, "Object now resting and resetting script." );
|
||||
llResetScript(); // return object to ready state.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
60
Script Tests/Script tests/Object/KanEd-Test04.lsl
Normal file
60
Script Tests/Script tests/Object/KanEd-Test04.lsl
Normal file
@@ -0,0 +1,60 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
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.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
39
Script Tests/Script tests/Object/KanEd-Test05.lsl
Normal file
39
Script Tests/Script tests/Object/KanEd-Test05.lsl
Normal file
@@ -0,0 +1,39 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar!");
|
||||
vector startPoint = llGetPos();
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llSay( 0, "Touched." );
|
||||
|
||||
// Define a rotation of 10 degrees around the Y-axis.
|
||||
rotation Y_10 = llEuler2Rot( < 0, 10 * DEG_TO_RAD, 0 > );
|
||||
|
||||
// now rotate the object 10 degrees in the X-Z plane during
|
||||
// each loop iteration. note that each call to llSetRot
|
||||
// causes a .2 second delay.
|
||||
integer i;
|
||||
for( i = 1; i < 100; i++ )
|
||||
{
|
||||
// rotate object in the X-Z plane around its own Y-axis.
|
||||
rotation newRotation = llGetRot() * Y_10;
|
||||
|
||||
llSetRot( newRotation );
|
||||
}
|
||||
llSay( 0, "Rotation stopped" );
|
||||
}
|
||||
}
|
||||
|
||||
17
Script Tests/Script tests/Object/KanEd-Test06.lsl
Normal file
17
Script Tests/Script tests/Object/KanEd-Test06.lsl
Normal file
@@ -0,0 +1,17 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llTargetOmega( < 0, 1, 1 >, .2 * PI, 1.0 );
|
||||
}
|
||||
}
|
||||
|
||||
47
Script Tests/Script tests/Object/KanEd-Test07.lsl
Normal file
47
Script Tests/Script tests/Object/KanEd-Test07.lsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
vector rotationCenter;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar!");
|
||||
vector startPoint = llGetPos();
|
||||
rotationCenter = startPoint + < 3, 3, 3 >;
|
||||
// distance to the point of rotation should probably be a
|
||||
// function of the max dimension of the object.
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llSay( 0, "Touched." );
|
||||
|
||||
// Define a "rotation" of 10 degrees around the z-axis.
|
||||
rotation Z_15 = llEuler2Rot( < 0, 0, 15 * DEG_TO_RAD > );
|
||||
|
||||
integer i;
|
||||
for( i = 1; i < 100; i++ ) // limit simulation time in case of
|
||||
{ // unexpected behavior.
|
||||
vector currentPosition = llGetPos();
|
||||
|
||||
vector currentOffset = currentPosition - rotationCenter;
|
||||
|
||||
// rotate the offset vector in the X-Y plane around the
|
||||
// distant point of rotation.
|
||||
vector rotatedOffset = currentOffset * Z_15;
|
||||
vector newPosition = rotationCenter + rotatedOffset;
|
||||
|
||||
llSetPos( newPosition );
|
||||
}
|
||||
llSay( 0, "Orbiting stopped" );
|
||||
}
|
||||
}
|
||||
|
||||
32
Script Tests/Script tests/Object/KanEd-Test08.lsl
Normal file
32
Script Tests/Script tests/Object/KanEd-Test08.lsl
Normal file
@@ -0,0 +1,32 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar! Touch to launch me straight up.");
|
||||
llSetStatus( 1, TRUE ); // turn on physics.
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
vector start_color = llGetColor( ALL_SIDES ); // save current color.
|
||||
llSetColor( < 1.0, 0.0, 0.0 > , ALL_SIDES ); // set color to red.
|
||||
|
||||
float objMass = llGetMass();
|
||||
float Z_force = 20.0 * objMass;
|
||||
|
||||
llApplyImpulse( < 0.0, 0.0, Z_force >, FALSE );
|
||||
|
||||
llSay( 0, "Impulse of " + (string)Z_force + " applied." );
|
||||
llSetColor( start_color , ALL_SIDES ); // set color to green.
|
||||
}
|
||||
}
|
||||
|
||||
80
Script Tests/Script tests/Object/KanEd-Test09.lsl
Normal file
80
Script Tests/Script tests/Object/KanEd-Test09.lsl
Normal file
@@ -0,0 +1,80 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
vector startPos;
|
||||
vector curPos;
|
||||
vector curForce;
|
||||
integer second;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar! Touch to launch me straight up.");
|
||||
llSetStatus( 1, TRUE );
|
||||
startPos = < 0, 0, 0 >;
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
startPos = llGetPos();
|
||||
curPos = startPos;
|
||||
curForce = < 0, 0, 0 >;
|
||||
second = 0;
|
||||
|
||||
llSetColor( < 1.0, 0.0, 0.0 > , ALL_SIDES ); // set color to red.
|
||||
|
||||
float objMass = llGetMass();
|
||||
float Z_force = 10.2 * objMass;
|
||||
|
||||
llSetForce( < 0.0, 0.0, Z_force >, FALSE );
|
||||
|
||||
llSay( 0, "Force of " + (string)Z_force + " being applied." );
|
||||
llSetTimerEvent(1);
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
second++;
|
||||
curPos = llGetPos();
|
||||
float curDisplacement = llVecMag( curPos - startPos );
|
||||
|
||||
if( ( curDisplacement > 30. ) && // then object is too far away, and
|
||||
( llGetForce() != < 0.0, 0.0, 0.0 > ) ) // force not already zero,
|
||||
{ // then let gravity take over, and change color to green.
|
||||
llSetForce( < 0.0, 0.0, 0.0 >, FALSE );
|
||||
llSetColor( < 0, 1.0, 0 >, ALL_SIDES );
|
||||
llSay( 0, "Force removed; object in free flight." );
|
||||
}
|
||||
|
||||
if ( second > 19 ) // then time to wrap this up.
|
||||
{
|
||||
// turn object blue and zero force to be safe....
|
||||
llSetColor( < 0, 0, 1.0 >, ALL_SIDES ); // change color to blue.
|
||||
llSetForce( < 0, 0, 0 >, FALSE );
|
||||
|
||||
// ...move object back to starting position...
|
||||
// ...after saving current status of Physics attribute.
|
||||
integer savedStatus = llGetStatus( 1 );
|
||||
llSetStatus( 1, FALSE ); // turn physics off.
|
||||
while ( llVecDist( llGetPos(), startPos ) > 0.001)
|
||||
{
|
||||
llSetPos( startPos );
|
||||
}
|
||||
llSetStatus( 1, savedStatus ); // restore Physics status.
|
||||
|
||||
//...and then turn color to black and Reset the script.
|
||||
llSetColor( < 1, 1, 1 >, ALL_SIDES );
|
||||
llSetTimerEvent( 0 ); // turn off timer events.
|
||||
llSay( 0, "Done and resetting script." );
|
||||
llResetScript(); // return object to ready state.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
66
Script Tests/Script tests/Object/KanEd-Test10.lsl
Normal file
66
Script Tests/Script tests/Object/KanEd-Test10.lsl
Normal file
@@ -0,0 +1,66 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
vector startPosition;
|
||||
float groundLevel;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen( 0, "", llGetOwner(), "");
|
||||
|
||||
startPosition = llGetPos();
|
||||
groundLevel = llGround( startPosition );
|
||||
|
||||
llSay( 0, "Control this object with chat commands like:" );
|
||||
llSay( 0, "'up' or 'down' followed by a distance." );
|
||||
}
|
||||
|
||||
listen( integer channel, string name, key id, string message )
|
||||
{
|
||||
// separate the input into blank-delmited tokens.
|
||||
list parsed = llParseString2List( message, [ " " ], [] );
|
||||
|
||||
// get the first part--the "command".
|
||||
string command = llList2String( parsed, 0 );
|
||||
|
||||
// get the second part--the "distance".
|
||||
string distance_string = llList2String( parsed, 1 );
|
||||
float distance = ( float )distance_string;
|
||||
|
||||
vector position = llGetPos();
|
||||
|
||||
if( command == "up" )
|
||||
{
|
||||
if( ( position.z + distance ) < (startPosition.z + 10.0 ) )
|
||||
{
|
||||
llSetPos( llGetPos() + < 0, 0, distance > ); // move up
|
||||
llSetText( "Went up " + (string)distance, < 1, 0, 0 >, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
llSetText( "Can't go so high.", < 1, 0, 0 >, 1 );
|
||||
}
|
||||
}
|
||||
else if( command == "down" )
|
||||
{
|
||||
if( ( position.z - distance ) > groundLevel )
|
||||
{
|
||||
llSetPos( llGetPos() + < 0, 0, -distance > ); // move down
|
||||
llSetText( "Went down " + (string)distance, < 1, 0, 0 >, 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
llSetText( "Can't go so low.", < 1, 0, 0 >, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
61
Script Tests/Script tests/Object/KanEd-Test11.lsl
Normal file
61
Script Tests/Script tests/Object/KanEd-Test11.lsl
Normal file
@@ -0,0 +1,61 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
integer dialog_channel= 427; // set a dialog channel
|
||||
list menu = [ "Go up", "Go down" ];
|
||||
vector startPosition;
|
||||
float groundLevel;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
// arrange to listen for dialog answers (from multiple users)
|
||||
llListen( dialog_channel, "", NULL_KEY, "");
|
||||
|
||||
startPosition = llGetPos();
|
||||
groundLevel = llGround( startPosition );
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llDialog( llDetectedKey( 0 ), "What do you want to do?", menu,
|
||||
dialog_channel );
|
||||
}
|
||||
|
||||
listen(integer channel, string name, key id, string choice )
|
||||
{
|
||||
vector position = llGetPos();
|
||||
|
||||
// if a valid choice was made, implement that choice if possible.
|
||||
// (llListFindList returns -1 if choice is not in the menu list.)
|
||||
if ( llListFindList( menu, [ choice ]) != -1 )
|
||||
{
|
||||
if ( choice == "Go up" )
|
||||
{
|
||||
if( position.z < ( startPosition.z + 10.0 ) )
|
||||
{
|
||||
llSetPos( llGetPos() + < 0, 0, 1.0 > ); // move up
|
||||
}
|
||||
}
|
||||
else if( choice == "Go down" )
|
||||
{
|
||||
if( position.z > ( groundLevel + 1.0 ) )
|
||||
{
|
||||
llSetPos( llGetPos() + < 0, 0, -1.0 > ); // move down
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
llSay( 0, "Invalid choice: " + choice );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
55
Script Tests/Script tests/Object/KanEd-Test12.lsl
Normal file
55
Script Tests/Script tests/Object/KanEd-Test12.lsl
Normal file
@@ -0,0 +1,55 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
vector startPosition;
|
||||
float groundLevel;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
// get permission to take over the avatar's control inputs.
|
||||
llRequestPermissions( llGetOwner(), PERMISSION_TAKE_CONTROLS );
|
||||
|
||||
startPosition = llGetPos();
|
||||
groundLevel = llGround( startPosition );
|
||||
}
|
||||
|
||||
run_time_permissions( integer perm ) // event for processing
|
||||
// permission dialog.
|
||||
{
|
||||
if ( perm & PERMISSION_TAKE_CONTROLS ) // permission has been given.
|
||||
{
|
||||
// go ahead and take over the forward and backward controls.
|
||||
llTakeControls( CONTROL_FWD | CONTROL_BACK, TRUE, FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
25
Script Tests/Script tests/Object/KanEd-Test13.lsl
Normal file
25
Script Tests/Script tests/Object/KanEd-Test13.lsl
Normal file
@@ -0,0 +1,25 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar!");
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llSay( 0, "Touched.");
|
||||
|
||||
llRezObject("Object1", llGetPos() + < 0, 0, 2 >, ZERO_VECTOR,
|
||||
ZERO_ROTATION, 42);
|
||||
}
|
||||
}
|
||||
|
||||
79
Script Tests/Script tests/Object/KanEd-Test14.lsl
Normal file
79
Script Tests/Script tests/Object/KanEd-Test14.lsl
Normal file
@@ -0,0 +1,79 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
integer createdObjectCounter;
|
||||
integer linkedObjectCounter;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay( 0, "Hello, Avatar!");
|
||||
linkedObjectCounter = 0; // zero the linked object counter.
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
if( createdObjectCounter <= 0 ) // nothing has yet been linked,
|
||||
{ // begin object creation sequence...
|
||||
// ask for permissions now, since it will be too late later.
|
||||
llRequestPermissions( llGetOwner(), PERMISSION_CHANGE_LINKS );
|
||||
}
|
||||
else // just do whatever should be done upon touch without
|
||||
{ // creating new objects to link.
|
||||
// insert commands here to respond to a touch.
|
||||
}
|
||||
}
|
||||
|
||||
run_time_permissions( integer permissions_granted )
|
||||
{
|
||||
if( permissions_granted == PERMISSION_CHANGE_LINKS )
|
||||
{ // create 2 objects.
|
||||
llRezObject("Object1", llGetPos() + < 1, 0, 2 >,
|
||||
ZERO_VECTOR, ZERO_ROTATION, 42);
|
||||
createdObjectCounter = createdObjectCounter + 1;
|
||||
|
||||
llRezObject("Object1", llGetPos() + < -1, 0, 2 >,
|
||||
ZERO_VECTOR, ZERO_ROTATION, 42);
|
||||
createdObjectCounter = createdObjectCounter + 1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
llOwnerSay( "Didn't get permission to change links." );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
object_rez( key child_id )
|
||||
{
|
||||
llOwnerSay( "rez happened and produced object with key " +
|
||||
(string)child_id );
|
||||
|
||||
// link as parent to the just created child.
|
||||
llCreateLink( child_id, TRUE );
|
||||
|
||||
// if all child objects have been created then the script can
|
||||
// continue to work as a linked set of objects.
|
||||
linkedObjectCounter++;
|
||||
if( linkedObjectCounter >= 2 )
|
||||
{
|
||||
// Change all child objects in the set to red (including parent).
|
||||
llSetLinkColor( LINK_ALL_CHILDREN, < 1, 0, 0 >, ALL_SIDES );
|
||||
|
||||
// Make child object "2" half-tranparent.
|
||||
llSetLinkAlpha( 2, .5, ALL_SIDES );
|
||||
|
||||
// Insert commands here to manage subsequent activity of the
|
||||
// linkset, like this command to rotate the result:
|
||||
// llTargetOmega( < 0, 1, 1 >, .2 * PI, 1.0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
19
Script Tests/Script tests/Object/KanEd-Test15.lsl
Normal file
19
Script Tests/Script tests/Object/KanEd-Test15.lsl
Normal file
@@ -0,0 +1,19 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSetStatus(STATUS_PHANTOM,TRUE);
|
||||
llSetTexture("lit_texture", ALL_SIDES);
|
||||
llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 0, 15.0);
|
||||
}
|
||||
}
|
||||
|
||||
75
Script Tests/Script tests/Object/KanEd-Test16.lsl
Normal file
75
Script Tests/Script tests/Object/KanEd-Test16.lsl
Normal file
@@ -0,0 +1,75 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
// This is a script designed to orbit its owner.
|
||||
vector startPos;
|
||||
vector curPos;
|
||||
|
||||
vector offset; // offset from Agent
|
||||
integer iteration;
|
||||
float rotationRate; // degrees of rotation per iteration
|
||||
float sensorInterval; // seconds between sensor scan.
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llOwnerSay( "Hello, Avatar! Touch to start orbiting." );
|
||||
llSetStatus( 1, FALSE ); // turn Physics off.
|
||||
offset = < 2, 2, 1 >;
|
||||
iteration = 0;
|
||||
rotationRate = .5;
|
||||
sensorInterval = .3;
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
startPos = llGetPos();
|
||||
curPos = startPos;
|
||||
|
||||
llSleep( .1 );
|
||||
|
||||
key id = llGetOwner();
|
||||
llSensorRepeat( "", id, AGENT, 96, PI, sensorInterval );
|
||||
}
|
||||
|
||||
sensor(integer total_number)
|
||||
{
|
||||
iteration++;
|
||||
|
||||
if( iteration > 300 )
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
if( llDetectedOwner( 0 ) == llGetOwner() )
|
||||
{ // the detected Agent is my owner.
|
||||
vector position = llDetectedPos(0); // find Owner position.
|
||||
|
||||
// calculate next object position relative both to the Owner's
|
||||
// position and the current time interval counter. That is,
|
||||
// use the iteration counter to define a rotation, multiply
|
||||
// the rotation by the constant offset to get a rotated offset
|
||||
// vector, and add that rotated offset to the current position
|
||||
// to defne the new position.
|
||||
|
||||
float degreeRotation = llRound( rotationRate * iteration ) % 360;
|
||||
rotation Rotation =
|
||||
llEuler2Rot( < 0, 0, degreeRotation * DEG_TO_RAD > );
|
||||
vector rotatedOffset = offset * Rotation;
|
||||
position += rotatedOffset;
|
||||
|
||||
// change the location of the object and save the current (rotated)
|
||||
// offset for use during the next iteration.
|
||||
llSetPos( position );
|
||||
offset = rotatedOffset;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
Script Tests/Script tests/Object/llAbs.lsl
Normal file
16
Script Tests/Script tests/Object/llAbs.lsl
Normal file
@@ -0,0 +1,16 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llOwnerSay("The absolute value of -4 is: "+(string)llAbs(-4) );
|
||||
}
|
||||
}
|
||||
17
Script Tests/Script tests/Object/llAcos.lsl
Normal file
17
Script Tests/Script tests/Object/llAcos.lsl
Normal file
@@ -0,0 +1,17 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
float r = llFrand(2) - 1.0;
|
||||
llOwnerSay("The arccosine of " + (string)r + " is " + llAcos(r));
|
||||
}
|
||||
}
|
||||
93
Script Tests/Script tests/Object/llAddToLandBanList.lsl
Normal file
93
Script Tests/Script tests/Object/llAddToLandBanList.lsl
Normal file
@@ -0,0 +1,93 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
//Commands are:
|
||||
///5 ban:full_avatar_name
|
||||
///5 tempban:full_avatar_name
|
||||
///5 unban:full_avatar_name
|
||||
///5 pass:full_avatar_name
|
||||
///5 unpass:full_avatar_name
|
||||
///5 clearban
|
||||
///5 clearpass
|
||||
|
||||
string command;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(5, "", llGetOwner(), "");
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
listen(integer chan, string name, key id, string message)
|
||||
{
|
||||
if (command != "")
|
||||
{
|
||||
llOwnerSay("Sorry, still processing last command, try again in a second.");
|
||||
}
|
||||
|
||||
list args = llParseString2List(message,[":"],[]);
|
||||
command = llToLower(llList2String(args,0));
|
||||
|
||||
if (command == "clearbans")
|
||||
{
|
||||
llResetLandBanList();
|
||||
}
|
||||
if (command == "clearpass")
|
||||
{
|
||||
llResetLandPassList();
|
||||
}
|
||||
else
|
||||
{
|
||||
llSensor(llList2String(args,1),NULL_KEY,AGENT,96,PI);
|
||||
}
|
||||
}
|
||||
|
||||
no_sensor()
|
||||
{
|
||||
command = "";
|
||||
}
|
||||
|
||||
sensor(integer num)
|
||||
{
|
||||
integer i;
|
||||
for (i=0; i< num; ++i)
|
||||
{
|
||||
if (command == "ban")
|
||||
{
|
||||
// Ban indefinetely
|
||||
llAddToLandBanList(llDetectedKey(i),0.0);
|
||||
}
|
||||
if (command == "tempban")
|
||||
{
|
||||
// Ban for 1 hour.
|
||||
llAddToLandBanList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unban")
|
||||
{
|
||||
llRemoveFromLandBanList(llDetectedKey(i));
|
||||
}
|
||||
if (command == "pass")
|
||||
{
|
||||
// Add to land pass list for 1 hour
|
||||
llAddToLandPassList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unpass")
|
||||
{
|
||||
llRemoveFromLandPassList(llDetectedKey(i));
|
||||
}
|
||||
}
|
||||
command = "";
|
||||
}
|
||||
}
|
||||
93
Script Tests/Script tests/Object/llAddToLandPassList.lsl
Normal file
93
Script Tests/Script tests/Object/llAddToLandPassList.lsl
Normal file
@@ -0,0 +1,93 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
//Commands are:
|
||||
///5 ban:full_avatar_name
|
||||
///5 tempban:full_avatar_name
|
||||
///5 unban:full_avatar_name
|
||||
///5 pass:full_avatar_name
|
||||
///5 unpass:full_avatar_name
|
||||
///5 clearban
|
||||
///5 clearpass
|
||||
|
||||
string command;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(5, "", llGetOwner(), "");
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
listen(integer chan, string name, key id, string message)
|
||||
{
|
||||
if (command != "")
|
||||
{
|
||||
llOwnerSay("Sorry, still processing last command, try again in a second.");
|
||||
}
|
||||
|
||||
list args = llParseString2List(message,[":"],[]);
|
||||
command = llToLower(llList2String(args,0));
|
||||
|
||||
if (command == "clearbans")
|
||||
{
|
||||
llResetLandBanList();
|
||||
}
|
||||
if (command == "clearpass")
|
||||
{
|
||||
llResetLandPassList();
|
||||
}
|
||||
else
|
||||
{
|
||||
llSensor(llList2String(args,1),NULL_KEY,AGENT,96,PI);
|
||||
}
|
||||
}
|
||||
|
||||
no_sensor()
|
||||
{
|
||||
command = "";
|
||||
}
|
||||
|
||||
sensor(integer num)
|
||||
{
|
||||
integer i;
|
||||
for (i=0; i< num; ++i)
|
||||
{
|
||||
if (command == "ban")
|
||||
{
|
||||
// Ban indefinetely
|
||||
llAddToLandBanList(llDetectedKey(i),0.0);
|
||||
}
|
||||
if (command == "tempban")
|
||||
{
|
||||
// Ban for 1 hour.
|
||||
llAddToLandBanList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unban")
|
||||
{
|
||||
llRemoveFromLandBanList(llDetectedKey(i));
|
||||
}
|
||||
if (command == "pass")
|
||||
{
|
||||
// Add to land pass list for 1 hour
|
||||
llAddToLandPassList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unpass")
|
||||
{
|
||||
llRemoveFromLandPassList(llDetectedKey(i));
|
||||
}
|
||||
}
|
||||
command = "";
|
||||
}
|
||||
}
|
||||
22
Script Tests/Script tests/Object/llAdjustSoundVolume.lsl
Normal file
22
Script Tests/Script tests/Object/llAdjustSoundVolume.lsl
Normal file
@@ -0,0 +1,22 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(42, "", llGetOwner(), "");
|
||||
}
|
||||
listen(integer chan, string name, key id, string msg)
|
||||
{
|
||||
float value = (float)msg;
|
||||
llAdjustSoundVolume(value);
|
||||
llOwnerSay("Volume set to: " + (string)value + " of 1.0");
|
||||
}
|
||||
}
|
||||
24
Script Tests/Script tests/Object/llAllowInventoryDrop.lsl
Normal file
24
Script Tests/Script tests/Object/llAllowInventoryDrop.lsl
Normal file
@@ -0,0 +1,24 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:integer allow;
|
||||
|
||||
default
|
||||
{
|
||||
touch_start(integer num)
|
||||
{
|
||||
llAllowInventoryDrop(allow = !allow);
|
||||
llOwnerSay("llAllowInventoryDrop == "+llList2String(["FALSE","TRUE"],allow));
|
||||
}
|
||||
changed(integer change)
|
||||
{
|
||||
if (change & CHANGED_ALLOWED_DROP) //note that it's & and not &&... it's bitwise!
|
||||
{
|
||||
llOwnerSay("The inventory has changed as a result of a user without mod permissions dropping an item on the prim and it being allowed by the script.");
|
||||
}
|
||||
}
|
||||
}
|
||||
19
Script Tests/Script tests/Object/llAngleBetween.lsl
Normal file
19
Script Tests/Script tests/Object/llAngleBetween.lsl
Normal file
@@ -0,0 +1,19 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
rotation aRot = ZERO_ROTATION;
|
||||
rotation bRot = llGetRot();
|
||||
float aBetween = llAngleBetween( aRot, bRot );
|
||||
llOwnerSay((string)aBetween);
|
||||
//llGetRot() being < 0, 0, 90 > this should report 1.570796
|
||||
}
|
||||
}
|
||||
25
Script Tests/Script tests/Object/llApplyImpulse.lsl
Normal file
25
Script Tests/Script tests/Object/llApplyImpulse.lsl
Normal file
@@ -0,0 +1,25 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
//Rez an object, and drop this script in it.
|
||||
//This will launch it at the owner.
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
list p = llGetObjectDetails(llGetOwner(), [OBJECT_POS]);
|
||||
if(p != [])
|
||||
{
|
||||
llSetStatus(STATUS_PHYSICS, TRUE);
|
||||
vector pos = llList2Vector(p, 0);
|
||||
vector direction = llVecNorm(pos - llGetPos());
|
||||
llApplyImpulse(direction * 100, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Script Tests/Script tests/Object/llAsin.lsl
Normal file
18
Script Tests/Script tests/Object/llAsin.lsl
Normal file
@@ -0,0 +1,18 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
// Touch the object with this script in it to see the arcsine of random numbers!
|
||||
default
|
||||
{
|
||||
touch_start(integer num)
|
||||
{
|
||||
float r = llFrand(2) - 1.0;
|
||||
llOwnerSay("The arcsine of " + (string)r + " is " + llAsin(r));
|
||||
}
|
||||
}
|
||||
20
Script Tests/Script tests/Object/llAtan2.lsl
Normal file
20
Script Tests/Script tests/Object/llAtan2.lsl
Normal file
@@ -0,0 +1,20 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
float num1 = llFrand(100.0);
|
||||
float num2 = llFrand(100.0);
|
||||
llOwnerSay("y = " + (string)num1);
|
||||
llOwnerSay("x = " + (string)num2);
|
||||
llOwnerSay("The tangent of y divided by x is " + (string)llAtan2(num1, num2));
|
||||
}
|
||||
}
|
||||
29
Script Tests/Script tests/Object/llAvatarOnSitTarget.lsl
Normal file
29
Script Tests/Script tests/Object/llAvatarOnSitTarget.lsl
Normal file
@@ -0,0 +1,29 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
// set sit target, otherwise this will not work
|
||||
llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
|
||||
}
|
||||
changed(integer change)
|
||||
{
|
||||
if (change & CHANGED_LINK)
|
||||
{
|
||||
key av = llAvatarOnSitTarget();
|
||||
//evaluated as true if not NULL_KEY or invalid
|
||||
if (av)
|
||||
{
|
||||
llSay(0, "Hello " + llKey2Name(av) + ", thank you for sitting down");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Script Tests/Script tests/Object/llBase64ToString.lsl
Normal file
17
Script Tests/Script tests/Object/llBase64ToString.lsl
Normal file
@@ -0,0 +1,17 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
string test = llBase64ToString("U2VjcmV0Ok9wZW4=");
|
||||
llOwnerSay(test);
|
||||
}
|
||||
}
|
||||
93
Script Tests/Script tests/Object/llRemoveFromLandBanList.lsl
Normal file
93
Script Tests/Script tests/Object/llRemoveFromLandBanList.lsl
Normal file
@@ -0,0 +1,93 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
//Commands are:
|
||||
///5 ban:full_avatar_name
|
||||
///5 tempban:full_avatar_name
|
||||
///5 unban:full_avatar_name
|
||||
///5 pass:full_avatar_name
|
||||
///5 unpass:full_avatar_name
|
||||
///5 clearban
|
||||
///5 clearpass
|
||||
|
||||
string command;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(5, "", llGetOwner(), "");
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
listen(integer chan, string name, key id, string message)
|
||||
{
|
||||
if (command != "")
|
||||
{
|
||||
llOwnerSay("Sorry, still processing last command, try again in a second.");
|
||||
}
|
||||
|
||||
list args = llParseString2List(message,[":"],[]);
|
||||
command = llToLower(llList2String(args,0));
|
||||
|
||||
if (command == "clearbans")
|
||||
{
|
||||
llResetLandBanList();
|
||||
}
|
||||
if (command == "clearpass")
|
||||
{
|
||||
llResetLandPassList();
|
||||
}
|
||||
else
|
||||
{
|
||||
llSensor(llList2String(args,1),NULL_KEY,AGENT,96,PI);
|
||||
}
|
||||
}
|
||||
|
||||
no_sensor()
|
||||
{
|
||||
command = "";
|
||||
}
|
||||
|
||||
sensor(integer num)
|
||||
{
|
||||
integer i;
|
||||
for (i=0; i< num; ++i)
|
||||
{
|
||||
if (command == "ban")
|
||||
{
|
||||
// Ban indefinetely
|
||||
llAddToLandBanList(llDetectedKey(i),0.0);
|
||||
}
|
||||
if (command == "tempban")
|
||||
{
|
||||
// Ban for 1 hour.
|
||||
llAddToLandBanList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unban")
|
||||
{
|
||||
llRemoveFromLandBanList(llDetectedKey(i));
|
||||
}
|
||||
if (command == "pass")
|
||||
{
|
||||
// Add to land pass list for 1 hour
|
||||
llAddToLandPassList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unpass")
|
||||
{
|
||||
llRemoveFromLandPassList(llDetectedKey(i));
|
||||
}
|
||||
}
|
||||
command = "";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
//Commands are:
|
||||
///5 ban:full_avatar_name
|
||||
///5 tempban:full_avatar_name
|
||||
///5 unban:full_avatar_name
|
||||
///5 pass:full_avatar_name
|
||||
///5 unpass:full_avatar_name
|
||||
///5 clearban
|
||||
///5 clearpass
|
||||
|
||||
string command;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(5, "", llGetOwner(), "");
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
listen(integer chan, string name, key id, string message)
|
||||
{
|
||||
if (command != "")
|
||||
{
|
||||
llOwnerSay("Sorry, still processing last command, try again in a second.");
|
||||
}
|
||||
|
||||
list args = llParseString2List(message,[":"],[]);
|
||||
command = llToLower(llList2String(args,0));
|
||||
|
||||
if (command == "clearbans")
|
||||
{
|
||||
llResetLandBanList();
|
||||
}
|
||||
if (command == "clearpass")
|
||||
{
|
||||
llResetLandPassList();
|
||||
}
|
||||
else
|
||||
{
|
||||
llSensor(llList2String(args,1),NULL_KEY,AGENT,96,PI);
|
||||
}
|
||||
}
|
||||
|
||||
no_sensor()
|
||||
{
|
||||
command = "";
|
||||
}
|
||||
|
||||
sensor(integer num)
|
||||
{
|
||||
integer i;
|
||||
for (i=0; i< num; ++i)
|
||||
{
|
||||
if (command == "ban")
|
||||
{
|
||||
// Ban indefinetely
|
||||
llAddToLandBanList(llDetectedKey(i),0.0);
|
||||
}
|
||||
if (command == "tempban")
|
||||
{
|
||||
// Ban for 1 hour.
|
||||
llAddToLandBanList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unban")
|
||||
{
|
||||
llRemoveFromLandBanList(llDetectedKey(i));
|
||||
}
|
||||
if (command == "pass")
|
||||
{
|
||||
// Add to land pass list for 1 hour
|
||||
llAddToLandPassList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unpass")
|
||||
{
|
||||
llRemoveFromLandPassList(llDetectedKey(i));
|
||||
}
|
||||
}
|
||||
command = "";
|
||||
}
|
||||
}
|
||||
93
Script Tests/Script tests/Object/llResetLandBanList.lsl
Normal file
93
Script Tests/Script tests/Object/llResetLandBanList.lsl
Normal file
@@ -0,0 +1,93 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
//Commands are:
|
||||
///5 ban:full_avatar_name
|
||||
///5 tempban:full_avatar_name
|
||||
///5 unban:full_avatar_name
|
||||
///5 pass:full_avatar_name
|
||||
///5 unpass:full_avatar_name
|
||||
///5 clearban
|
||||
///5 clearpass
|
||||
|
||||
string command;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(5, "", llGetOwner(), "");
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
listen(integer chan, string name, key id, string message)
|
||||
{
|
||||
if (command != "")
|
||||
{
|
||||
llOwnerSay("Sorry, still processing last command, try again in a second.");
|
||||
}
|
||||
|
||||
list args = llParseString2List(message,[":"],[]);
|
||||
command = llToLower(llList2String(args,0));
|
||||
|
||||
if (command == "clearbans")
|
||||
{
|
||||
llResetLandBanList();
|
||||
}
|
||||
if (command == "clearpass")
|
||||
{
|
||||
llResetLandPassList();
|
||||
}
|
||||
else
|
||||
{
|
||||
llSensor(llList2String(args,1),NULL_KEY,AGENT,96,PI);
|
||||
}
|
||||
}
|
||||
|
||||
no_sensor()
|
||||
{
|
||||
command = "";
|
||||
}
|
||||
|
||||
sensor(integer num)
|
||||
{
|
||||
integer i;
|
||||
for (i=0; i< num; ++i)
|
||||
{
|
||||
if (command == "ban")
|
||||
{
|
||||
// Ban indefinetely
|
||||
llAddToLandBanList(llDetectedKey(i),0.0);
|
||||
}
|
||||
if (command == "tempban")
|
||||
{
|
||||
// Ban for 1 hour.
|
||||
llAddToLandBanList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unban")
|
||||
{
|
||||
llRemoveFromLandBanList(llDetectedKey(i));
|
||||
}
|
||||
if (command == "pass")
|
||||
{
|
||||
// Add to land pass list for 1 hour
|
||||
llAddToLandPassList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unpass")
|
||||
{
|
||||
llRemoveFromLandPassList(llDetectedKey(i));
|
||||
}
|
||||
}
|
||||
command = "";
|
||||
}
|
||||
}
|
||||
93
Script Tests/Script tests/Object/llResetLandPassList.lsl
Normal file
93
Script Tests/Script tests/Object/llResetLandPassList.lsl
Normal file
@@ -0,0 +1,93 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
//Commands are:
|
||||
///5 ban:full_avatar_name
|
||||
///5 tempban:full_avatar_name
|
||||
///5 unban:full_avatar_name
|
||||
///5 pass:full_avatar_name
|
||||
///5 unpass:full_avatar_name
|
||||
///5 clearban
|
||||
///5 clearpass
|
||||
|
||||
string command;
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llListen(5, "", llGetOwner(), "");
|
||||
}
|
||||
|
||||
on_rez(integer param)
|
||||
{
|
||||
llResetScript();
|
||||
}
|
||||
|
||||
listen(integer chan, string name, key id, string message)
|
||||
{
|
||||
if (command != "")
|
||||
{
|
||||
llOwnerSay("Sorry, still processing last command, try again in a second.");
|
||||
}
|
||||
|
||||
list args = llParseString2List(message,[":"],[]);
|
||||
command = llToLower(llList2String(args,0));
|
||||
|
||||
if (command == "clearbans")
|
||||
{
|
||||
llResetLandBanList();
|
||||
}
|
||||
if (command == "clearpass")
|
||||
{
|
||||
llResetLandPassList();
|
||||
}
|
||||
else
|
||||
{
|
||||
llSensor(llList2String(args,1),NULL_KEY,AGENT,96,PI);
|
||||
}
|
||||
}
|
||||
|
||||
no_sensor()
|
||||
{
|
||||
command = "";
|
||||
}
|
||||
|
||||
sensor(integer num)
|
||||
{
|
||||
integer i;
|
||||
for (i=0; i< num; ++i)
|
||||
{
|
||||
if (command == "ban")
|
||||
{
|
||||
// Ban indefinetely
|
||||
llAddToLandBanList(llDetectedKey(i),0.0);
|
||||
}
|
||||
if (command == "tempban")
|
||||
{
|
||||
// Ban for 1 hour.
|
||||
llAddToLandBanList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unban")
|
||||
{
|
||||
llRemoveFromLandBanList(llDetectedKey(i));
|
||||
}
|
||||
if (command == "pass")
|
||||
{
|
||||
// Add to land pass list for 1 hour
|
||||
llAddToLandPassList(llDetectedKey(i),1.0);
|
||||
}
|
||||
if (command == "unpass")
|
||||
{
|
||||
llRemoveFromLandPassList(llDetectedKey(i));
|
||||
}
|
||||
}
|
||||
command = "";
|
||||
}
|
||||
}
|
||||
16
Script Tests/Script tests/Object/llSay.lsl
Normal file
16
Script Tests/Script tests/Object/llSay.lsl
Normal file
@@ -0,0 +1,16 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSay(0,"This is an incredibly useless program." );
|
||||
}
|
||||
}
|
||||
16
Script Tests/Script tests/Object/llSetParcelMusicURL.lsl
Normal file
16
Script Tests/Script tests/Object/llSetParcelMusicURL.lsl
Normal file
@@ -0,0 +1,16 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llSetParcelMusicURL("http://www.archive.org/download/Torley_Wong_-_The_Final_Selection/Torley_Wong-Lovers__Dance.mp3");
|
||||
}
|
||||
}
|
||||
22
Script Tests/Script tests/Object/llSetRot.lsl
Normal file
22
Script Tests/Script tests/Object/llSetRot.lsl
Normal file
@@ -0,0 +1,22 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
llOwnerSay("Touch me");
|
||||
}
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
rotation Y_10 = llEuler2Rot( < 0, 0, 30 * DEG_TO_RAD > );
|
||||
rotation newRotation = llGetRot() * Y_10;
|
||||
llSetRot( newRotation );
|
||||
}
|
||||
}
|
||||
57
Script Tests/Script tests/Object/osTextBoard.lsl
Normal file
57
Script Tests/Script tests/Object/osTextBoard.lsl
Normal file
@@ -0,0 +1,57 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
string title = "";
|
||||
string subtitle = "";
|
||||
string text = "";
|
||||
string add = "";
|
||||
integer channel = 0; // if this is >= 0, llSay on that channel on updates
|
||||
|
||||
push_text()
|
||||
{
|
||||
compile_text();
|
||||
draw_text();
|
||||
}
|
||||
|
||||
compile_text()
|
||||
{
|
||||
title = "Some Title";
|
||||
subtitle = "Some subtitle";
|
||||
|
||||
text = "Plenty of text for the main body.\n";
|
||||
text += "You need to manual do line breaks\n";
|
||||
text += "here. No word wrap yet.";
|
||||
|
||||
add = "Additional text at the bottom";
|
||||
}
|
||||
|
||||
draw_text()
|
||||
{
|
||||
string drawList = "MoveTo 40,80; PenColour RED; FontSize 48; Text " + title + ";";
|
||||
drawList += "MoveTo 160,160; FontSize 32; Text " + subtitle + ";";
|
||||
drawList += "PenColour BLACK; MoveTo 40,220; FontSize 24; Text " + text + ";";
|
||||
drawList += "PenColour RED; FontName Times New Roman; MoveTo 40,900; Text " + add + ";";
|
||||
osSetDynamicTextureData("", "vector", drawList, "1024", 0);
|
||||
}
|
||||
|
||||
default {
|
||||
state_entry()
|
||||
{
|
||||
push_text();
|
||||
}
|
||||
|
||||
touch_start(integer count)
|
||||
{
|
||||
push_text();
|
||||
if (channel >= 0) {
|
||||
llSay(channel, text);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
52
Script Tests/Script tests/Object/osWeatherMap.lsl
Normal file
52
Script Tests/Script tests/Object/osWeatherMap.lsl
Normal file
@@ -0,0 +1,52 @@
|
||||
// :CATEGORY:Scripting
|
||||
// :AUTHOR:Justin Clark-Casey (justincc)
|
||||
// :KEYWORDS:Opensim
|
||||
// :REV:1
|
||||
// :WORLD:Opensim
|
||||
// :DESCRIPTION:
|
||||
// One of many tests for Opensim
|
||||
// :CODE:
|
||||
|
||||
integer count = 0;
|
||||
integer refreshRate = 300;
|
||||
string URL1 = "http://icons.wunderground.com/data/640x480/2xus_rd.gif";
|
||||
string URL2 = "http://icons.wunderground.com/data/640x480/2xus_sf.gif";
|
||||
string URL3 = "http://icons.wunderground.com/data/640x480/2xus_st.gif";
|
||||
string dynamicID="";
|
||||
string contentType="image";
|
||||
|
||||
refresh_texture()
|
||||
{
|
||||
count++;
|
||||
string url = "";
|
||||
integer c = count % 3;
|
||||
|
||||
if (c == 0) {
|
||||
url = URL1;
|
||||
} else if (c == 1) {
|
||||
url = URL2;
|
||||
} else {
|
||||
url = URL3;
|
||||
}
|
||||
// refresh rate is not yet respected here, which is why we need the timer
|
||||
osSetDynamicTextureURL(dynamicID, contentType ,url , "", refreshRate );
|
||||
}
|
||||
|
||||
default
|
||||
{
|
||||
state_entry()
|
||||
{
|
||||
refresh_texture();
|
||||
llSetTimerEvent(refreshRate); // create a "timer event" every 300 seconds.
|
||||
}
|
||||
|
||||
timer()
|
||||
{
|
||||
refresh_texture();
|
||||
}
|
||||
|
||||
touch_start(integer times)
|
||||
{
|
||||
refresh_texture();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user