Join us in Outworldz at http://www.outworldz.com:9000 or follow us:

[Table of Contents]

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Scripting Script Tests  

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

the Zip file

Download all files for Script Tests
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. GrafittiBoard.lsl
Get file # 2. KanEd-Test01.lsl
Get file # 3. KanEd-Test02.lsl
Get file # 4. KanEd-Test03.lsl
Get file # 5. KanEd-Test04.lsl
Get file # 6. KanEd-Test05.lsl
Get file # 7. KanEd-Test06.lsl
Get file # 8. KanEd-Test07.lsl
Get file # 9. KanEd-Test08.lsl
Get file # 10. KanEd-Test09.lsl
Get file # 11. KanEd-Test10.lsl
Get file # 12. KanEd-Test11.lsl
Get file # 13. KanEd-Test12.lsl
Get file # 14. KanEd-Test13.lsl
Get file # 15. KanEd-Test14.lsl
Get file # 16. KanEd-Test15.lsl
Get file # 17. KanEd-Test16.lsl
Get file # 18. llAbs.lsl
Get file # 19. llAcos.lsl
Get file # 20. llAddToLandBanList.lsl
Get file # 21. llAddToLandPassList.lsl
Get file # 22. llAdjustSoundVolume.lsl
Get file # 23. llAllowInventoryDrop.lsl
Get file # 24. llAngleBetween.lsl
Get file # 25. llApplyImpulse.lsl
Get file # 26. llAsin.lsl
Get file # 27. llAtan2.lsl
Get file # 28. llAvatarOnSitTarget.lsl
Get file # 29. llBase64ToString.lsl
Get file # 30. llRemoveFromLandBanList.lsl
Get file # 31. llRemoveFromLandPassList.lsl
Get file # 32. llResetLandBanList.lsl
Get file # 33. llResetLandPassList.lsl
Get file # 34. llSay.lsl
Get file # 35. llSetParcelMusicURL.lsl
Get file # 36. llSetRot.lsl
Get file # 37. osTextBoard.lsl
Get file # 38. osWeatherMap.lsl
1 // Grafitti board 0.0.2 for OpenSim
2 // By Justin Clark-Casey (justincc)
3 // http://justincc.wordpress.com
4
5 // This script is available under the BSD License
6
7 string text = "";
8
9 integer LISTENING_CHANNEL = 43;
10
11 // XXX Only putting this here as well to get around OpenSim's int -> string casting oddness
12 string LISTENING_CHANNEL_STRING = "43";
13
14 // FIXME: Should be dynamic!
15 integer CHARS_WIDTH = 42;
16
17 // Add some additional graffiti
18 addGraffiti(string message)
19 {
20 while(llStringLength(message) > CHARS_WIDTH)
21 {
22 text += "\n\n" + llGetSubString(message, 0, CHARS_WIDTH - 1);
23 message = llDeleteSubString(message, 0, CHARS_WIDTH - 1);
24 }
25
26 text += "\n\n" + message;
27 }
28
29 // Clear the existing graffiti
30 clearGraffiti()
31 {
32 text = "";
33 }
34
35 // Actually fires the graffiti out to the dynamic texture module
36 draw()
37 {
38 //llSay(0, text);
39 string drawList = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text " + text + ";";
40
41 osSetDynamicTextureData("", "vector", drawList, "1024", 0);
42 }
43
44 default
45 {
47 {
49 "Say /" + LISTENING_CHANNEL_STRING + " <message> to add text."
50 + " Say /" + LISTENING_CHANNEL_STRING
51 + " !clear to clear board",
52 <0.0, 1.0, 0.0>, 1.0);
53
54 llListen(LISTENING_CHANNEL, "", NULL_KEY, "");
55
56 addGraffiti("justincc's graffiti board v0.0.2");
57 addGraffiti("Now with primitive word wrap!");
58 draw();
59 }
60
61 listen(integer channel, string name, key id, string message)
62 {
63 if(message == "!clear")
64 {
65 clearGraffiti();
66 }
67 else
68 {
69 addGraffiti(message);
70 }
71
72 draw();
73 }
74 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llSay( 0, "Hello, Avatar!");
7 }
8
9 touch_start(integer total_number)
10 {
11 llSay( 0, "Touched.");
12 }
13 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 integer counter;
3
4 default
5 {
7 {
8 llSay( 0, "Hello, Avatar! Touch to change color and size.");
9 counter = 0;
10 }
11
12 touch_start(integer total_number)
13 { // do these instructions when the object is touched.
14 counter = counter + 1;
15
16 // choose three random RGB color components between 0. and 1.0.
17 float redness = llFrand( 1.0 );
18 float greenness = llFrand( 1.0 );
19 float blueness = llFrand( 1.0 );
20
21 // combine color components into a vector and use that vector
22 // to set object color.
23 vector prim_color = < redness, greenness, blueness >;
24 llSetColor( prim_color, ALL_SIDES ); // set object color to new color.
25
26 // choose a random number between 0. and 10. for use as a scale factor.
27 float new_scale = llFrand(10.0) + 1.0;
28 llSetScale(< new_scale, new_scale, new_scale > ); // set object scale.
29 llSay( 0, "Touched by angel number " + (string)counter);
30 }
31 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 integer counter;
3 integer second;
4
5 default
6 {
8 {
9 llSay( 0, "Hello, Avatar! Touch to change color and size.");
10 counter = 0;
11 }
12
13 touch_start(integer total_number)
14 {
15 counter = counter + 1;
16
17 llSay( 0, "Touched by angel number " + (string)counter);
18
19 llSetTimerEvent( 2 ); // create a "timer event" every 2 seconds.
20 }
21
22 timer() // do these instructions every time the timer event occurs.
23 {
24 second++;
25
26 // choose three random RGB color components between 0. and 1.0.
27 float red = llFrand( 1.0 );
28 float green = llFrand( 1.0 );
29 float blue = llFrand( 1.0 );
30
31 // combine color components into a vector and use that vector
32 // to set object color.
33 vector prim_color = < red, green, blue >;
34 llSetColor( prim_color, ALL_SIDES ); // set object color to new color.
35
36 // a choose random number between 0. and 10 for use as a scale factor.
37 float new_scale = llFrand( 10.0 );
38 llSetScale(< new_scale, new_scale, new_scale > ); // set object scale.
39
40 if( second > 19 ) // then time to wrap this up.
41 {
42 // turn object black, print "resting" message, and reset object....
43 llSetColor( < 0, 0, 0 >, ALL_SIDES );
44
45 llSay( 0, "Object now resting and resetting script." );
46 llResetScript(); // return object to ready state.
47 }
48 }
49 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 integer counter;
3 integer second;
4 vector startPosition;
5
6 default
7 {
9 {
10 llSay( 0, "Hello, Avatar! Touch to change position.");
11 counter = 0;
12 startPosition = llGetPos();
13 }
14
15 touch_start(integer total_number)
16 {
17 counter = counter + 1;
18
19 llSay( 0, "Touched by angel number " + (string)counter);
20
21 llSetTimerEvent( 1 ); // arrange for a "timer event" every second.
22 }
23
24 timer() // do these instructions every time the timer event occurs.
25 {
26 second++;
27
28 // choose three random distances between 0. and 10.0.
29 float X_distance = llFrand( 10.0 );
30 float Y_distance = llFrand( 10.0 );
31 float Z_distance = llFrand( 10.0 );
32
33 // combine these distance components into a vector and use it
34 // to increment the starting position and reposition the object.
35 vector increment = < X_distance, Y_distance, Z_distance >;
36 vector newPosition = startPosition + increment;
37 llSetPos( newPosition ); // reposition object.
38
39 if( second > 19 ) // then time to wrap this up.
40 {
41 // move object back to starting position...
42 while( llVecDist( llGetPos(), startPosition ) > 0.001)
43 {
44 llSetPos( startPosition );
45 }
46
47 llSay( 0, "Object now resting and resetting script." );
48 llResetScript(); // return object to ready state.
49 }
50 }
51 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llSay( 0, "Hello, Avatar!");
7 vector startPoint = llGetPos();
8 }
9
10 touch_start(integer total_number)
11 {
12 llSay( 0, "Touched." );
13
14 // Define a rotation of 10 degrees around the Y-axis.
15 rotation Y_10 = llEuler2Rot( < 0, 10 * DEG_TO_RAD, 0 > );
16
17 // now rotate the object 10 degrees in the X-Z plane during
18 // each loop iteration. note that each call to llSetRot
19 // causes a .2 second delay.
20 integer i;
21 for( i = 1; i < 100; i++ )
22 {
23 // rotate object in the X-Z plane around its own Y-axis.
24 rotation newRotation = llGetRot() * Y_10;
25
26 llSetRot( newRotation );
27 }
28 llSay( 0, "Rotation stopped" );
29 }
30 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llTargetOmega( < 0, 1, 1 >, .2 * PI, 1.0 );
7 }
8 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 vector rotationCenter;
3
4 default
5 {
7 {
8 llSay( 0, "Hello, Avatar!");
9 vector startPoint = llGetPos();
10 rotationCenter = startPoint + < 3, 3, 3 >;
11 // distance to the point of rotation should probably be a
12 // function of the max dimension of the object.
13 }
14
15 touch_start(integer total_number)
16 {
17 llSay( 0, "Touched." );
18
19 // Define a "rotation" of 10 degrees around the z-axis.
20 rotation Z_15 = llEuler2Rot( < 0, 0, 15 * DEG_TO_RAD > );
21
22 integer i;
23 for( i = 1; i < 100; i++ ) // limit simulation time in case of
24 { // unexpected behavior.
25 vector currentPosition = llGetPos();
26
27 vector currentOffset = currentPosition - rotationCenter;
28
29 // rotate the offset vector in the X-Y plane around the
30 // distant point of rotation.
31 vector rotatedOffset = currentOffset * Z_15;
32 vector newPosition = rotationCenter + rotatedOffset;
33
34 llSetPos( newPosition );
35 }
36 llSay( 0, "Orbiting stopped" );
37 }
38 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llSay( 0, "Hello, Avatar! Touch to launch me straight up.");
7 llSetStatus( 1, TRUE ); // turn on physics.
8 }
9
10 touch_start(integer total_number)
11 {
12 vector start_color = llGetColor( ALL_SIDES ); // save current color.
13 llSetColor( < 1.0, 0.0, 0.0 > , ALL_SIDES ); // set color to red.
14
15 float objMass = llGetMass();
16 float Z_force = 20.0 * objMass;
17
18 llApplyImpulse( < 0.0, 0.0, Z_force >, FALSE );
19
20 llSay( 0, "Impulse of " + (string)Z_force + " applied." );
21 llSetColor( start_color , ALL_SIDES ); // set color to green.
22 }
23 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 vector startPos;
3 vector curPos;
4 vector curForce;
5 integer second;
6
7 default
8 {
10 {
11 llSay( 0, "Hello, Avatar! Touch to launch me straight up.");
12 llSetStatus( 1, TRUE );
13 startPos = < 0, 0, 0 >;
14 }
15
16 touch_start(integer total_number)
17 {
18 startPos = llGetPos();
19 curPos = startPos;
20 curForce = < 0, 0, 0 >;
21 second = 0;
22
23 llSetColor( < 1.0, 0.0, 0.0 > , ALL_SIDES ); // set color to red.
24
25 float objMass = llGetMass();
26 float Z_force = 10.2 * objMass;
27
28 llSetForce( < 0.0, 0.0, Z_force >, FALSE );
29
30 llSay( 0, "Force of " + (string)Z_force + " being applied." );
32 }
33
34 timer()
35 {
36 second++;
37 curPos = llGetPos();
38 float curDisplacement = llVecMag( curPos - startPos );
39
40 if( ( curDisplacement > 30. ) && // then object is too far away, and
41 ( llGetForce() != < 0.0, 0.0, 0.0 > ) ) // force not already zero,
42 { // then let gravity take over, and change color to green.
43 llSetForce( < 0.0, 0.0, 0.0 >, FALSE );
44 llSetColor( < 0, 1.0, 0 >, ALL_SIDES );
45 llSay( 0, "Force removed; object in free flight." );
46 }
47
48 if( second > 19 ) // then time to wrap this up.
49 {
50 // turn object blue and zero force to be safe....
51 llSetColor( < 0, 0, 1.0 >, ALL_SIDES ); // change color to blue.
52 llSetForce( < 0, 0, 0 >, FALSE );
53
54 // ...move object back to starting position...
55 // ...after saving current status of Physics attribute.
56 integer savedStatus = llGetStatus( 1 );
57 llSetStatus( 1, FALSE ); // turn physics off.
58 while( llVecDist( llGetPos(), startPos ) > 0.001)
59 {
60 llSetPos( startPos );
61 }
62 llSetStatus( 1, savedStatus ); // restore Physics status.
63
64 //...and then turn color to black and Reset the script.
65 llSetColor( < 1, 1, 1 >, ALL_SIDES );
66 llSetTimerEvent( 0 ); // turn off timer events.
67 llSay( 0, "Done and resetting script." );
68 llResetScript(); // return object to ready state.
69 }
70 }
71 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 vector startPosition;
3 float groundLevel;
4
5 default
6 {
8 {
9 llListen( 0, "", llGetOwner(), "");
10
11 startPosition = llGetPos();
12 groundLevel = llGround( startPosition );
13
14 llSay( 0, "Control this object with chat commands like:" );
15 llSay( 0, "'up' or 'down' followed by a distance." );
16 }
17
18 listen( integer channel, string name, key id, string message )
19 {
20 // separate the input into blank-delmited tokens.
21 list parsed = llParseString2List( message, [ " " ], [] );
22
23 // get the first part--the "command".
24 string command = llList2String( parsed, 0 );
25
26 // get the second part--the "distance".
27 string distance_string = llList2String( parsed, 1 );
28 float distance = ( float )distance_string;
29
30 vector position = llGetPos();
31
32 if( command == "up" )
33 {
34 if( ( position.z + distance ) < (startPosition.z + 10.0 ) )
35 {
36 llSetPos( llGetPos() + < 0, 0, distance > ); // move up
37 llSetText( "Went up " + (string)distance, < 1, 0, 0 >, 1 );
38 }
39 else
40 {
41 llSetText( "Can't go so high.", < 1, 0, 0 >, 1 );
42 }
43 }
44 else if( command == "down" )
45 {
46 if( ( position.z - distance ) > groundLevel )
47 {
48 llSetPos( llGetPos() + < 0, 0, -distance > ); // move down
49 llSetText( "Went down " + (string)distance, < 1, 0, 0 >, 1 );
50 }
51 else
52 {
53 llSetText( "Can't go so low.", < 1, 0, 0 >, 1 );
54 }
55 }
56 }
57 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 integer dialog_channel= 427; // set a dialog channel
3 list menu = [ "Go up", "Go down" ];
4 vector startPosition;
5 float groundLevel;
6
7 default
8 {
10 {
11 // arrange to listen for dialog answers (from multiple users)
12 llListen( dialog_channel, "", NULL_KEY, "");
13
14 startPosition = llGetPos();
15 groundLevel = llGround( startPosition );
16 }
17
18 touch_start(integer total_number)
19 {
20 llDialog( llDetectedKey( 0 ), "What do you want to do?", menu,
21 dialog_channel );
22 }
23
24 listen(integer channel, string name, key id, string choice )
25 {
26 vector position = llGetPos();
27
28 // if a valid choice was made, implement that choice if possible.
29 // (llListFindList returns -1 if choice is not in the menu list.)
30 if( llListFindList( menu, [ choice ]) != -1 )
31 {
32 if( choice == "Go up" )
33 {
34 if( position.z < ( startPosition.z + 10.0 ) )
35 {
36 llSetPos( llGetPos() + < 0, 0, 1.0 > ); // move up
37 }
38 }
39 else if( choice == "Go down" )
40 {
41 if( position.z > ( groundLevel + 1.0 ) )
42 {
43 llSetPos( llGetPos() + < 0, 0, -1.0 > ); // move down
44 }
45 }
46 }
47 else
48 {
49 llSay( 0, "Invalid choice: " + choice );
50 }
51 }
52 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 vector startPosition;
3 float groundLevel;
4
5 default
6 {
8 {
9 // get permission to take over the avatar's control inputs.
11
12 startPosition = llGetPos();
13 groundLevel = llGround( startPosition );
14 }
15
16 run_time_permissions( integer perm ) // event for processing
17 // permission dialog.
18 {
19 if( perm & PERMISSION_TAKE_CONTROLS ) // permission has been given.
20 {
21 // go ahead and take over the forward and backward controls.
23 }
24 }
25
26 control( key id, integer held, integer change ) // event for processing
27 // key press.
28 {
29 vector position = llGetPos();
30
31 if( change & held & CONTROL_FWD )
32 { // the "move forward" control has been activated.
33 if( position.z < (startPosition.z + 10.0) )
34 {
35 llSetPos( llGetPos() + < 0, 0, 1.0 >); // move up
36 }
37 }
38 else if( change & held & CONTROL_BACK )
39 { // the "move backward" key has been activated.
40 if( position.z > groundLevel + 1.0 )
41 {
42 llSetPos( llGetPos() + < 0, 0, -1.0 >); // move down
43 }
44 }
45 }
46 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llSay( 0, "Hello, Avatar!");
7 }
8
9 touch_start(integer total_number)
10 {
11 llSay( 0, "Touched.");
12
13 llRezObject("Object1", llGetPos() + < 0, 0, 2 >, ZERO_VECTOR,
14 ZERO_ROTATION, 42);
15 }
16 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 integer createdObjectCounter;
3 integer linkedObjectCounter;
4
5 default
6 {
8 {
9 llSay( 0, "Hello, Avatar!");
10 linkedObjectCounter = 0; // zero the linked object counter.
11 }
12
13 touch_start(integer total_number)
14 {
15 if( createdObjectCounter <= 0 ) // nothing has yet been linked,
16 { // begin object creation sequence...
17 // ask for permissions now, since it will be too late later.
19 }
20 else // just do whatever should be done upon touch without
21 { // creating new objects to link.
22 // insert commands here to respond to a touch.
23 }
24 }
25
26 run_time_permissions( integer permissions_granted )
27 {
28 if( permissions_granted == PERMISSION_CHANGE_LINKS )
29 { // create 2 objects.
30 llRezObject("Object1", llGetPos() + < 1, 0, 2 >,
32 createdObjectCounter = createdObjectCounter + 1;
33
34 llRezObject("Object1", llGetPos() + < -1, 0, 2 >,
36 createdObjectCounter = createdObjectCounter + 1;
37
38 }
39 else
40 {
41 llOwnerSay( "Didn't get permission to change links." );
42 return;
43 }
44 }
45
46 object_rez( key child_id )
47 {
48 llOwnerSay( "rez happened and produced object with key " +
49 (string)child_id );
50
51 // link as parent to the just created child.
52 llCreateLink( child_id, TRUE );
53
54 // if all child objects have been created then the script can
55 // continue to work as a linked set of objects.
56 linkedObjectCounter++;
57 if( linkedObjectCounter >= 2 )
58 {
59 // Change all child objects in the set to red (including parent).
61
62 // Make child object "2" half-tranparent.
63 llSetLinkAlpha( 2, .5, ALL_SIDES );
64
65 // Insert commands here to manage subsequent activity of the
66 // linkset, like this command to rotate the result:
67 // llTargetOmega( < 0, 1, 1 >, .2 * PI, 1.0 );
68 }
69 }
70 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llSetStatus(STATUS_PHANTOM,TRUE);
7 llSetTexture("lit_texture", ALL_SIDES);
8 llSetTextureAnim(ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 0, 15.0);
9 }
10 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 // This is a script designed to orbit its owner.
3 vector startPos;
4 vector curPos;
5
6 vector offset; // offset from Agent
7 integer iteration;
8 float rotationRate; // degrees of rotation per iteration
9 float sensorInterval; // seconds between sensor scan.
10
11 default
12 {
14 {
15 llOwnerSay( "Hello, Avatar! Touch to start orbiting." );
16 llSetStatus( 1, FALSE ); // turn Physics off.
17 offset = < 2, 2, 1 >;
18 iteration = 0;
19 rotationRate = .5;
20 sensorInterval = .3;
21 }
22
23 touch_start(integer total_number)
24 {
25 startPos = llGetPos();
26 curPos = startPos;
27
28 llSleep( .1 );
29
30 key id = llGetOwner();
31 llSensorRepeat( "", id, AGENT, 96, PI, sensorInterval );
32 }
33
34 sensor(integer total_number)
35 {
36 iteration++;
37
38 if( iteration > 300 )
39 {
41 }
42
43 if( llDetectedOwner( 0 ) == llGetOwner() )
44 { // the detected Agent is my owner.
45 vector position = llDetectedPos(0); // find Owner position.
46
47 // calculate next object position relative both to the Owner's
48 // position and the current time interval counter. That is,
49 // use the iteration counter to define a rotation, multiply
50 // the rotation by the constant offset to get a rotated offset
51 // vector, and add that rotated offset to the current position
52 // to defne the new position.
53
54 float degreeRotation = llRound( rotationRate * iteration ) % 360;
55 rotation Rotation =
56 llEuler2Rot( < 0, 0, degreeRotation * DEG_TO_RAD > );
57 vector rotatedOffset = offset * Rotation;
58 position += rotatedOffset;
59
60 // change the location of the object and save the current (rotated)
61 // offset for use during the next iteration.
62 llSetPos( position );
63 offset = rotatedOffset;
64 }
65 }
66 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llOwnerSay("The absolute value of -4 is: "+(string)llAbs(-4) );
7 }
8 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 float r = llFrand(2) - 1.0;
7 llOwnerSay("The arccosine of " + (string)r + " is " + llAcos(r));
8 }
9 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 //Commands are:
3 ///5 ban:full_avatar_name
4 ///5 tempban:full_avatar_name
5 ///5 unban:full_avatar_name
6 ///5 pass:full_avatar_name
7 ///5 unpass:full_avatar_name
8 ///5 clearban
9 ///5 clearpass
10
11 string command;
12
13 default
14 {
16 {
17 llListen(5, "", llGetOwner(), "");
18 }
19
20 on_rez(integer param)
21 {
23 }
24
25 listen(integer chan, string name, key id, string message)
26 {
27 if(command != "")
28 {
29 llOwnerSay("Sorry, still processing last command, try again in a second.");
30 }
31
32 list args = llParseString2List(message,[":"],[]);
33 command = llToLower(llList2String(args,0));
34
35 if(command == "clearbans")
36 {
38 }
39 if(command == "clearpass")
40 {
42 }
43 else
44 {
46 }
47 }
48
49 no_sensor()
50 {
51 command = "";
52 }
53
54 sensor(integer num)
55 {
56 integer i;
57 for (i=0; i< num; ++i)
58 {
59 if(command == "ban")
60 {
61 // Ban indefinetely
63 }
64 if(command == "tempban")
65 {
66 // Ban for 1 hour.
68 }
69 if(command == "unban")
70 {
72 }
73 if(command == "pass")
74 {
75 // Add to land pass list for 1 hour
77 }
78 if(command == "unpass")
79 {
81 }
82 }
83 command = "";
84 }
85 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 //Commands are:
3 ///5 ban:full_avatar_name
4 ///5 tempban:full_avatar_name
5 ///5 unban:full_avatar_name
6 ///5 pass:full_avatar_name
7 ///5 unpass:full_avatar_name
8 ///5 clearban
9 ///5 clearpass
10
11 string command;
12
13 default
14 {
16 {
17 llListen(5, "", llGetOwner(), "");
18 }
19
20 on_rez(integer param)
21 {
23 }
24
25 listen(integer chan, string name, key id, string message)
26 {
27 if(command != "")
28 {
29 llOwnerSay("Sorry, still processing last command, try again in a second.");
30 }
31
32 list args = llParseString2List(message,[":"],[]);
33 command = llToLower(llList2String(args,0));
34
35 if(command == "clearbans")
36 {
38 }
39 if(command == "clearpass")
40 {
42 }
43 else
44 {
46 }
47 }
48
49 no_sensor()
50 {
51 command = "";
52 }
53
54 sensor(integer num)
55 {
56 integer i;
57 for (i=0; i< num; ++i)
58 {
59 if(command == "ban")
60 {
61 // Ban indefinetely
63 }
64 if(command == "tempban")
65 {
66 // Ban for 1 hour.
68 }
69 if(command == "unban")
70 {
72 }
73 if(command == "pass")
74 {
75 // Add to land pass list for 1 hour
77 }
78 if(command == "unpass")
79 {
81 }
82 }
83 command = "";
84 }
85 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llListen(42, "", llGetOwner(), "");
7 }
8 listen(integer chan, string name, key id, string msg)
9 {
10 float value = (float)msg;
12 llOwnerSay("Volume set to: " + (string)value + " of 1.0");
13 }
14 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llAllowInventoryDrop(allow = !allow);
7 llOwnerSay("llAllowInventoryDrop == "+llList2String(["FALSE","TRUE"],allow));
8 }
9 changed(integer change)
10 {
11 if(change & CHANGED_ALLOWED_DROP) //note that it's & and not &&... it's bitwise!
12 {
13 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.");
14 }
15 }
16 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1 default
2 {
4 {
6 rotation bRot = llGetRot();
7 float aBetween = llAngleBetween( aRot, bRot );
8 llOwnerSay((string)aBetween);
9 //llGetRot() being < 0, 0, 90 > this should report 1.570796
10 }
11 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 //Rez an object, and drop this script in it.
3 //This will launch it at the owner.
4 default
5 {
7 {
9 if(p != [])
10 {
12 vector pos = llList2Vector(p, 0);
13 vector direction = llVecNorm(pos - llGetPos());
14 llApplyImpulse(direction * 100, 0);
15 }
16 }
17 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 // Touch the object with this script in it to see the arcsine of random numbers!
3 default
4 {
6 {
7 float r = llFrand(2) - 1.0;
8 llOwnerSay("The arcsine of " + (string)r + " is " + llAsin(r));
9 }
10 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 float num1 = llFrand(100.0);
7 float num2 = llFrand(100.0);
8 llOwnerSay("y = " + (string)num1);
9 llOwnerSay("x = " + (string)num2);
10 llOwnerSay("The tangent of y divided by x is " + (string)llAtan2(num1, num2));
11 }
12 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 // set sit target, otherwise this will not work
7 llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
8 }
9 changed(integer change)
10 {
11 if(change & CHANGED_LINK)
12 {
14 //evaluated as true if not NULL_KEY or invalid
15 if(av)
16 {
17 llSay(0, "Hello " + llKey2Name(av) + ", thank you for sitting down");
18 }
19 }
20 }
21 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 string test = llBase64ToString("U2VjcmV0Ok9wZW4=");
7 llOwnerSay(test);
8 }
9 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 //Commands are:
3 ///5 ban:full_avatar_name
4 ///5 tempban:full_avatar_name
5 ///5 unban:full_avatar_name
6 ///5 pass:full_avatar_name
7 ///5 unpass:full_avatar_name
8 ///5 clearban
9 ///5 clearpass
10
11 string command;
12
13 default
14 {
16 {
17 llListen(5, "", llGetOwner(), "");
18 }
19
20 on_rez(integer param)
21 {
23 }
24
25 listen(integer chan, string name, key id, string message)
26 {
27 if(command != "")
28 {
29 llOwnerSay("Sorry, still processing last command, try again in a second.");
30 }
31
32 list args = llParseString2List(message,[":"],[]);
33 command = llToLower(llList2String(args,0));
34
35 if(command == "clearbans")
36 {
38 }
39 if(command == "clearpass")
40 {
42 }
43 else
44 {
46 }
47 }
48
49 no_sensor()
50 {
51 command = "";
52 }
53
54 sensor(integer num)
55 {
56 integer i;
57 for (i=0; i< num; ++i)
58 {
59 if(command == "ban")
60 {
61 // Ban indefinetely
63 }
64 if(command == "tempban")
65 {
66 // Ban for 1 hour.
68 }
69 if(command == "unban")
70 {
72 }
73 if(command == "pass")
74 {
75 // Add to land pass list for 1 hour
77 }
78 if(command == "unpass")
79 {
81 }
82 }
83 command = "";
84 }
85 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 //Commands are:
3 ///5 ban:full_avatar_name
4 ///5 tempban:full_avatar_name
5 ///5 unban:full_avatar_name
6 ///5 pass:full_avatar_name
7 ///5 unpass:full_avatar_name
8 ///5 clearban
9 ///5 clearpass
10
11 string command;
12
13 default
14 {
16 {
17 llListen(5, "", llGetOwner(), "");
18 }
19
20 on_rez(integer param)
21 {
23 }
24
25 listen(integer chan, string name, key id, string message)
26 {
27 if(command != "")
28 {
29 llOwnerSay("Sorry, still processing last command, try again in a second.");
30 }
31
32 list args = llParseString2List(message,[":"],[]);
33 command = llToLower(llList2String(args,0));
34
35 if(command == "clearbans")
36 {
38 }
39 if(command == "clearpass")
40 {
42 }
43 else
44 {
46 }
47 }
48
49 no_sensor()
50 {
51 command = "";
52 }
53
54 sensor(integer num)
55 {
56 integer i;
57 for (i=0; i< num; ++i)
58 {
59 if(command == "ban")
60 {
61 // Ban indefinetely
63 }
64 if(command == "tempban")
65 {
66 // Ban for 1 hour.
68 }
69 if(command == "unban")
70 {
72 }
73 if(command == "pass")
74 {
75 // Add to land pass list for 1 hour
77 }
78 if(command == "unpass")
79 {
81 }
82 }
83 command = "";
84 }
85 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 //Commands are:
3 ///5 ban:full_avatar_name
4 ///5 tempban:full_avatar_name
5 ///5 unban:full_avatar_name
6 ///5 pass:full_avatar_name
7 ///5 unpass:full_avatar_name
8 ///5 clearban
9 ///5 clearpass
10
11 string command;
12
13 default
14 {
16 {
17 llListen(5, "", llGetOwner(), "");
18 }
19
20 on_rez(integer param)
21 {
23 }
24
25 listen(integer chan, string name, key id, string message)
26 {
27 if(command != "")
28 {
29 llOwnerSay("Sorry, still processing last command, try again in a second.");
30 }
31
32 list args = llParseString2List(message,[":"],[]);
33 command = llToLower(llList2String(args,0));
34
35 if(command == "clearbans")
36 {
38 }
39 if(command == "clearpass")
40 {
42 }
43 else
44 {
46 }
47 }
48
49 no_sensor()
50 {
51 command = "";
52 }
53
54 sensor(integer num)
55 {
56 integer i;
57 for (i=0; i< num; ++i)
58 {
59 if(command == "ban")
60 {
61 // Ban indefinetely
63 }
64 if(command == "tempban")
65 {
66 // Ban for 1 hour.
68 }
69 if(command == "unban")
70 {
72 }
73 if(command == "pass")
74 {
75 // Add to land pass list for 1 hour
77 }
78 if(command == "unpass")
79 {
81 }
82 }
83 command = "";
84 }
85 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 //Commands are:
3 ///5 ban:full_avatar_name
4 ///5 tempban:full_avatar_name
5 ///5 unban:full_avatar_name
6 ///5 pass:full_avatar_name
7 ///5 unpass:full_avatar_name
8 ///5 clearban
9 ///5 clearpass
10
11 string command;
12
13 default
14 {
16 {
17 llListen(5, "", llGetOwner(), "");
18 }
19
20 on_rez(integer param)
21 {
23 }
24
25 listen(integer chan, string name, key id, string message)
26 {
27 if(command != "")
28 {
29 llOwnerSay("Sorry, still processing last command, try again in a second.");
30 }
31
32 list args = llParseString2List(message,[":"],[]);
33 command = llToLower(llList2String(args,0));
34
35 if(command == "clearbans")
36 {
38 }
39 if(command == "clearpass")
40 {
42 }
43 else
44 {
46 }
47 }
48
49 no_sensor()
50 {
51 command = "";
52 }
53
54 sensor(integer num)
55 {
56 integer i;
57 for (i=0; i< num; ++i)
58 {
59 if(command == "ban")
60 {
61 // Ban indefinetely
63 }
64 if(command == "tempban")
65 {
66 // Ban for 1 hour.
68 }
69 if(command == "unban")
70 {
72 }
73 if(command == "pass")
74 {
75 // Add to land pass list for 1 hour
77 }
78 if(command == "unpass")
79 {
81 }
82 }
83 command = "";
84 }
85 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llSay(0,"This is an incredibly useless program." );
7 }
8 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llSetParcelMusicURL("http://www.archive.org/download/Torley_Wong_-_The_Final_Selection/Torley_Wong-Lovers__Dance.mp3");
7 }
8 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 default
3 {
5 {
6 llOwnerSay("Touch me");
7 }
8 touch_start(integer total_number)
9 {
10 rotation Y_10 = llEuler2Rot( < 0, 0, 30 * DEG_TO_RAD > );
11 rotation newRotation = llGetRot() * Y_10;
12 llSetRot( newRotation );
13 }
14 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 string title = "";
3 string subtitle = "";
4 string text = "";
5 string add = "";
6 integer channel = 0; // if this is >= 0, llSay on that channel on updates
7
8 push_text()
9 {
10 compile_text();
11 draw_text();
12 }
13
14 compile_text()
15 {
16 title = "Some Title";
17 subtitle = "Some subtitle";
18
19 text = "Plenty of text for the main body.\n";
20 text += "You need to manual do line breaks\n";
21 text += "here. No word wrap yet.";
22
23 add = "Additional text at the bottom";
24 }
25
26 draw_text()
27 {
28 string drawList = "MoveTo 40,80; PenColour RED; FontSize 48; Text " + title + ";";
29 drawList += "MoveTo 160,160; FontSize 32; Text " + subtitle + ";";
30 drawList += "PenColour BLACK; MoveTo 40,220; FontSize 24; Text " + text + ";";
31 drawList += "PenColour RED; FontName Times New Roman; MoveTo 40,900; Text " + add + ";";
32 osSetDynamicTextureData("", "vector", drawList, "1024", 0);
33 }
34
35 default {
37 {
38 push_text();
39 }
40
41 touch_start(integer count)
42 {
43 push_text();
44 if(channel >= 0) {
45 llSay(channel, text);
46 }
47 }
48
49 }

Script Tests

One of many tests for Opensim

Category: Scripting
By : Justin Clark-Casey (justincc)
Created: 2019-03-18 Edited: 2019-03-17
Worlds: OpenSim

1
2 integer count = 0;
3 integer refreshRate = 300;
4 string URL1 = "http://icons.wunderground.com/data/640x480/2xus_rd.gif";
5 string URL2 = "http://icons.wunderground.com/data/640x480/2xus_sf.gif";
6 string URL3 = "http://icons.wunderground.com/data/640x480/2xus_st.gif";
7 string dynamicID="";
8 string contentType="image";
9
10 refresh_texture()
11 {
12 count++;
13 string url = "";
14 integer c = count % 3;
15
16 if(c == 0) {
17 url = URL1;
18 } else if(c == 1) {
19 url = URL2;
20 } else {
21 url = URL3;
22 }
23 // refresh rate is not yet respected here, which is why we need the timer
24 osSetDynamicTextureURL(dynamicID, contentType ,url , "", refreshRate );
25 }
26
27 default
28 {
30 {
31 refresh_texture();
32 llSetTimerEvent(refreshRate); // create a "timer event" every 300 seconds.
33 }
34
35 timer()
36 {
37 refresh_texture();
38 }
39
40 touch_start(integer times)
41 {
42 refresh_texture();
43 }
44 }

Back to the Best Free Tools in Second Life and OpenSim.