aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTedd Hansen2007-08-26 21:21:21 +0000
committerTedd Hansen2007-08-26 21:21:21 +0000
commit7e06df5f835b4a52503cbdf21cda47938f42c2ea (patch)
tree79bb756d67f84fff9304cad7af4419de473cd3e7
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
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs97
-rw-r--r--bin/ScriptEngines/Default.lsl152
2 files changed, 187 insertions, 62 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
index bfee3e5..757813b 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands.cs
@@ -37,7 +37,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
37 37
38 38
39 private string m_state = "default"; 39 private string m_state = "default";
40 public string State() { 40
41 public string State()
42 {
41 return m_state; 43 return m_state;
42 } 44 }
43 45
@@ -81,12 +83,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
81 return OpenSim.Framework.Utilities.Util.RandomClass.Next((int)mag); 83 return OpenSim.Framework.Utilities.Util.RandomClass.Next((int)mag);
82 } 84 }
83 } 85 }
86
84 public int llFloor(double f) { return (int)Math.Floor(f); } 87 public int llFloor(double f) { return (int)Math.Floor(f); }
85 public int llCeil(double f) { return (int)Math.Ceiling(f); } 88 public int llCeil(double f) { return (int)Math.Ceiling(f); }
86 public int llRound(double f) { return (int)Math.Round(f, 3); } 89 public int llRound(double f) { return (int)Math.Round(f, 3); }
87 90
88 //This next group are vector operations involving squaring and square root. ckrinke 91 //This next group are vector operations involving squaring and square root. ckrinke
89 public double llVecMag(LSL_Types.Vector3 v) { return (v.X*v.X + v.Y*v.Y + v.Z*v.Z); } 92 public double llVecMag(LSL_Types.Vector3 v)
93 {
94 return (v.X*v.X + v.Y*v.Y + v.Z*v.Z);
95 }
96
90 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) 97 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
91 { 98 {
92 double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z; 99 double mag = v.X * v.X + v.Y * v.Y + v.Z * v.Z;
@@ -120,8 +127,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
120 } 127 }
121 128
122 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v) 129 public LSL_Types.Quaternion llEuler2Rot(LSL_Types.Vector3 v)
123 { //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07 130 {
124 float err = 0.00001f; 131 //this comes from from http://lslwiki.net/lslwiki/wakka.php?wakka=LibraryRotationFunctions but is incomplete as of 8/19/07
132 float err = 0.00001f;
125 double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2); 133 double ax = Math.Sin(v.X / 2); double aw = Math.Cos(v.X / 2);
126 double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2); 134 double by = Math.Sin(v.Y / 2); double bw = Math.Cos(v.Y / 2);
127 double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2); 135 double cz = Math.Sin(v.Z / 2); double cw = Math.Cos(v.Z / 2);
@@ -160,6 +168,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
160 World.SimChat(Helpers.StringToField(text), 168 World.SimChat(Helpers.StringToField(text),
161 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 169 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
162 } 170 }
171
163 public void llSay(int channelID, string text) 172 public void llSay(int channelID, string text)
164 { 173 {
165 //type for say is 1 174 //type for say is 1
@@ -237,7 +246,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
237 public LSL_Types.Vector3 llGetAccel() { return new LSL_Types.Vector3(); } 246 public LSL_Types.Vector3 llGetAccel() { return new LSL_Types.Vector3(); }
238 public LSL_Types.Vector3 llGetOmega() { return new LSL_Types.Vector3(); } 247 public LSL_Types.Vector3 llGetOmega() { return new LSL_Types.Vector3(); }
239 public double llGetTimeOfDay() { return 0; } 248 public double llGetTimeOfDay() { return 0; }
240 public double llGetWallclock() { return DateTime.Now.TimeOfDay.TotalSeconds; } 249
250 public double llGetWallclock()
251 {
252 return DateTime.Now.TimeOfDay.TotalSeconds;
253 }
254
241 public double llGetTime() { return 0; } 255 public double llGetTime() { return 0; }
242 public void llResetTime() { } 256 public void llResetTime() { }
243 public double llGetAndResetTime() { return 0; } 257 public double llGetAndResetTime() { return 0; }
@@ -263,11 +277,13 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
263 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { } 277 public void llRezObject(string inventory, LSL_Types.Vector3 pos, LSL_Types.Quaternion rot, int param) { }
264 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { } 278 public void llLookAt(LSL_Types.Vector3 target, double strength, double damping) { }
265 public void llStopLookAt() { } 279 public void llStopLookAt() { }
280
266 public void llSetTimerEvent(double sec) 281 public void llSetTimerEvent(double sec)
267 { 282 {
268 // Setting timer repeat 283 // Setting timer repeat
269 m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec); 284 m_ScriptEngine.myLSLLongCmdHandler.SetTimerEvent(m_localID, m_itemID, sec);
270 } 285 }
286
271 public void llSleep(double sec) { System.Threading.Thread.Sleep((int)(sec * 1000)); } 287 public void llSleep(double sec) { System.Threading.Thread.Sleep((int)(sec * 1000)); }
272 public double llGetMass() { return 0; } 288 public double llGetMass() { return 0; }
273 public void llCollisionFilter(string name, string id, int accept) { } 289 public void llCollisionFilter(string name, string id, int accept) { }
@@ -281,10 +297,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
281 public void llInstantMessage(string user, string message) { } 297 public void llInstantMessage(string user, string message) { }
282 public void llEmail(string address, string subject, string message) { } 298 public void llEmail(string address, string subject, string message) { }
283 public void llGetNextEmail(string address, string subject) { } 299 public void llGetNextEmail(string address, string subject) { }
300
284 public string llGetKey() 301 public string llGetKey()
285 { 302 {
286 return m_host.UUID.ToStringHyphenated(); 303 return m_host.UUID.ToStringHyphenated();
287 } 304 }
305
288 public void llSetBuoyancy(double buoyancy) { } 306 public void llSetBuoyancy(double buoyancy) { }
289 public void llSetHoverHeight(double height, int water, double tau) { } 307 public void llSetHoverHeight(double height, int water, double tau) { }
290 public void llStopHover() { } 308 public void llStopHover() { }
@@ -362,19 +380,59 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
362 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); } 380 public LSL_Types.Vector3 llGetTextureOffset(int face) { return new LSL_Types.Vector3(); }
363 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); } 381 public LSL_Types.Vector3 llGetTextureScale(int side) { return new LSL_Types.Vector3(); }
364 public double llGetTextureRot(int side) { return 0; } 382 public double llGetTextureRot(int side) { return 0; }
383
365 public int llSubStringIndex(string source, string pattern) 384 public int llSubStringIndex(string source, string pattern)
366 { 385 {
367 return source.IndexOf(pattern); 386 return source.IndexOf(pattern);
368 } 387 }
388
369 public string llGetOwnerKey(string id) { return ""; } 389 public string llGetOwnerKey(string id) { return ""; }
370 public LSL_Types.Vector3 llGetCenterOfMass() { return new LSL_Types.Vector3(); } 390 public LSL_Types.Vector3 llGetCenterOfMass() { return new LSL_Types.Vector3(); }
391
371 public List<string> llListSort(List<string> src, int stride, int ascending) 392 public List<string> llListSort(List<string> src, int stride, int ascending)
372 { return new List<string>(); } 393 {
373 public int llGetListLength(List<string> src) { return 0; } 394 //List<string> nlist = src.Sort();
374 public int llList2Integer(List<string> src, int index) { return 0; } 395
375 public double llList2double(List<string> src, int index) { return 0; } 396 //if (ascending == 0)
376 public string llList2String(List<string> src, int index) { return ""; } 397 //{
377 public string llList2Key(List<string> src, int index) { return ""; } 398 //nlist.Reverse();
399 //}
400
401 //return nlist;
402 return new List<string>(); ;
403 }
404
405 public int llGetListLength(List<string> src)
406 {
407 return src.Count;
408 }
409
410 public int llList2Integer(List<string> src, int index)
411 {
412 return Convert.ToInt32(src[index]);
413 }
414
415 public double llList2Double(List<string> src, int index)
416 {
417 return Convert.ToDouble(src[index]);
418 }
419
420 public float llList2Float(List<string> src, int index)
421 {
422 return Convert.ToSingle(src[index]);
423 }
424
425 public string llList2String(List<string> src, int index)
426 {
427 return src[index];
428 }
429
430 public string llList2Key(List<string> src, int index)
431 {
432 //return OpenSim.Framework.Types.ToStringHyphenated(src[index]);
433 return "";
434 }
435
378 public LSL_Types.Vector3 llList2Vector(List<string> src, int index) 436 public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
379 { return new LSL_Types.Vector3(); } 437 { return new LSL_Types.Vector3(); }
380 public LSL_Types.Quaternion llList2Rot(List<string> src, int index) 438 public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
@@ -391,19 +449,25 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
391 { return new List<string>(); } 449 { return new List<string>(); }
392 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride) 450 public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
393 { return new List<string>(); } 451 { return new List<string>(); }
452
394 public LSL_Types.Vector3 llGetRegionCorner() 453 public LSL_Types.Vector3 llGetRegionCorner()
395 { return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); } 454 {
455 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0);
456 }
457
396 public List<string> llListInsertList(List<string> dest, List<string> src, int start) 458 public List<string> llListInsertList(List<string> dest, List<string> src, int start)
397 { return new List<string>(); } 459 { return new List<string>(); }
398 public int llListFindList(List<string> src, List<string> test) { return 0; } 460 public int llListFindList(List<string> src, List<string> test) { return 0; }
399 public string llGetObjectName() { return ""; } 461 public string llGetObjectName() { return ""; }
400 public void llSetObjectName(string name) { } 462 public void llSetObjectName(string name) { }
463
401 public string llGetDate() 464 public string llGetDate()
402 { 465 {
403 DateTime date = DateTime.Now.ToUniversalTime(); 466 DateTime date = DateTime.Now.ToUniversalTime();
404 string result = date.ToString("yyyy-MM-dd"); 467 string result = date.ToString("yyyy-MM-dd");
405 return result; 468 return result;
406 } 469 }
470
407 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return 0; } 471 public int llEdgeOfWorld(LSL_Types.Vector3 pos, LSL_Types.Vector3 dir) { return 0; }
408 public int llGetAgentInfo(string id) { return 0; } 472 public int llGetAgentInfo(string id) { return 0; }
409 public void llAdjustSoundVolume(double volume) { } 473 public void llAdjustSoundVolume(double volume) { }
@@ -454,7 +518,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
454 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { } 518 public void llDialog(string avatar, string message, List<string> buttons, int chat_channel) { }
455 public void llVolumeDetect(int detect) { } 519 public void llVolumeDetect(int detect) { }
456 public void llResetOtherScript(string name) { } 520 public void llResetOtherScript(string name) { }
457 public int llGetScriptState(string name) { return 0; } 521
522 public int llGetScriptState(string name)
523 {
524 return 0;
525 }
526
458 public void llRemoteLoadScript() { } 527 public void llRemoteLoadScript() { }
459 public void llSetRemoteScriptAccessPin(int pin) { } 528 public void llSetRemoteScriptAccessPin(int pin) { }
460 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { } 529 public void llRemoteLoadScriptPin(string target, string name, int pin, int running, int start_param) { }
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}