aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/ScriptEngines/Default.lsl
diff options
context:
space:
mode:
authorTedd Hansen2007-08-26 21:21:21 +0000
committerTedd Hansen2007-08-26 21:21:21 +0000
commit7e06df5f835b4a52503cbdf21cda47938f42c2ea (patch)
tree79bb756d67f84fff9304cad7af4419de473cd3e7 /bin/ScriptEngines/Default.lsl
parentSee if this fixes the 0x0 texture size problems, and speeds up texture downlo... (diff)
downloadopensim-SC-7e06df5f835b4a52503cbdf21cda47938f42c2ea.zip
opensim-SC-7e06df5f835b4a52503cbdf21cda47938f42c2ea.tar.gz
opensim-SC-7e06df5f835b4a52503cbdf21cda47938f42c2ea.tar.bz2
opensim-SC-7e06df5f835b4a52503cbdf21cda47938f42c2ea.tar.xz
llList-commands from ldvoipeng, new Default.lsl from dalien
Diffstat (limited to '')
-rw-r--r--bin/ScriptEngines/Default.lsl152
1 files changed, 104 insertions, 48 deletions
diff --git a/bin/ScriptEngines/Default.lsl b/bin/ScriptEngines/Default.lsl
index 51f6ca5..ade855d 100644
--- a/bin/ScriptEngines/Default.lsl
+++ b/bin/ScriptEngines/Default.lsl
@@ -1,48 +1,104 @@
1integer touch_count = 0; 1// autogenerated by generate_default_lsl.rb
2 2integer touch_count = 0;
3to_integer(float num) 3
4{ 4default {
5 llSay(0, num + " floor: " + llFloor(num)); 5 touch_start(integer total_number) {
6 llSay(0, num + " ceiling: " + llCeil(num)); 6 float angle45 = PI/4.0; // 45 degrees
7 llSay(0, num + " round: " + llRound(num)); 7 float angle30 = PI/6.0; // 30 degrees
8} 8 float sqrt2 = llSqrt(2.0);
9 9 if((llFabs(-1.5) != 1.5) || (llFabs(10.4) != 10.4)) {
10default { 10 llShout(0, "Houston, we have a big problem! llFabs() does not work! Need it for other tests!");
11 state_entry() 11 }
12 { 12 llSetText("This is a text by llSetText", <1,0,0>, 1);
13 llSay(0, "Hello, Avatar!"); 13 llWhisper(0, "llWhispering a few random numbers between 0 and 100: " + llFrand(100) + "," + llFrand(100) + "," + llFrand(100) + "," + llFrand(100));
14 } 14 llShout(0, "llShouting the unix time: " + llGetUnixTime() + ", and region corner: " + llGetRegionCorner());
15 15 llShout(1, "Shouting a random number between 0 and 100 on the channel#1: " + llFrand(100));
16 touch_start(integer total_number) 16 if (llAbs(-1) != 1) {
17 { 17 llSay(0, "Assert failed: llAbs(-1) != 1");
18 float angle45 = PI/4.0; // 45 degrees 18 }
19 float angle30 = PI/6.0; // 30 degrees 19 if (llAbs(10) != 10) {
20 float sqrt2 = llSqrt(2.0); 20 llSay(0, "Assert failed: llAbs(10) != 10");
21 float deltaCos = llCos(angle45) - sqrt2/2.0; 21 }
22 float deltaSin = llSin(angle30) - 0.5; 22 if (llFabs((llCos(angle45) - sqrt2/2.0) - 0) > 0.000001) {
23 float deltaAtan = llAtan2(1, 1)*4 - PI; 23 llSay(0, "Assert failed: (llCos(angle45) - sqrt2/2.0) differs from 0 by more than 0.000001");
24 float deltaTan = llTan(PI); 24 llSay(0, " --> The actual result: " + (llCos(angle45) - sqrt2/2.0));
25 llSay(0, "deltaSin: " + deltaSin); 25 }
26 llShout(0, "deltaCos: " + deltaCos); 26 if (llFabs((llSin(angle30) - 0.5) - 0) > 0.000001) {
27 llWhisper(0, "deltaTan: " + deltaTan); 27 llSay(0, "Assert failed: (llSin(angle30) - 0.5) differs from 0 by more than 0.000001");
28 llWhisper(0, "deltaAtan: " + deltaAtan); 28 llSay(0, " --> The actual result: " + (llSin(angle30) - 0.5));
29 llSay(0, "Fabs(power(2^16)): " + llFabs(0-llPow(2, 16))); 29 }
30 llSay(0, "Abs(-1): " + llAbs(-1)); 30 if (llFabs((llAtan2(1, 1)*4 - PI) - 0) > 0.000001) {
31 llSay(0, "One random(100): " + llFrand(100)); 31 llSay(0, "Assert failed: (llAtan2(1, 1)*4 - PI) differs from 0 by more than 0.000001");
32 llSay(0, "Two random(100): " + llFrand(100)); 32 llSay(0, " --> The actual result: " + (llAtan2(1, 1)*4 - PI));
33 llSay(0, "Three random(100): " + llFrand(100)); 33 }
34 llSay(0, "Four random(100.0): " + llFrand(100.0)); 34 if (llFabs((llTan(PI)) - 0) > 0.000001) {
35 llWhisper(0, "The unix time is: " + llGetUnixTime()); 35 llSay(0, "Assert failed: (llTan(PI)) differs from 0 by more than 0.000001");
36 to_integer(2.4); 36 llSay(0, " --> The actual result: " + (llTan(PI)));
37 to_integer(2.5); 37 }
38 to_integer(2.6); 38 if (llFloor(2.4) != 2) {
39 to_integer(3.51); 39 llSay(0, "Assert failed: llFloor(2.4) != 2");
40 llSay(0, "Should be 112abd47ceaae1c05a826828650434a6: " + llMD5String("Hello, Avatar!", 0)); 40 }
41 llSay(0, "Should be 9: " +llModPow(2, 16, 37)); 41 if (llCeil(2.4) != 3) {
42 llSay(0, "Region corner: " + (string)llGetRegionCorner()); 42 llSay(0, "Assert failed: llCeil(2.4) != 3");
43 llSetText("This is a text", <1,0,0>, 1); 43 }
44 44 if (llRound(2.4) != 2) {
45 touch_count++; 45 llSay(0, "Assert failed: llRound(2.4) != 2");
46 llSay(0, "Object was touched. Touch count: " + touch_count); 46 }
47 } 47 if (llFloor(2.5) != 2) {
48} 48 llSay(0, "Assert failed: llFloor(2.5) != 2");
49 }
50 if (llCeil(2.5) != 3) {
51 llSay(0, "Assert failed: llCeil(2.5) != 3");
52 }
53 if (llRound(2.5) != 3) {
54 llSay(0, "Assert failed: llRound(2.5) != 3");
55 }
56 if (llFloor(2.51) != 2) {
57 llSay(0, "Assert failed: llFloor(2.51) != 2");
58 }
59 if (llCeil(2.51) != 3) {
60 llSay(0, "Assert failed: llCeil(2.51) != 3");
61 }
62 if (llRound(2.51) != 3) {
63 llSay(0, "Assert failed: llRound(2.51) != 3");
64 }
65 if (llFloor(3.49) != 3) {
66 llSay(0, "Assert failed: llFloor(3.49) != 3");
67 }
68 if (llCeil(3.49) != 4) {
69 llSay(0, "Assert failed: llCeil(3.49) != 4");
70 }
71 if (llRound(3.49) != 3) {
72 llSay(0, "Assert failed: llRound(3.49) != 3");
73 }
74 if (llFloor(3.5000001) != 3) {
75 llSay(0, "Assert failed: llFloor(3.5000001) != 3");
76 }
77 if (llCeil(3.5000001) != 4) {
78 llSay(0, "Assert failed: llCeil(3.5000001) != 4");
79 }
80 if (llRound(3.5000001) != 4) {
81 llSay(0, "Assert failed: llRound(3.5000001) != 4");
82 }
83 if (llFloor(3.51) != 3) {
84 llSay(0, "Assert failed: llFloor(3.51) != 3");
85 }
86 if (llCeil(3.51) != 4) {
87 llSay(0, "Assert failed: llCeil(3.51) != 4");
88 }
89 if (llRound(3.51) != 4) {
90 llSay(0, "Assert failed: llRound(3.51) != 4");
91 }
92 if ((llFabs(0-llPow(2, 16))) != 65536) {
93 llSay(0, "Assert failed: (llFabs(0-llPow(2, 16))) != 65536");
94 }
95 if (llMD5String("Hello, Avatar!",0) != "112abd47ceaae1c05a826828650434a6") {
96 llSay(0, "Assert failed: llMD5String('Hello, Avatar!',0) != '112abd47ceaae1c05a826828650434a6'");
97 }
98 if (llModPow(2, 16, 37) != 9) {
99 llSay(0, "Assert failed: llModPow(2, 16, 37) != 9");
100 }
101 touch_count++;
102 llSay(0, "Object was touched. Touch count: " + touch_count);
103 }
104}