diff options
author | Justin Clarke Casey | 2009-01-12 18:00:46 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-01-12 18:00:46 +0000 |
commit | fb8faa8336ddb795ccd6840259b06a2608350a57 (patch) | |
tree | 1f4977b9918d416602af88709e15aecf9499b969 /bin/assets | |
parent | * Remove FunSLUDP code since this has moved to http://forge.opensimulator.org... (diff) | |
download | opensim-SC_OLD-fb8faa8336ddb795ccd6840259b06a2608350a57.zip opensim-SC_OLD-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.gz opensim-SC_OLD-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.bz2 opensim-SC_OLD-fb8faa8336ddb795ccd6840259b06a2608350a57.tar.xz |
* Apply http://opensimulator.org/mantis/view.php?id=2913
* Add the KanEd scripts to the standard library
* Thanks Fly-Man-
Diffstat (limited to 'bin/assets')
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test01.lsl | 13 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test02.lsl | 31 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test03.lsl | 49 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test04.lsl | 51 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test05.lsl | 30 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test06.lsl | 8 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test07.lsl | 38 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test08.lsl | 23 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test09.lsl | 71 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test10.lsl | 57 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test11.lsl | 52 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test12.lsl | 46 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test13.lsl | 16 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test14.lsl | 70 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test15.lsl | 10 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/KanEd-Test16.lsl | 66 | ||||
-rw-r--r-- | bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml | 118 |
17 files changed, 747 insertions, 2 deletions
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test01.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test01.lsl new file mode 100644 index 0000000..5f8a0aa --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test01.lsl | |||
@@ -0,0 +1,13 @@ | |||
1 | default | ||
2 | { | ||
3 | state_entry() | ||
4 | { | ||
5 | llSay( 0, "Hello, Avatar!"); | ||
6 | } | ||
7 | |||
8 | touch_start(integer total_number) | ||
9 | { | ||
10 | llSay( 0, "Touched."); | ||
11 | } | ||
12 | } | ||
13 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test02.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test02.lsl new file mode 100644 index 0000000..2506d95 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test02.lsl | |||
@@ -0,0 +1,31 @@ | |||
1 | integer counter; | ||
2 | |||
3 | default | ||
4 | { | ||
5 | state_entry() | ||
6 | { | ||
7 | llSay( 0, "Hello, Avatar! Touch to change color and size."); | ||
8 | counter = 0; | ||
9 | } | ||
10 | |||
11 | touch_start(integer total_number) | ||
12 | { // do these instructions when the object is touched. | ||
13 | counter = counter + 1; | ||
14 | |||
15 | // choose three random RGB color components between 0. and 1.0. | ||
16 | float redness = llFrand( 1.0 ); | ||
17 | float greenness = llFrand( 1.0 ); | ||
18 | float blueness = llFrand( 1.0 ); | ||
19 | |||
20 | // combine color components into a vector and use that vector | ||
21 | // to set object color. | ||
22 | vector prim_color = < redness, greenness, blueness >; | ||
23 | llSetColor( prim_color, ALL_SIDES ); // set object color to new color. | ||
24 | |||
25 | // choose a random number between 0. and 10. for use as a scale factor. | ||
26 | float new_scale = llFrand(10.0) + 1.0; | ||
27 | llSetScale(< new_scale, new_scale, new_scale > ); // set object scale. | ||
28 | llSay( 0, "Touched by angel number " + (string)counter); | ||
29 | } | ||
30 | } | ||
31 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test03.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test03.lsl new file mode 100644 index 0000000..f371ee9 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test03.lsl | |||
@@ -0,0 +1,49 @@ | |||
1 | integer counter; | ||
2 | integer second; | ||
3 | |||
4 | default | ||
5 | { | ||
6 | state_entry() | ||
7 | { | ||
8 | llSay( 0, "Hello, Avatar! Touch to change color and size."); | ||
9 | counter = 0; | ||
10 | } | ||
11 | |||
12 | touch_start(integer total_number) | ||
13 | { | ||
14 | counter = counter + 1; | ||
15 | |||
16 | llSay( 0, "Touched by angel number " + (string)counter); | ||
17 | |||
18 | llSetTimerEvent( 2 ); // create a "timer event" every 2 seconds. | ||
19 | } | ||
20 | |||
21 | timer() // do these instructions every time the timer event occurs. | ||
22 | { | ||
23 | second++; | ||
24 | |||
25 | // choose three random RGB color components between 0. and 1.0. | ||
26 | float red = llFrand( 1.0 ); | ||
27 | float green = llFrand( 1.0 ); | ||
28 | float blue = llFrand( 1.0 ); | ||
29 | |||
30 | // combine color components into a vector and use that vector | ||
31 | // to set object color. | ||
32 | vector prim_color = < red, green, blue >; | ||
33 | llSetColor( prim_color, ALL_SIDES ); // set object color to new color. | ||
34 | |||
35 | // a choose random number between 0. and 10 for use as a scale factor. | ||
36 | float new_scale = llFrand( 10.0 ); | ||
37 | llSetScale(< new_scale, new_scale, new_scale > ); // set object scale. | ||
38 | |||
39 | if ( second > 19 ) // then time to wrap this up. | ||
40 | { | ||
41 | // turn object black, print "resting" message, and reset object.... | ||
42 | llSetColor( < 0, 0, 0 >, ALL_SIDES ); | ||
43 | |||
44 | llSay( 0, "Object now resting and resetting script." ); | ||
45 | llResetScript(); // return object to ready state. | ||
46 | } | ||
47 | } | ||
48 | } | ||
49 | |||
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 @@ | |||
1 | integer counter; | ||
2 | integer second; | ||
3 | vector startPosition; | ||
4 | |||
5 | default | ||
6 | { | ||
7 | state_entry() | ||
8 | { | ||
9 | llSay( 0, "Hello, Avatar! Touch to change position."); | ||
10 | counter = 0; | ||
11 | startPosition = llGetPos(); | ||
12 | } | ||
13 | |||
14 | touch_start(integer total_number) | ||
15 | { | ||
16 | counter = counter + 1; | ||
17 | |||
18 | llSay( 0, "Touched by angel number " + (string)counter); | ||
19 | |||
20 | llSetTimerEvent( 1 ); // arrange for a "timer event" every second. | ||
21 | } | ||
22 | |||
23 | timer() // do these instructions every time the timer event occurs. | ||
24 | { | ||
25 | second++; | ||
26 | |||
27 | // choose three random distances between 0. and 10.0. | ||
28 | float X_distance = llFrand( 10.0 ); | ||
29 | float Y_distance = llFrand( 10.0 ); | ||
30 | float Z_distance = llFrand( 10.0 ); | ||
31 | |||
32 | // combine these distance components into a vector and use it | ||
33 | // to increment the starting position and reposition the object. | ||
34 | vector increment = < X_distance, Y_distance, Z_distance >; | ||
35 | vector newPosition = startPosition + increment; | ||
36 | llSetPos( newPosition ); // reposition object. | ||
37 | |||
38 | if ( second > 19 ) // then time to wrap this up. | ||
39 | { | ||
40 | // move object back to starting position... | ||
41 | while ( llVecDist( llGetPos(), startPosition ) > 0.001) | ||
42 | { | ||
43 | llSetPos( startPosition ); | ||
44 | } | ||
45 | |||
46 | llSay( 0, "Object now resting and resetting script." ); | ||
47 | llResetScript(); // return object to ready state. | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test05.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test05.lsl new file mode 100644 index 0000000..86727cf --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test05.lsl | |||
@@ -0,0 +1,30 @@ | |||
1 | default | ||
2 | { | ||
3 | state_entry() | ||
4 | { | ||
5 | llSay( 0, "Hello, Avatar!"); | ||
6 | vector startPoint = llGetPos(); | ||
7 | } | ||
8 | |||
9 | touch_start(integer total_number) | ||
10 | { | ||
11 | llSay( 0, "Touched." ); | ||
12 | |||
13 | // Define a rotation of 10 degrees around the Y-axis. | ||
14 | rotation Y_10 = llEuler2Rot( < 0, 10 * DEG_TO_RAD, 0 > ); | ||
15 | |||
16 | // now rotate the object 10 degrees in the X-Z plane during | ||
17 | // each loop iteration. note that each call to llSetRot | ||
18 | // causes a .2 second delay. | ||
19 | integer i; | ||
20 | for( i = 1; i < 100; i++ ) | ||
21 | { | ||
22 | // rotate object in the X-Z plane around its own Y-axis. | ||
23 | rotation newRotation = llGetRot() * Y_10; | ||
24 | |||
25 | llSetRot( newRotation ); | ||
26 | } | ||
27 | llSay( 0, "Rotation stopped" ); | ||
28 | } | ||
29 | } | ||
30 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test06.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test06.lsl new file mode 100644 index 0000000..158d676 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test06.lsl | |||
@@ -0,0 +1,8 @@ | |||
1 | default | ||
2 | { | ||
3 | state_entry() | ||
4 | { | ||
5 | llTargetOmega( < 0, 1, 1 >, .2 * PI, 1.0 ); | ||
6 | } | ||
7 | } | ||
8 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test07.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test07.lsl new file mode 100644 index 0000000..a1258f9 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test07.lsl | |||
@@ -0,0 +1,38 @@ | |||
1 | vector rotationCenter; | ||
2 | |||
3 | default | ||
4 | { | ||
5 | state_entry() | ||
6 | { | ||
7 | llSay( 0, "Hello, Avatar!"); | ||
8 | vector startPoint = llGetPos(); | ||
9 | rotationCenter = startPoint + < 3, 3, 3 >; | ||
10 | // distance to the point of rotation should probably be a | ||
11 | // function of the max dimension of the object. | ||
12 | } | ||
13 | |||
14 | touch_start(integer total_number) | ||
15 | { | ||
16 | llSay( 0, "Touched." ); | ||
17 | |||
18 | // Define a "rotation" of 10 degrees around the z-axis. | ||
19 | rotation Z_15 = llEuler2Rot( < 0, 0, 15 * DEG_TO_RAD > ); | ||
20 | |||
21 | integer i; | ||
22 | for( i = 1; i < 100; i++ ) // limit simulation time in case of | ||
23 | { // unexpected behavior. | ||
24 | vector currentPosition = llGetPos(); | ||
25 | |||
26 | vector currentOffset = currentPosition - rotationCenter; | ||
27 | |||
28 | // rotate the offset vector in the X-Y plane around the | ||
29 | // distant point of rotation. | ||
30 | vector rotatedOffset = currentOffset * Z_15; | ||
31 | vector newPosition = rotationCenter + rotatedOffset; | ||
32 | |||
33 | llSetPos( newPosition ); | ||
34 | } | ||
35 | llSay( 0, "Orbiting stopped" ); | ||
36 | } | ||
37 | } | ||
38 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test08.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test08.lsl new file mode 100644 index 0000000..d29428c --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test08.lsl | |||
@@ -0,0 +1,23 @@ | |||
1 | default | ||
2 | { | ||
3 | state_entry() | ||
4 | { | ||
5 | llSay( 0, "Hello, Avatar! Touch to launch me straight up."); | ||
6 | llSetStatus( 1, TRUE ); // turn on physics. | ||
7 | } | ||
8 | |||
9 | touch_start(integer total_number) | ||
10 | { | ||
11 | vector start_color = llGetColor( ALL_SIDES ); // save current color. | ||
12 | llSetColor( < 1.0, 0.0, 0.0 > , ALL_SIDES ); // set color to red. | ||
13 | |||
14 | float objMass = llGetMass(); | ||
15 | float Z_force = 20.0 * objMass; | ||
16 | |||
17 | llApplyImpulse( < 0.0, 0.0, Z_force >, FALSE ); | ||
18 | |||
19 | llSay( 0, "Impulse of " + (string)Z_force + " applied." ); | ||
20 | llSetColor( start_color , ALL_SIDES ); // set color to green. | ||
21 | } | ||
22 | } | ||
23 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test09.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test09.lsl new file mode 100644 index 0000000..095f942 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test09.lsl | |||
@@ -0,0 +1,71 @@ | |||
1 | vector startPos; | ||
2 | vector curPos; | ||
3 | vector curForce; | ||
4 | integer second; | ||
5 | |||
6 | default | ||
7 | { | ||
8 | state_entry() | ||
9 | { | ||
10 | llSay( 0, "Hello, Avatar! Touch to launch me straight up."); | ||
11 | llSetStatus( 1, TRUE ); | ||
12 | startPos = < 0, 0, 0 >; | ||
13 | } | ||
14 | |||
15 | touch_start(integer total_number) | ||
16 | { | ||
17 | startPos = llGetPos(); | ||
18 | curPos = startPos; | ||
19 | curForce = < 0, 0, 0 >; | ||
20 | second = 0; | ||
21 | |||
22 | llSetColor( < 1.0, 0.0, 0.0 > , ALL_SIDES ); // set color to red. | ||
23 | |||
24 | float objMass = llGetMass(); | ||
25 | float Z_force = 10.2 * objMass; | ||
26 | |||
27 | llSetForce( < 0.0, 0.0, Z_force >, FALSE ); | ||
28 | |||
29 | llSay( 0, "Force of " + (string)Z_force + " being applied." ); | ||
30 | llSetTimerEvent(1); | ||
31 | } | ||
32 | |||
33 | timer() | ||
34 | { | ||
35 | second++; | ||
36 | curPos = llGetPos(); | ||
37 | float curDisplacement = llVecMag( curPos - startPos ); | ||
38 | |||
39 | if( ( curDisplacement > 30. ) && // then object is too far away, and | ||
40 | ( llGetForce() != < 0.0, 0.0, 0.0 > ) ) // force not already zero, | ||
41 | { // then let gravity take over, and change color to green. | ||
42 | llSetForce( < 0.0, 0.0, 0.0 >, FALSE ); | ||
43 | llSetColor( < 0, 1.0, 0 >, ALL_SIDES ); | ||
44 | llSay( 0, "Force removed; object in free flight." ); | ||
45 | } | ||
46 | |||
47 | if ( second > 19 ) // then time to wrap this up. | ||
48 | { | ||
49 | // turn object blue and zero force to be safe.... | ||
50 | llSetColor( < 0, 0, 1.0 >, ALL_SIDES ); // change color to blue. | ||
51 | llSetForce( < 0, 0, 0 >, FALSE ); | ||
52 | |||
53 | // ...move object back to starting position... | ||
54 | // ...after saving current status of Physics attribute. | ||
55 | integer savedStatus = llGetStatus( 1 ); | ||
56 | llSetStatus( 1, FALSE ); // turn physics off. | ||
57 | while ( llVecDist( llGetPos(), startPos ) > 0.001) | ||
58 | { | ||
59 | llSetPos( startPos ); | ||
60 | } | ||
61 | llSetStatus( 1, savedStatus ); // restore Physics status. | ||
62 | |||
63 | //...and then turn color to black and Reset the script. | ||
64 | llSetColor( < 1, 1, 1 >, ALL_SIDES ); | ||
65 | llSetTimerEvent( 0 ); // turn off timer events. | ||
66 | llSay( 0, "Done and resetting script." ); | ||
67 | llResetScript(); // return object to ready state. | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test10.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test10.lsl new file mode 100644 index 0000000..de16df7 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test10.lsl | |||
@@ -0,0 +1,57 @@ | |||
1 | vector startPosition; | ||
2 | float groundLevel; | ||
3 | |||
4 | default | ||
5 | { | ||
6 | state_entry() | ||
7 | { | ||
8 | llListen( 0, "", llGetOwner(), ""); | ||
9 | |||
10 | startPosition = llGetPos(); | ||
11 | groundLevel = llGround( startPosition ); | ||
12 | |||
13 | llSay( 0, "Control this object with chat commands like:" ); | ||
14 | llSay( 0, "'up' or 'down' followed by a distance." ); | ||
15 | } | ||
16 | |||
17 | listen( integer channel, string name, key id, string message ) | ||
18 | { | ||
19 | // separate the input into blank-delmited tokens. | ||
20 | list parsed = llParseString2List( message, [ " " ], [] ); | ||
21 | |||
22 | // get the first part--the "command". | ||
23 | string command = llList2String( parsed, 0 ); | ||
24 | |||
25 | // get the second part--the "distance". | ||
26 | string distance_string = llList2String( parsed, 1 ); | ||
27 | float distance = ( float )distance_string; | ||
28 | |||
29 | vector position = llGetPos(); | ||
30 | |||
31 | if( command == "up" ) | ||
32 | { | ||
33 | if( ( position.z + distance ) < (startPosition.z + 10.0 ) ) | ||
34 | { | ||
35 | llSetPos( llGetPos() + < 0, 0, distance > ); // move up | ||
36 | llSetText( "Went up " + (string)distance, < 1, 0, 0 >, 1 ); | ||
37 | } | ||
38 | else | ||
39 | { | ||
40 | llSetText( "Can't go so high.", < 1, 0, 0 >, 1 ); | ||
41 | } | ||
42 | } | ||
43 | else if( command == "down" ) | ||
44 | { | ||
45 | if( ( position.z - distance ) > groundLevel ) | ||
46 | { | ||
47 | llSetPos( llGetPos() + < 0, 0, -distance > ); // move down | ||
48 | llSetText( "Went down " + (string)distance, < 1, 0, 0 >, 1 ); | ||
49 | } | ||
50 | else | ||
51 | { | ||
52 | llSetText( "Can't go so low.", < 1, 0, 0 >, 1 ); | ||
53 | } | ||
54 | } | ||
55 | } | ||
56 | } | ||
57 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test11.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test11.lsl new file mode 100644 index 0000000..e4b4048 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test11.lsl | |||
@@ -0,0 +1,52 @@ | |||
1 | integer dialog_channel= 427; // set a dialog channel | ||
2 | list menu = [ "Go up", "Go down" ]; | ||
3 | vector startPosition; | ||
4 | float groundLevel; | ||
5 | |||
6 | default | ||
7 | { | ||
8 | state_entry() | ||
9 | { | ||
10 | // arrange to listen for dialog answers (from multiple users) | ||
11 | llListen( dialog_channel, "", NULL_KEY, ""); | ||
12 | |||
13 | startPosition = llGetPos(); | ||
14 | groundLevel = llGround( startPosition ); | ||
15 | } | ||
16 | |||
17 | touch_start(integer total_number) | ||
18 | { | ||
19 | llDialog( llDetectedKey( 0 ), "What do you want to do?", menu, | ||
20 | dialog_channel ); | ||
21 | } | ||
22 | |||
23 | listen(integer channel, string name, key id, string choice ) | ||
24 | { | ||
25 | vector position = llGetPos(); | ||
26 | |||
27 | // if a valid choice was made, implement that choice if possible. | ||
28 | // (llListFindList returns -1 if choice is not in the menu list.) | ||
29 | if ( llListFindList( menu, [ choice ]) != -1 ) | ||
30 | { | ||
31 | if ( choice == "Go up" ) | ||
32 | { | ||
33 | if( position.z < ( startPosition.z + 10.0 ) ) | ||
34 | { | ||
35 | llSetPos( llGetPos() + < 0, 0, 1.0 > ); // move up | ||
36 | } | ||
37 | } | ||
38 | else if( choice == "Go down" ) | ||
39 | { | ||
40 | if( position.z > ( groundLevel + 1.0 ) ) | ||
41 | { | ||
42 | llSetPos( llGetPos() + < 0, 0, -1.0 > ); // move down | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | else | ||
47 | { | ||
48 | llSay( 0, "Invalid choice: " + choice ); | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test12.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test12.lsl new file mode 100644 index 0000000..eaa885b --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test12.lsl | |||
@@ -0,0 +1,46 @@ | |||
1 | vector startPosition; | ||
2 | float groundLevel; | ||
3 | |||
4 | default | ||
5 | { | ||
6 | state_entry() | ||
7 | { | ||
8 | // get permission to take over the avatar's control inputs. | ||
9 | llRequestPermissions( llGetOwner(), PERMISSION_TAKE_CONTROLS ); | ||
10 | |||
11 | startPosition = llGetPos(); | ||
12 | groundLevel = llGround( startPosition ); | ||
13 | } | ||
14 | |||
15 | run_time_permissions( integer perm ) // event for processing | ||
16 | // permission dialog. | ||
17 | { | ||
18 | if ( perm & PERMISSION_TAKE_CONTROLS ) // permission has been given. | ||
19 | { | ||
20 | // go ahead and take over the forward and backward controls. | ||
21 | llTakeControls( CONTROL_FWD | CONTROL_BACK, TRUE, FALSE ); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | control( key id, integer held, integer change ) // event for processing | ||
26 | // key press. | ||
27 | { | ||
28 | vector position = llGetPos(); | ||
29 | |||
30 | if ( change & held & CONTROL_FWD ) | ||
31 | { // the "move forward" control has been activated. | ||
32 | if( position.z < (startPosition.z + 10.0) ) | ||
33 | { | ||
34 | llSetPos( llGetPos() + < 0, 0, 1.0 >); // move up | ||
35 | } | ||
36 | } | ||
37 | else if ( change & held & CONTROL_BACK ) | ||
38 | { // the "move backward" key has been activated. | ||
39 | if( position.z > groundLevel + 1.0 ) | ||
40 | { | ||
41 | llSetPos( llGetPos() + < 0, 0, -1.0 >); // move down | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test13.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test13.lsl new file mode 100644 index 0000000..7238a9b --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test13.lsl | |||
@@ -0,0 +1,16 @@ | |||
1 | default | ||
2 | { | ||
3 | state_entry() | ||
4 | { | ||
5 | llSay( 0, "Hello, Avatar!"); | ||
6 | } | ||
7 | |||
8 | touch_start(integer total_number) | ||
9 | { | ||
10 | llSay( 0, "Touched."); | ||
11 | |||
12 | llRezObject("Object1", llGetPos() + < 0, 0, 2 >, ZERO_VECTOR, | ||
13 | ZERO_ROTATION, 42); | ||
14 | } | ||
15 | } | ||
16 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test14.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test14.lsl new file mode 100644 index 0000000..2c60035 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test14.lsl | |||
@@ -0,0 +1,70 @@ | |||
1 | integer createdObjectCounter; | ||
2 | integer linkedObjectCounter; | ||
3 | |||
4 | default | ||
5 | { | ||
6 | state_entry() | ||
7 | { | ||
8 | llSay( 0, "Hello, Avatar!"); | ||
9 | linkedObjectCounter = 0; // zero the linked object counter. | ||
10 | } | ||
11 | |||
12 | touch_start(integer total_number) | ||
13 | { | ||
14 | if( createdObjectCounter <= 0 ) // nothing has yet been linked, | ||
15 | { // begin object creation sequence... | ||
16 | // ask for permissions now, since it will be too late later. | ||
17 | llRequestPermissions( llGetOwner(), PERMISSION_CHANGE_LINKS ); | ||
18 | } | ||
19 | else // just do whatever should be done upon touch without | ||
20 | { // creating new objects to link. | ||
21 | // insert commands here to respond to a touch. | ||
22 | } | ||
23 | } | ||
24 | |||
25 | run_time_permissions( integer permissions_granted ) | ||
26 | { | ||
27 | if( permissions_granted == PERMISSION_CHANGE_LINKS ) | ||
28 | { // create 2 objects. | ||
29 | llRezObject("Object1", llGetPos() + < 1, 0, 2 >, | ||
30 | ZERO_VECTOR, ZERO_ROTATION, 42); | ||
31 | createdObjectCounter = createdObjectCounter + 1; | ||
32 | |||
33 | llRezObject("Object1", llGetPos() + < -1, 0, 2 >, | ||
34 | ZERO_VECTOR, ZERO_ROTATION, 42); | ||
35 | createdObjectCounter = createdObjectCounter + 1; | ||
36 | |||
37 | } | ||
38 | else | ||
39 | { | ||
40 | llOwnerSay( "Didn't get permission to change links." ); | ||
41 | return; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | object_rez( key child_id ) | ||
46 | { | ||
47 | llOwnerSay( "rez happened and produced object with key " + | ||
48 | (string)child_id ); | ||
49 | |||
50 | // link as parent to the just created child. | ||
51 | llCreateLink( child_id, TRUE ); | ||
52 | |||
53 | // if all child objects have been created then the script can | ||
54 | // continue to work as a linked set of objects. | ||
55 | linkedObjectCounter++; | ||
56 | if( linkedObjectCounter >= 2 ) | ||
57 | { | ||
58 | // Change all child objects in the set to red (including parent). | ||
59 | llSetLinkColor( LINK_ALL_CHILDREN, < 1, 0, 0 >, ALL_SIDES ); | ||
60 | |||
61 | // Make child object "2" half-tranparent. | ||
62 | llSetLinkAlpha( 2, .5, ALL_SIDES ); | ||
63 | |||
64 | // Insert commands here to manage subsequent activity of the | ||
65 | // linkset, like this command to rotate the result: | ||
66 | // llTargetOmega( < 0, 1, 1 >, .2 * PI, 1.0 ); | ||
67 | } | ||
68 | } | ||
69 | } | ||
70 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test15.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test15.lsl new file mode 100644 index 0000000..425c9ee --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test15.lsl | |||
@@ -0,0 +1,10 @@ | |||
1 | default | ||
2 | { | ||
3 | state_entry() | ||
4 | { | ||
5 | llSetStatus(STATUS_PHANTOM,TRUE); | ||
6 | llSetTexture("lit_texture", ALL_SIDES); | ||
7 | llSetTextureAnim (ANIM_ON | LOOP, ALL_SIDES, 4, 4, 0, 0, 15.0); | ||
8 | } | ||
9 | } | ||
10 | |||
diff --git a/bin/assets/ScriptsAssetSet/KanEd-Test16.lsl b/bin/assets/ScriptsAssetSet/KanEd-Test16.lsl new file mode 100644 index 0000000..536ff19 --- /dev/null +++ b/bin/assets/ScriptsAssetSet/KanEd-Test16.lsl | |||
@@ -0,0 +1,66 @@ | |||
1 | // This is a script designed to orbit its owner. | ||
2 | vector startPos; | ||
3 | vector curPos; | ||
4 | |||
5 | vector offset; // offset from Agent | ||
6 | integer iteration; | ||
7 | float rotationRate; // degrees of rotation per iteration | ||
8 | float sensorInterval; // seconds between sensor scan. | ||
9 | |||
10 | default | ||
11 | { | ||
12 | state_entry() | ||
13 | { | ||
14 | llOwnerSay( "Hello, Avatar! Touch to start orbiting." ); | ||
15 | llSetStatus( 1, FALSE ); // turn Physics off. | ||
16 | offset = < 2, 2, 1 >; | ||
17 | iteration = 0; | ||
18 | rotationRate = .5; | ||
19 | sensorInterval = .3; | ||
20 | } | ||
21 | |||
22 | touch_start(integer total_number) | ||
23 | { | ||
24 | startPos = llGetPos(); | ||
25 | curPos = startPos; | ||
26 | |||
27 | llSleep( .1 ); | ||
28 | |||
29 | key id = llGetOwner(); | ||
30 | llSensorRepeat( "", id, AGENT, 96, PI, sensorInterval ); | ||
31 | } | ||
32 | |||
33 | sensor(integer total_number) | ||
34 | { | ||
35 | iteration++; | ||
36 | |||
37 | if( iteration > 300 ) | ||
38 | { | ||
39 | llResetScript(); | ||
40 | } | ||
41 | |||
42 | if( llDetectedOwner( 0 ) == llGetOwner() ) | ||
43 | { // the detected Agent is my owner. | ||
44 | vector position = llDetectedPos(0); // find Owner position. | ||
45 | |||
46 | // calculate next object position relative both to the Owner's | ||
47 | // position and the current time interval counter. That is, | ||
48 | // use the iteration counter to define a rotation, multiply | ||
49 | // the rotation by the constant offset to get a rotated offset | ||
50 | // vector, and add that rotated offset to the current position | ||
51 | // to defne the new position. | ||
52 | |||
53 | float degreeRotation = llRound( rotationRate * iteration ) % 360; | ||
54 | rotation Rotation = | ||
55 | llEuler2Rot( < 0, 0, degreeRotation * DEG_TO_RAD > ); | ||
56 | vector rotatedOffset = offset * Rotation; | ||
57 | position += rotatedOffset; | ||
58 | |||
59 | // change the location of the object and save the current (rotated) | ||
60 | // offset for use during the next iteration. | ||
61 | llSetPos( position ); | ||
62 | offset = rotatedOffset; | ||
63 | } | ||
64 | } | ||
65 | } | ||
66 | |||
diff --git a/bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml b/bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml index 6585f7d..c76cb78 100644 --- a/bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml +++ b/bin/assets/ScriptsAssetSet/ScriptsAssetSet.xml | |||
@@ -125,5 +125,119 @@ | |||
125 | <Key Name="assetType" Value="10" /> | 125 | <Key Name="assetType" Value="10" /> |
126 | <Key Name="fileName" Value="GrafittiBoard.lsl" /> | 126 | <Key Name="fileName" Value="GrafittiBoard.lsl" /> |
127 | </Section> | 127 | </Section> |
128 | 128 | ||
129 | </Nini> | 129 | <!-- Adding the Kan-ED tests to the Assets --> |
130 | |||
131 | <Section Name="Kan-Ed Test1"> | ||
132 | <Key Name="assetID" Value="42b6ac70-d21f-11dd-ad8b-0800200c9a66" /> | ||
133 | <Key Name="name" Value="Kan-Ed Test1" /> | ||
134 | <Key Name="assetType" Value="10" /> | ||
135 | <Key Name="fileName" Value="KanEd-Test01.lsl" /> | ||
136 | </Section> | ||
137 | |||
138 | <Section Name="Kan-Ed Test2"> | ||
139 | <Key Name="assetID" Value="42b6ac71-d21f-11dd-ad8b-0800200c9a66" /> | ||
140 | <Key Name="name" Value="Kan-Ed Test2" /> | ||
141 | <Key Name="assetType" Value="10" /> | ||
142 | <Key Name="fileName" Value="KanEd-Test02.lsl" /> | ||
143 | </Section> | ||
144 | |||
145 | <Section Name="Kan-Ed Test3"> | ||
146 | <Key Name="assetID" Value="42b6ac72-d21f-11dd-ad8b-0800200c9a66" /> | ||
147 | <Key Name="name" Value="Kan-Ed Test3" /> | ||
148 | <Key Name="assetType" Value="10" /> | ||
149 | <Key Name="fileName" Value="KanEd-Test03.lsl" /> | ||
150 | </Section> | ||
151 | |||
152 | <Section Name="Kan-Ed Test4"> | ||
153 | <Key Name="assetID" Value="42b6ac73-d21f-11dd-ad8b-0800200c9a66" /> | ||
154 | <Key Name="name" Value="Kan-Ed Test4" /> | ||
155 | <Key Name="assetType" Value="10" /> | ||
156 | <Key Name="fileName" Value="KanEd-Test04.lsl" /> | ||
157 | </Section> | ||
158 | |||
159 | <Section Name="Kan-Ed Test5"> | ||
160 | <Key Name="assetID" Value="42b6ac74-d21f-11dd-ad8b-0800200c9a66" /> | ||
161 | <Key Name="name" Value="Kan-Ed Test5" /> | ||
162 | <Key Name="assetType" Value="10" /> | ||
163 | <Key Name="fileName" Value="KanEd-Test05.lsl" /> | ||
164 | </Section> | ||
165 | |||
166 | <Section Name="Kan-Ed Test6"> | ||
167 | <Key Name="assetID" Value="42b6ac75-d21f-11dd-ad8b-0800200c9a66" /> | ||
168 | <Key Name="name" Value="Kan-Ed Test6" /> | ||
169 | <Key Name="assetType" Value="10" /> | ||
170 | <Key Name="fileName" Value="KanEd-Test06.lsl" /> | ||
171 | </Section> | ||
172 | |||
173 | <Section Name="Kan-Ed Test7"> | ||
174 | <Key Name="assetID" Value="42b6ac76-d21f-11dd-ad8b-0800200c9a66" /> | ||
175 | <Key Name="name" Value="Kan-Ed Test7" /> | ||
176 | <Key Name="assetType" Value="10" /> | ||
177 | <Key Name="fileName" Value="KanEd-Test07.lsl" /> | ||
178 | </Section> | ||
179 | |||
180 | <Section Name="Kan-Ed Test8"> | ||
181 | <Key Name="assetID" Value="42b6ac77-d21f-11dd-ad8b-0800200c9a66" /> | ||
182 | <Key Name="name" Value="Kan-Ed Test8" /> | ||
183 | <Key Name="assetType" Value="10" /> | ||
184 | <Key Name="fileName" Value="KanEd-Test08.lsl" /> | ||
185 | </Section> | ||
186 | |||
187 | <Section Name="Kan-Ed Test9"> | ||
188 | <Key Name="assetID" Value="42b6ac78-d21f-11dd-ad8b-0800200c9a66" /> | ||
189 | <Key Name="name" Value="Kan-Ed Test9" /> | ||
190 | <Key Name="assetType" Value="10" /> | ||
191 | <Key Name="fileName" Value="KanEd-Test09.lsl" /> | ||
192 | </Section> | ||
193 | |||
194 | <Section Name="Kan-Ed Test10"> | ||
195 | <Key Name="assetID" Value="42b6ac79-d21f-11dd-ad8b-0800200c9a66" /> | ||
196 | <Key Name="name" Value="Kan-Ed Test10" /> | ||
197 | <Key Name="assetType" Value="10" /> | ||
198 | <Key Name="fileName" Value="KanEd-Test10.lsl" /> | ||
199 | </Section> | ||
200 | |||
201 | <Section Name="Kan-Ed Test11"> | ||
202 | <Key Name="assetID" Value="42b6ac7a-d21f-11dd-ad8b-0800200c9a66" /> | ||
203 | <Key Name="name" Value="Kan-Ed Test11" /> | ||
204 | <Key Name="assetType" Value="10" /> | ||
205 | <Key Name="fileName" Value="KanEd-Test11.lsl" /> | ||
206 | </Section> | ||
207 | |||
208 | <Section Name="Kan-Ed Test12"> | ||
209 | <Key Name="assetID" Value="42b6ac7b-d21f-11dd-ad8b-0800200c9a66" /> | ||
210 | <Key Name="name" Value="Kan-Ed Test12" /> | ||
211 | <Key Name="assetType" Value="10" /> | ||
212 | <Key Name="fileName" Value="KanEd-Test12.lsl" /> | ||
213 | </Section> | ||
214 | |||
215 | <Section Name="Kan-Ed Test13"> | ||
216 | <Key Name="assetID" Value="42b6ac7c-d21f-11dd-ad8b-0800200c9a66" /> | ||
217 | <Key Name="name" Value="Kan-Ed Test13" /> | ||
218 | <Key Name="assetType" Value="10" /> | ||
219 | <Key Name="fileName" Value="KanEd-Test13.lsl" /> | ||
220 | </Section> | ||
221 | |||
222 | <Section Name="Kan-Ed Test14"> | ||
223 | <Key Name="assetID" Value="42b6ac7d-d21f-11dd-ad8b-0800200c9a66" /> | ||
224 | <Key Name="name" Value="Kan-Ed Test14" /> | ||
225 | <Key Name="assetType" Value="10" /> | ||
226 | <Key Name="fileName" Value="KanEd-Test14.lsl" /> | ||
227 | </Section> | ||
228 | |||
229 | <Section Name="Kan-Ed Test15"> | ||
230 | <Key Name="assetID" Value="42b6ac7e-d21f-11dd-ad8b-0800200c9a66" /> | ||
231 | <Key Name="name" Value="Kan-Ed Test15" /> | ||
232 | <Key Name="assetType" Value="10" /> | ||
233 | <Key Name="fileName" Value="KanEd-Test15.lsl" /> | ||
234 | </Section> | ||
235 | |||
236 | <Section Name="Kan-Ed Test16"> | ||
237 | <Key Name="assetID" Value="42b6ac7f-d21f-11dd-ad8b-0800200c9a66" /> | ||
238 | <Key Name="name" Value="Kan-Ed Test16" /> | ||
239 | <Key Name="assetType" Value="10" /> | ||
240 | <Key Name="fileName" Value="KanEd-Test16.lsl" /> | ||
241 | </Section> | ||
242 | |||
243 | </Nini> \ No newline at end of file | ||