aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
diff options
context:
space:
mode:
authorJeff Ames2008-05-16 01:22:11 +0000
committerJeff Ames2008-05-16 01:22:11 +0000
commit65c5efe43b68700bad94076d4cd421160203c5de (patch)
tree589b56649ed02f4942671fd6e51c6dc43f682e0d /OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
parentThank you very much, mjm for : (diff)
downloadopensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.zip
opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.gz
opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.bz2
opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs290
1 files changed, 145 insertions, 145 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index d73a47a..ab91424 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Region.ScriptEngine.Common
57 internal uint m_localID; 57 internal uint m_localID;
58 internal LLUUID m_itemID; 58 internal LLUUID m_itemID;
59 internal bool throwErrorOnNotImplemented = true; 59 internal bool throwErrorOnNotImplemented = true;
60 60
61 public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID) 61 public LSL_BuiltIn_Commands(ScriptEngineBase.ScriptEngine ScriptEngine, SceneObjectPart host, uint localID, LLUUID itemID)
62 { 62 {
63 m_ScriptEngine = ScriptEngine; 63 m_ScriptEngine = ScriptEngine;
@@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Common
93 try 93 try
94 { 94 {
95 int eventFlags = m_ScriptEngine.m_ScriptManager.GetStateEventFlags(m_localID, m_itemID); 95 int eventFlags = m_ScriptEngine.m_ScriptManager.GetStateEventFlags(m_localID, m_itemID);
96 m_host.SetScriptEvents(m_itemID, eventFlags); 96 m_host.SetScriptEvents(m_itemID, eventFlags);
97 m_ScriptEngine.m_EventManager.state_entry(m_localID); 97 m_ScriptEngine.m_EventManager.state_entry(m_localID);
98 } 98 }
99 catch (AppDomainUnloadedException) 99 catch (AppDomainUnloadedException)
@@ -186,7 +186,7 @@ namespace OpenSim.Region.ScriptEngine.Common
186 World.EventManager.TriggerRequestChangeWaterHeight((float)height); 186 World.EventManager.TriggerRequestChangeWaterHeight((float)height);
187 } 187 }
188 } 188 }
189 189
190 //These are the implementations of the various ll-functions used by the LSL scripts. 190 //These are the implementations of the various ll-functions used by the LSL scripts.
191 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07 191 //starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
192 public double llSin(double f) 192 public double llSin(double f)
@@ -331,9 +331,9 @@ namespace OpenSim.Region.ScriptEngine.Common
331 // New and improved, now actually works as described. Prim rotates as expected as does llRot2Euler. 331 // New and improved, now actually works as described. Prim rotates as expected as does llRot2Euler.
332 332
333 /* From wiki: 333 /* From wiki:
334 The Euler angle vector (in radians) is converted to a rotation by doing the rotations around the 3 axes 334 The Euler angle vector (in radians) is converted to a rotation by doing the rotations around the 3 axes
335 in Z, Y, X order. So llEuler2Rot(<1.0, 2.0, 3.0> * DEG_TO_RAD) generates a rotation by taking the zero rotation, 335 in Z, Y, X order. So llEuler2Rot(<1.0, 2.0, 3.0> * DEG_TO_RAD) generates a rotation by taking the zero rotation,
336 a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting 336 a vector pointing along the X axis, first rotating it 3 degrees around the global Z axis, then rotating the resulting
337 vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis. 337 vector 2 degrees around the global Y axis, and finally rotating that 1 degree around the global X axis.
338 */ 338 */
339 339
@@ -349,24 +349,24 @@ namespace OpenSim.Region.ScriptEngine.Common
349 double sinX = Math.Sin(v.x); 349 double sinX = Math.Sin(v.x);
350 double sinY = Math.Sin(v.y); 350 double sinY = Math.Sin(v.y);
351 double sinZ = Math.Sin(v.z); 351 double sinZ = Math.Sin(v.z);
352 352
353 s = Math.Sqrt( cosY * cosZ - sinX * sinY * sinZ + cosX * cosZ + cosX * cosY + 1.0f) * 0.5f; 353 s = Math.Sqrt(cosY * cosZ - sinX * sinY * sinZ + cosX * cosZ + cosX * cosY + 1.0f) * 0.5f;
354 if (Math.Abs(s) < 0.00001) // null rotation 354 if (Math.Abs(s) < 0.00001) // null rotation
355 { 355 {
356 x = 0.0f; 356 x = 0.0f;
357 y = 1.0f; 357 y = 1.0f;
358 z = 0.0f; 358 z = 0.0f;
359 } 359 }
360 else 360 else
361 { 361 {
362 s_i = 1.0f / (4.0f * s); 362 s_i = 1.0f / (4.0f * s);
363 x = - ( -sinX * cosY - cosX * sinY * sinZ - sinX * cosZ) * s_i; 363 x = - (-sinX * cosY - cosX * sinY * sinZ - sinX * cosZ) * s_i;
364 y = - ( -cosX * sinY * cosZ + sinX * sinZ - sinY) * s_i; 364 y = - (-cosX * sinY * cosZ + sinX * sinZ - sinY) * s_i;
365 z = - ( -cosY * sinZ - sinX * sinY * cosZ - cosX * sinZ) * s_i; 365 z = - (-cosY * sinZ - sinX * sinY * cosZ - cosX * sinZ) * s_i;
366 } 366 }
367 return new LSL_Types.Quaternion(x, y, z, s); 367 return new LSL_Types.Quaternion(x, y, z, s);
368 } 368 }
369 369
370 370
371 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) 371 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up)
372 { 372 {
@@ -477,7 +477,7 @@ namespace OpenSim.Region.ScriptEngine.Common
477 m_host.AddScriptLPS(1); 477 m_host.AddScriptLPS(1);
478 LLUUID keyID = LLUUID.Zero; 478 LLUUID keyID = LLUUID.Zero;
479 LLUUID.TryParse(id, out keyID); 479 LLUUID.TryParse(id, out keyID);
480 480
481 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host); 481 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SenseOnce(m_localID, m_itemID, name, keyID, type, range, arc, m_host);
482 } 482 }
483 483
@@ -625,7 +625,7 @@ namespace OpenSim.Region.ScriptEngine.Common
625 625
626 626
627 return String.Empty; 627 return String.Empty;
628 628
629 } 629 }
630 630
631 public LSL_Types.LSLInteger llDetectedType(int number) 631 public LSL_Types.LSLInteger llDetectedType(int number)
@@ -644,7 +644,7 @@ namespace OpenSim.Region.ScriptEngine.Common
644 mask |= 0x04; // passive non-moving 644 mask |= 0x04; // passive non-moving
645 else 645 else
646 mask |= 0x02; // active moving 646 mask |= 0x02; // active moving
647 if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ... 647 if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ...
648 return mask; 648 return mask;
649 649
650 } 650 }
@@ -655,7 +655,7 @@ namespace OpenSim.Region.ScriptEngine.Common
655 EntityBase SensedObject = entityDetectedKey(number); 655 EntityBase SensedObject = entityDetectedKey(number);
656 if (SensedObject == null) 656 if (SensedObject == null)
657 return new LSL_Types.Vector3(0, 0, 0); 657 return new LSL_Types.Vector3(0, 0, 0);
658 658
659 return new LSL_Types.Vector3(SensedObject.AbsolutePosition.X,SensedObject.AbsolutePosition.Y,SensedObject.AbsolutePosition.Z); 659 return new LSL_Types.Vector3(SensedObject.AbsolutePosition.X,SensedObject.AbsolutePosition.Y,SensedObject.AbsolutePosition.Z);
660 } 660 }
661 661
@@ -757,7 +757,7 @@ namespace OpenSim.Region.ScriptEngine.Common
757 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) 757 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X)
758 { 758 {
759 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X; 759 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X;
760 760
761 } 761 }
762 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) 762 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y)
763 { 763 {
@@ -824,9 +824,9 @@ namespace OpenSim.Region.ScriptEngine.Common
824 824
825 if (m_host.GetDieAtEdge()) 825 if (m_host.GetDieAtEdge())
826 return 1; 826 return 1;
827 else 827 else
828 return 0; 828 return 0;
829 829
830 case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE: 830 case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE:
831 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); 831 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE");
832 return 0; 832 return 0;
@@ -1248,7 +1248,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1248 { 1248 {
1249 m_host.AddScriptLPS(1); 1249 m_host.AddScriptLPS(1);
1250 return m_host.registerTargetWaypoint(new LLVector3((float)position.x, (float)position.y, (float)position.z), (float)range); 1250 return m_host.registerTargetWaypoint(new LLVector3((float)position.x, (float)position.y, (float)position.z), (float)range);
1251 1251
1252 } 1252 }
1253 1253
1254 public void llTargetRemove(int number) 1254 public void llTargetRemove(int number)
@@ -1286,21 +1286,21 @@ namespace OpenSim.Region.ScriptEngine.Common
1286 { 1286 {
1287 m_host.AddScriptLPS(1); 1287 m_host.AddScriptLPS(1);
1288 //No energy force yet 1288 //No energy force yet
1289 1289
1290 if (force.x > 20000) 1290 if (force.x > 20000)
1291 force.x = 20000; 1291 force.x = 20000;
1292 if (force.y > 20000) 1292 if (force.y > 20000)
1293 force.y = 20000; 1293 force.y = 20000;
1294 if (force.z > 20000) 1294 if (force.z > 20000)
1295 force.z = 20000; 1295 force.z = 20000;
1296 1296
1297 if (local == 1) 1297 if (local == 1)
1298 { 1298 {
1299 m_host.ApplyImpulse(new LLVector3((float)force.x, (float)force.y, (float)force.z), true); 1299 m_host.ApplyImpulse(new LLVector3((float)force.x, (float)force.y, (float)force.z), true);
1300 } 1300 }
1301 else 1301 else
1302 { 1302 {
1303 1303
1304 m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z), false); 1304 m_host.ApplyImpulse(new LLVector3((float)force.x,(float)force.y,(float)force.z), false);
1305 } 1305 }
1306 } 1306 }
@@ -1475,7 +1475,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1475 } 1475 }
1476 // If end is positive, then it directly 1476 // If end is positive, then it directly
1477 // corresponds to the lengt of the substring 1477 // corresponds to the lengt of the substring
1478 // needed (plus one of course). BUT, it 1478 // needed (plus one of course). BUT, it
1479 // must be within bounds. 1479 // must be within bounds.
1480 if (end >= src.Length) 1480 if (end >= src.Length)
1481 { 1481 {
@@ -1493,15 +1493,15 @@ namespace OpenSim.Region.ScriptEngine.Common
1493 // Inverted substring (end < start) 1493 // Inverted substring (end < start)
1494 else 1494 else
1495 { 1495 {
1496 // Implies both indices are below the 1496 // Implies both indices are below the
1497 // lower bound. In the inverted case, that 1497 // lower bound. In the inverted case, that
1498 // means the entire string will be returned 1498 // means the entire string will be returned
1499 // unchanged. 1499 // unchanged.
1500 if (start < 0) 1500 if (start < 0)
1501 { 1501 {
1502 return src; 1502 return src;
1503 } 1503 }
1504 // If both indices are greater than the upper 1504 // If both indices are greater than the upper
1505 // bound the result may seem initially counter 1505 // bound the result may seem initially counter
1506 // intuitive. 1506 // intuitive.
1507 if (end >= src.Length) 1507 if (end >= src.Length)
@@ -1536,7 +1536,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1536 1536
1537 /// <summary> 1537 /// <summary>
1538 /// Delete substring removes the specified substring bounded 1538 /// Delete substring removes the specified substring bounded
1539 /// by the inclusive indices start and end. Indices may be 1539 /// by the inclusive indices start and end. Indices may be
1540 /// negative (indicating end-relative) and may be inverted, 1540 /// negative (indicating end-relative) and may be inverted,
1541 /// i.e. end < start. 1541 /// i.e. end < start.
1542 /// </summary> 1542 /// </summary>
@@ -1591,7 +1591,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1591 { 1591 {
1592 return String.Empty; 1592 return String.Empty;
1593 } 1593 }
1594 1594
1595 if (end > 0) 1595 if (end > 0)
1596 { 1596 {
1597 if (start < src.Length) 1597 if (start < src.Length)
@@ -1616,7 +1616,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1616 } 1616 }
1617 } 1617 }
1618 } 1618 }
1619 1619
1620 /// <summary> 1620 /// <summary>
1621 /// Insert string inserts the specified string identified by src 1621 /// Insert string inserts the specified string identified by src
1622 /// at the index indicated by index. Index may be negative, in 1622 /// at the index indicated by index. Index may be negative, in
@@ -1655,13 +1655,13 @@ namespace OpenSim.Region.ScriptEngine.Common
1655 1655
1656 // The index is in bounds. 1656 // The index is in bounds.
1657 // In this case the index refers to the index that will 1657 // In this case the index refers to the index that will
1658 // be assigned to the first character of the inserted string. 1658 // be assigned to the first character of the inserted string.
1659 // So unlike the other string operations, we do not add one 1659 // So unlike the other string operations, we do not add one
1660 // to get the correct string length. 1660 // to get the correct string length.
1661 return dest.Substring(0,index)+src+dest.Substring(index); 1661 return dest.Substring(0,index)+src+dest.Substring(index);
1662 1662
1663 } 1663 }
1664 1664
1665 public string llToUpper(string src) 1665 public string llToUpper(string src)
1666 { 1666 {
1667 m_host.AddScriptLPS(1); 1667 m_host.AddScriptLPS(1);
@@ -1767,12 +1767,12 @@ namespace OpenSim.Region.ScriptEngine.Common
1767 return; // wiki says, if it's further away then 10m, silently fail. 1767 return; // wiki says, if it's further away then 10m, silently fail.
1768 1768
1769 LLVector3 llvel = new LLVector3((float)vel.x, (float)vel.y, (float)vel.z); 1769 LLVector3 llvel = new LLVector3((float)vel.x, (float)vel.y, (float)vel.z);
1770 1770
1771 // need the magnitude later 1771 // need the magnitude later
1772 float velmag = (float)Util.GetMagnitude(llvel); 1772 float velmag = (float)Util.GetMagnitude(llvel);
1773 1773
1774 SceneObjectGroup new_group = World.RezObject(inv.Value, llpos, new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), llvel, param); 1774 SceneObjectGroup new_group = World.RezObject(inv.Value, llpos, new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s), llvel, param);
1775 1775
1776 // If either of these are null, then there was an unknown error. 1776 // If either of these are null, then there was an unknown error.
1777 if (new_group == null) 1777 if (new_group == null)
1778 continue; 1778 continue;
@@ -1844,7 +1844,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1844 if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero) 1844 if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero)
1845 { 1845 {
1846 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[InventorySelf()].PermsGranter); 1846 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[InventorySelf()].PermsGranter);
1847 1847
1848 if (presence != null) 1848 if (presence != null)
1849 { 1849 {
1850 if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) 1850 if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0)
@@ -1871,7 +1871,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1871 if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero) 1871 if (m_host.TaskInventory[InventorySelf()].PermsGranter != LLUUID.Zero)
1872 { 1872 {
1873 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[InventorySelf()].PermsGranter); 1873 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[InventorySelf()].PermsGranter);
1874 1874
1875 if (presence != null) 1875 if (presence != null)
1876 { 1876 {
1877 if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0) 1877 if ((m_host.TaskInventory[InventorySelf()].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS) != 0)
@@ -1924,7 +1924,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1924 // InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent, 1924 // InstantMessageModule.OnInstantMessage searches through a list of scenes for a client matching the toAgent,
1925 // but I don't think we have a list of scenes available from here. 1925 // but I don't think we have a list of scenes available from here.
1926 // (We also don't want to duplicate the code in OnInstantMessage if we can avoid it.) 1926 // (We also don't want to duplicate the code in OnInstantMessage if we can avoid it.)
1927 1927
1928 // user is a UUID 1928 // user is a UUID
1929 1929
1930 // TODO: figure out values for client, fromSession, and imSessionID 1930 // TODO: figure out values for client, fromSession, and imSessionID
@@ -1991,7 +1991,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1991 } 1991 }
1992 } 1992 }
1993 1993
1994 1994
1995 1995
1996 public void llSetHoverHeight(double height, int water, double tau) 1996 public void llSetHoverHeight(double height, int water, double tau)
1997 { 1997 {
@@ -2050,7 +2050,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2050 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) 2050 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
2051 { 2051 {
2052 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter); 2052 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
2053 2053
2054 if (presence != null) 2054 if (presence != null)
2055 { 2055 {
2056 // Do NOT try to parse LLUUID, animations cannot be triggered by ID 2056 // Do NOT try to parse LLUUID, animations cannot be triggered by ID
@@ -2087,7 +2087,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2087 return; 2087 return;
2088 2088
2089 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter); 2089 ScenePresence presence = World.GetScenePresence(m_host.TaskInventory[invItemID].PermsGranter);
2090 2090
2091 if (presence != null) 2091 if (presence != null)
2092 { 2092 {
2093 if (animID == LLUUID.Zero) 2093 if (animID == LLUUID.Zero)
@@ -2194,7 +2194,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2194 } 2194 }
2195 2195
2196 ScenePresence presence = World.GetScenePresence(agentID); 2196 ScenePresence presence = World.GetScenePresence(agentID);
2197 2197
2198 if (presence != null) 2198 if (presence != null)
2199 { 2199 {
2200 string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID); 2200 string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID);
@@ -2467,7 +2467,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2467 2467
2468 // These functions are supposed to be robust, 2468 // These functions are supposed to be robust,
2469 // so get the state one step at a time. 2469 // so get the state one step at a time.
2470 2470
2471 if ((item = ScriptByName(name)) != LLUUID.Zero) 2471 if ((item = ScriptByName(name)) != LLUUID.Zero)
2472 { 2472 {
2473 if ((sm = m_ScriptEngine.m_ScriptManager) != null) 2473 if ((sm = m_ScriptEngine.m_ScriptManager) != null)
@@ -2480,14 +2480,14 @@ namespace OpenSim.Region.ScriptEngine.Common
2480 } 2480 }
2481 } 2481 }
2482 } 2482 }
2483 } 2483 }
2484 2484
2485 // Required by SL 2485 // Required by SL
2486 2486
2487 if (script == null) 2487 if (script == null)
2488 ShoutError("llSetScriptState: script "+name+" not found"); 2488 ShoutError("llSetScriptState: script "+name+" not found");
2489 2489
2490 // If we didn't find it, then it's safe to 2490 // If we didn't find it, then it's safe to
2491 // assume it is not running. 2491 // assume it is not running.
2492 } 2492 }
2493 2493
@@ -2806,23 +2806,23 @@ namespace OpenSim.Region.ScriptEngine.Common
2806 2806
2807 2807
2808 /* The new / changed functions were tested with the following LSL script: 2808 /* The new / changed functions were tested with the following LSL script:
2809 2809
2810 default 2810 default
2811 { 2811 {
2812 state_entry() 2812 state_entry()
2813 { 2813 {
2814 rotation rot = llEuler2Rot(<0,70,0> * DEG_TO_RAD); 2814 rotation rot = llEuler2Rot(<0,70,0> * DEG_TO_RAD);
2815 2815
2816 llOwnerSay("to get here, we rotate over: "+ (string) llRot2Axis(rot)); 2816 llOwnerSay("to get here, we rotate over: "+ (string) llRot2Axis(rot));
2817 llOwnerSay("and we rotate for: "+ (llRot2Angle(rot) * RAD_TO_DEG)); 2817 llOwnerSay("and we rotate for: "+ (llRot2Angle(rot) * RAD_TO_DEG));
2818 2818
2819 // convert back and forth between quaternion <-> vector and angle 2819 // convert back and forth between quaternion <-> vector and angle
2820 2820
2821 rotation newrot = llAxisAngle2Rot(llRot2Axis(rot),llRot2Angle(rot)); 2821 rotation newrot = llAxisAngle2Rot(llRot2Axis(rot),llRot2Angle(rot));
2822 2822
2823 llOwnerSay("Old rotation was: "+(string) rot); 2823 llOwnerSay("Old rotation was: "+(string) rot);
2824 llOwnerSay("re-converted rotation is: "+(string) newrot); 2824 llOwnerSay("re-converted rotation is: "+(string) newrot);
2825 2825
2826 llSetRot(rot); // to check the parameters in the prim 2826 llSetRot(rot); // to check the parameters in the prim
2827 } 2827 }
2828 } 2828 }
@@ -2832,7 +2832,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2832 2832
2833 // Xantor 29/apr/2008 2833 // Xantor 29/apr/2008
2834 // Returns rotation described by rotating angle radians about axis. 2834 // Returns rotation described by rotating angle radians about axis.
2835 // q = cos(a/2) + i ( x * sin(a/2)) + j (y * sin(a/2)) + k ( z * sin(a/2)) 2835 // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2))
2836 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle) 2836 public LSL_Types.Quaternion llAxisAngle2Rot(LSL_Types.Vector3 axis, double angle)
2837 { 2837 {
2838 m_host.AddScriptLPS(1); 2838 m_host.AddScriptLPS(1);
@@ -2849,7 +2849,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2849 // NotImplemented("llAxisAngle2Rot"); 2849 // NotImplemented("llAxisAngle2Rot");
2850 } 2850 }
2851 2851
2852 2852
2853 // Xantor 29/apr/2008 2853 // Xantor 29/apr/2008
2854 // converts a Quaternion to X,Y,Z axis rotations 2854 // converts a Quaternion to X,Y,Z axis rotations
2855 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot) 2855 public LSL_Types.Vector3 llRot2Axis(LSL_Types.Quaternion rot)
@@ -3264,7 +3264,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3264 /// <summary> 3264 /// <summary>
3265 /// The supplied string is scanned for commas 3265 /// The supplied string is scanned for commas
3266 /// and converted into a list. Commas are only 3266 /// and converted into a list. Commas are only
3267 /// effective if they are encountered outside 3267 /// effective if they are encountered outside
3268 /// of '<' '>' delimiters. Any whitespace 3268 /// of '<' '>' delimiters. Any whitespace
3269 /// before or after an element is trimmed. 3269 /// before or after an element is trimmed.
3270 /// </summary> 3270 /// </summary>
@@ -3314,7 +3314,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3314 } 3314 }
3315 3315
3316 /// <summary> 3316 /// <summary>
3317 /// Randomizes the list, be arbitrarily reordering 3317 /// Randomizes the list, be arbitrarily reordering
3318 /// sublists of stride elements. As the stride approaches 3318 /// sublists of stride elements. As the stride approaches
3319 /// the size of the list, the options become very 3319 /// the size of the list, the options become very
3320 /// limited. 3320 /// limited.
@@ -3323,7 +3323,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3323 /// This could take a while for very large list 3323 /// This could take a while for very large list
3324 /// sizes. 3324 /// sizes.
3325 /// </remarks> 3325 /// </remarks>
3326 3326
3327 public LSL_Types.list llListRandomize(LSL_Types.list src, int stride) 3327 public LSL_Types.list llListRandomize(LSL_Types.list src, int stride)
3328 { 3328 {
3329 3329
@@ -3344,7 +3344,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3344 // Stride MUST be a factor of the list length 3344 // Stride MUST be a factor of the list length
3345 // If not, then return the src list. This also 3345 // If not, then return the src list. This also
3346 // traps those cases where stride > length. 3346 // traps those cases where stride > length.
3347 3347
3348 if (src.Length != stride && src.Length%stride == 0) 3348 if (src.Length != stride && src.Length%stride == 0)
3349 { 3349 {
3350 chunkk = src.Length/stride; 3350 chunkk = src.Length/stride;
@@ -3384,7 +3384,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3384 object[] array = new object[src.Length]; 3384 object[] array = new object[src.Length];
3385 Array.Copy(src.Data, 0, array, 0, src.Length); 3385 Array.Copy(src.Data, 0, array, 0, src.Length);
3386 result = new LSL_Types.list(array); 3386 result = new LSL_Types.list(array);
3387 } 3387 }
3388 3388
3389 return result; 3389 return result;
3390 3390
@@ -3394,10 +3394,10 @@ namespace OpenSim.Region.ScriptEngine.Common
3394 /// Elements in the source list starting with 0 and then 3394 /// Elements in the source list starting with 0 and then
3395 /// every i+stride. If the stride is negative then the scan 3395 /// every i+stride. If the stride is negative then the scan
3396 /// is backwards producing an inverted result. 3396 /// is backwards producing an inverted result.
3397 /// Only those elements that are also in the specified 3397 /// Only those elements that are also in the specified
3398 /// range are included in the result. 3398 /// range are included in the result.
3399 /// </summary> 3399 /// </summary>
3400 3400
3401 public LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride) 3401 public LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride)
3402 { 3402 {
3403 3403
@@ -3415,7 +3415,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3415 if (end < 0) 3415 if (end < 0)
3416 end = src.Length+end; 3416 end = src.Length+end;
3417 3417
3418 // Out of bounds indices are OK, just trim them 3418 // Out of bounds indices are OK, just trim them
3419 // accordingly 3419 // accordingly
3420 3420
3421 if (start > src.Length) 3421 if (start > src.Length)
@@ -3429,7 +3429,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3429 if (start != end) 3429 if (start != end)
3430 { 3430 {
3431 3431
3432 if (start <= end) 3432 if (start <= end)
3433 { 3433 {
3434 si[0] = start; 3434 si[0] = start;
3435 ei[0] = end; 3435 ei[0] = end;
@@ -3448,8 +3448,8 @@ namespace OpenSim.Region.ScriptEngine.Common
3448 // fall within the specified sub-range. The specified 3448 // fall within the specified sub-range. The specified
3449 // range values are inclusive. 3449 // range values are inclusive.
3450 // A negative stride reverses the direction of the 3450 // A negative stride reverses the direction of the
3451 // scan producing an inverted list as a result. 3451 // scan producing an inverted list as a result.
3452 3452
3453 if (stride == 0) 3453 if (stride == 0)
3454 stride = 1; 3454 stride = 1;
3455 3455
@@ -3492,7 +3492,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3492 3492
3493 public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int index) 3493 public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int index)
3494 { 3494 {
3495 3495
3496 LSL_Types.list pref = null; 3496 LSL_Types.list pref = null;
3497 LSL_Types.list suff = null; 3497 LSL_Types.list suff = null;
3498 3498
@@ -3539,7 +3539,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3539 /// Returns the index of the first occurrence of test 3539 /// Returns the index of the first occurrence of test
3540 /// in src. 3540 /// in src.
3541 /// </summary> 3541 /// </summary>
3542 3542
3543 public LSL_Types.LSLInteger llListFindList(LSL_Types.list src, LSL_Types.list test) 3543 public LSL_Types.LSLInteger llListFindList(LSL_Types.list src, LSL_Types.list test)
3544 { 3544 {
3545 3545
@@ -3568,7 +3568,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3568 } 3568 }
3569 } 3569 }
3570 } 3570 }
3571 3571
3572 return index; 3572 return index;
3573 3573
3574 } 3574 }
@@ -3632,12 +3632,12 @@ namespace OpenSim.Region.ScriptEngine.Common
3632 if (LLUUID.TryParse(id,out key)) 3632 if (LLUUID.TryParse(id,out key))
3633 { 3633 {
3634 ScenePresence presence = World.GetScenePresence(key); 3634 ScenePresence presence = World.GetScenePresence(key);
3635 3635
3636 if (presence != null) 3636 if (presence != null)
3637 { 3637 {
3638 return presence.Name; 3638 return presence.Name;
3639 } 3639 }
3640 3640
3641 if (World.GetSceneObjectPart(key) != null) 3641 if (World.GetSceneObjectPart(key) != null)
3642 { 3642 {
3643 return World.GetSceneObjectPart(key).Name; 3643 return World.GetSceneObjectPart(key).Name;
@@ -3646,18 +3646,18 @@ namespace OpenSim.Region.ScriptEngine.Common
3646 return String.Empty; 3646 return String.Empty;
3647 } 3647 }
3648 3648
3649 3649
3650 3650
3651 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate) 3651 public void llSetTextureAnim(int mode, int face, int sizex, int sizey, double start, double length, double rate)
3652 { 3652 {
3653 m_host.AddScriptLPS(1); 3653 m_host.AddScriptLPS(1);
3654 Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation(); 3654 Primitive.TextureAnimation pTexAnim = new Primitive.TextureAnimation();
3655 pTexAnim.Flags =(uint) mode; 3655 pTexAnim.Flags =(uint) mode;
3656 3656
3657 //ALL_SIDES 3657 //ALL_SIDES
3658 if (face == -1) 3658 if (face == -1)
3659 face = 255; 3659 face = 255;
3660 3660
3661 pTexAnim.Face = (uint)face; 3661 pTexAnim.Face = (uint)face;
3662 pTexAnim.Length = (float)length; 3662 pTexAnim.Length = (float)length;
3663 pTexAnim.Rate = (float)rate; 3663 pTexAnim.Rate = (float)rate;
@@ -3688,7 +3688,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3688 LSL_Types.list ret = new LSL_Types.list(); 3688 LSL_Types.list ret = new LSL_Types.list();
3689 object[] delimiters = new object[separators.Length + spacers.Length]; 3689 object[] delimiters = new object[separators.Length + spacers.Length];
3690 separators.Data.CopyTo(delimiters, 0); 3690 separators.Data.CopyTo(delimiters, 0);
3691 spacers.Data.CopyTo(delimiters, separators.Length); 3691 spacers.Data.CopyTo(delimiters, separators.Length);
3692 bool dfound = false; 3692 bool dfound = false;
3693 do 3693 do
3694 { 3694 {
@@ -3735,7 +3735,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3735 3735
3736 public LSL_Types.LSLInteger llOverMyLand(string id) 3736 public LSL_Types.LSLInteger llOverMyLand(string id)
3737 { 3737 {
3738 3738
3739 m_host.AddScriptLPS(1); 3739 m_host.AddScriptLPS(1);
3740 LLUUID key = new LLUUID(); 3740 LLUUID key = new LLUUID();
3741 if (LLUUID.TryParse(id,out key)) 3741 if (LLUUID.TryParse(id,out key))
@@ -3790,14 +3790,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3790 3790
3791 LLUUID key = new LLUUID(); 3791 LLUUID key = new LLUUID();
3792 if (LLUUID.TryParse(id, out key)) 3792 if (LLUUID.TryParse(id, out key))
3793 { 3793 {
3794 ScenePresence av = World.GetScenePresence(key); 3794 ScenePresence av = World.GetScenePresence(key);
3795 3795
3796 if (av != null) 3796 if (av != null)
3797 { 3797 {
3798 if (llAvatarOnSitTarget() == id) 3798 if (llAvatarOnSitTarget() == id)
3799 { 3799 {
3800 // if the avatar is sitting on this object, then 3800 // if the avatar is sitting on this object, then
3801 // we can unsit them. We don't want random scripts unsitting random people 3801 // we can unsit them. We don't want random scripts unsitting random people
3802 // Lets avoid the popcorn avatar scenario. 3802 // Lets avoid the popcorn avatar scenario.
3803 av.StandUp(); 3803 av.StandUp();
@@ -3809,12 +3809,12 @@ namespace OpenSim.Region.ScriptEngine.Common
3809 // if the land is group owned and the object is group owned by the same group 3809 // if the land is group owned and the object is group owned by the same group
3810 // or 3810 // or
3811 // if the object is owned by a person with estate access. 3811 // if the object is owned by a person with estate access.
3812 3812
3813 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y); 3813 ILandObject parcel = World.LandChannel.GetLandObject(av.AbsolutePosition.X, av.AbsolutePosition.Y);
3814 if (parcel != null) 3814 if (parcel != null)
3815 { 3815 {
3816 if (m_host.ObjectOwner == parcel.landData.ownerID || 3816 if (m_host.ObjectOwner == parcel.landData.ownerID ||
3817 (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.groupID 3817 (m_host.OwnerID == m_host.GroupID && m_host.GroupID == parcel.landData.groupID
3818 && parcel.landData.isGroupOwned) || World.ExternalChecks.ExternalChecksCanBeGodLike(m_host.OwnerID)) 3818 && parcel.landData.isGroupOwned) || World.ExternalChecks.ExternalChecksCanBeGodLike(m_host.OwnerID))
3819 { 3819 {
3820 av.StandUp(); 3820 av.StandUp();
@@ -3822,7 +3822,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3822 } 3822 }
3823 } 3823 }
3824 } 3824 }
3825 3825
3826 } 3826 }
3827 3827
3828 } 3828 }
@@ -3928,7 +3928,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3928 m_host.AddScriptLPS(1); 3928 m_host.AddScriptLPS(1);
3929 Primitive.ParticleSystem prules = new Primitive.ParticleSystem(); 3929 Primitive.ParticleSystem prules = new Primitive.ParticleSystem();
3930 LSL_Types.Vector3 tempv = new LSL_Types.Vector3(); 3930 LSL_Types.Vector3 tempv = new LSL_Types.Vector3();
3931 3931
3932 float tempf = 0; 3932 float tempf = 0;
3933 3933
3934 for (int i = 0; i < rules.Length; i += 2) 3934 for (int i = 0; i < rules.Length; i += 2)
@@ -3954,7 +3954,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3954 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_COLOR: 3954 case (int)BuiltIn_Commands_BaseClass.PSYS_PART_END_COLOR:
3955 tempv = (LSL_Types.Vector3)rules.Data[i + 1]; 3955 tempv = (LSL_Types.Vector3)rules.Data[i + 1];
3956 //prules.PartEndColor = new LLColor(tempv.x,tempv.y,tempv.z,1); 3956 //prules.PartEndColor = new LLColor(tempv.x,tempv.y,tempv.z,1);
3957 3957
3958 prules.PartEndColor.R = (float)tempv.x; 3958 prules.PartEndColor.R = (float)tempv.x;
3959 prules.PartEndColor.G = (float)tempv.y; 3959 prules.PartEndColor.G = (float)tempv.y;
3960 prules.PartEndColor.B = (float)tempv.z; 3960 prules.PartEndColor.B = (float)tempv.z;
@@ -3996,7 +3996,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3996 3996
3997 // Xantor 03-May-2008 3997 // Xantor 03-May-2008
3998 // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture 3998 // Wiki: PSYS_SRC_TEXTURE string inventory item name or key of the particle texture
3999 // "" = default texture. 3999 // "" = default texture.
4000 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TEXTURE: 4000 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_TEXTURE:
4001 LLUUID tkey = LLUUID.Zero; 4001 LLUUID tkey = LLUUID.Zero;
4002 4002
@@ -4007,11 +4007,11 @@ namespace OpenSim.Region.ScriptEngine.Common
4007 } 4007 }
4008 // else try to locate the name in inventory of object. found returns key, 4008 // else try to locate the name in inventory of object. found returns key,
4009 // not found returns LLUUID.Zero which will translate to the default particle texture 4009 // not found returns LLUUID.Zero which will translate to the default particle texture
4010 else 4010 else
4011 { 4011 {
4012 prules.Texture = InventoryKey(rules.Data[i+1].ToString()); 4012 prules.Texture = InventoryKey(rules.Data[i+1].ToString());
4013 } 4013 }
4014 break; 4014 break;
4015 4015
4016 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RATE: 4016 case (int)BuiltIn_Commands_BaseClass.PSYS_SRC_BURST_RATE:
4017 tempf = Convert.ToSingle(rules.Data[i + 1].ToString()); 4017 tempf = Convert.ToSingle(rules.Data[i + 1].ToString());
@@ -4150,7 +4150,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4150 m_host.AddScriptLPS(1); 4150 m_host.AddScriptLPS(1);
4151 return m_host.GetAvatarOnSitTarget().ToString(); 4151 return m_host.GetAvatarOnSitTarget().ToString();
4152 //LLUUID AVID = m_host.GetAvatarOnSitTarget(); 4152 //LLUUID AVID = m_host.GetAvatarOnSitTarget();
4153 4153
4154 //if (AVID != LLUUID.Zero) 4154 //if (AVID != LLUUID.Zero)
4155 // return AVID.ToString(); 4155 // return AVID.ToString();
4156 //else 4156 //else
@@ -4283,7 +4283,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4283 4283
4284 // These functions are supposed to be robust, 4284 // These functions are supposed to be robust,
4285 // so get the state one step at a time. 4285 // so get the state one step at a time.
4286 4286
4287 if ((item = ScriptByName(name)) != LLUUID.Zero) 4287 if ((item = ScriptByName(name)) != LLUUID.Zero)
4288 if ((sm = m_ScriptEngine.m_ScriptManager) != null) 4288 if ((sm = m_ScriptEngine.m_ScriptManager) != null)
4289 sm.ResetScript(m_localID, item); 4289 sm.ResetScript(m_localID, item);
@@ -4293,7 +4293,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4293 if (script == null) 4293 if (script == null)
4294 ShoutError("llResetOtherScript: script "+name+" not found"); 4294 ShoutError("llResetOtherScript: script "+name+" not found");
4295 4295
4296 // If we didn't find it, then it's safe to 4296 // If we didn't find it, then it's safe to
4297 // assume it is not running. 4297 // assume it is not running.
4298 } 4298 }
4299 4299
@@ -4307,7 +4307,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4307 4307
4308 // These functions are supposed to be robust, 4308 // These functions are supposed to be robust,
4309 // so get the state one step at a time. 4309 // so get the state one step at a time.
4310 4310
4311 if ((item = ScriptByName(name)) != LLUUID.Zero) 4311 if ((item = ScriptByName(name)) != LLUUID.Zero)
4312 { 4312 {
4313 if ((sm = m_ScriptEngine.m_ScriptManager) != null) 4313 if ((sm = m_ScriptEngine.m_ScriptManager) != null)
@@ -4324,7 +4324,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4324 if (script == null) 4324 if (script == null)
4325 ShoutError("llGetScriptState: script "+name+" not found"); 4325 ShoutError("llGetScriptState: script "+name+" not found");
4326 4326
4327 // If we didn't find it, then it's safe to 4327 // If we didn't find it, then it's safe to
4328 // assume it is not running. 4328 // assume it is not running.
4329 4329
4330 return 0; 4330 return 0;
@@ -4586,7 +4586,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4586 { 4586 {
4587 return; 4587 return;
4588 } 4588 }
4589 4589
4590 if (landowner != m_host.ObjectOwner) 4590 if (landowner != m_host.ObjectOwner)
4591 { 4591 {
4592 return; 4592 return;
@@ -4857,7 +4857,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4857 4857
4858 case 21: // PRIM_FLEXIBLE 4858 case 21: // PRIM_FLEXIBLE
4859 PrimitiveBaseShape shape = m_host.Shape; 4859 PrimitiveBaseShape shape = m_host.Shape;
4860 4860
4861 if (shape.FlexiEntry) 4861 if (shape.FlexiEntry)
4862 res.Add(new LSL_Types.LSLInteger(1)); // active 4862 res.Add(new LSL_Types.LSLInteger(1)); // active
4863 else 4863 else
@@ -4885,7 +4885,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4885 4885
4886 case 23: // PRIM_POINT_LIGHT: 4886 case 23: // PRIM_POINT_LIGHT:
4887 shape = m_host.Shape; 4887 shape = m_host.Shape;
4888 4888
4889 if (shape.LightEntry) 4889 if (shape.LightEntry)
4890 res.Add(new LSL_Types.LSLInteger(1)); // active 4890 res.Add(new LSL_Types.LSLInteger(1)); // active
4891 else 4891 else
@@ -4932,12 +4932,12 @@ namespace OpenSim.Region.ScriptEngine.Common
4932 // </para> 4932 // </para>
4933 // <para> 4933 // <para>
4934 // Each point in a base-64 string represents 4934 // Each point in a base-64 string represents
4935 // a 6 bit value. A 32-bit integer can be 4935 // a 6 bit value. A 32-bit integer can be
4936 // represented using 6 characters (with some 4936 // represented using 6 characters (with some
4937 // redundancy). 4937 // redundancy).
4938 // </para> 4938 // </para>
4939 // <para> 4939 // <para>
4940 // LSL requires a base64 string to be 8 4940 // LSL requires a base64 string to be 8
4941 // characters in length. LSL also uses '/' 4941 // characters in length. LSL also uses '/'
4942 // rather than '-' (MIME compliant). 4942 // rather than '-' (MIME compliant).
4943 // </para> 4943 // </para>
@@ -4948,7 +4948,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4948 // <para> 4948 // <para>
4949 // SL do not record any kind of exception for 4949 // SL do not record any kind of exception for
4950 // these functions, so the string to integer 4950 // these functions, so the string to integer
4951 // conversion returns '0' if an invalid 4951 // conversion returns '0' if an invalid
4952 // character is encountered during conversion. 4952 // character is encountered during conversion.
4953 // </para> 4953 // </para>
4954 // <para> 4954 // <para>
@@ -4962,13 +4962,13 @@ namespace OpenSim.Region.ScriptEngine.Common
4962 // </list> 4962 // </list>
4963 // </para> 4963 // </para>
4964 // </remarks> 4964 // </remarks>
4965 4965
4966 // <summary> 4966 // <summary>
4967 // Table for converting 6-bit integers into 4967 // Table for converting 6-bit integers into
4968 // base-64 characters 4968 // base-64 characters
4969 // </summary> 4969 // </summary>
4970 4970
4971 private static readonly char[] i2ctable = 4971 private static readonly char[] i2ctable =
4972 { 4972 {
4973 'A','B','C','D','E','F','G','H', 4973 'A','B','C','D','E','F','G','H',
4974 'I','J','K','L','M','N','O','P', 4974 'I','J','K','L','M','N','O','P',
@@ -4992,7 +4992,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4992 { 4992 {
4993 -1,-1,-1,-1,-1,-1,-1,-1, // 0x 4993 -1,-1,-1,-1,-1,-1,-1,-1, // 0x
4994 -1,-1,-1,-1,-1,-1,-1,-1, 4994 -1,-1,-1,-1,-1,-1,-1,-1,
4995 -1,-1,-1,-1,-1,-1,-1,-1, // 1x 4995 -1,-1,-1,-1,-1,-1,-1,-1, // 1x
4996 -1,-1,-1,-1,-1,-1,-1,-1, 4996 -1,-1,-1,-1,-1,-1,-1,-1,
4997 -1,-1,-1,-1,-1,-1,-1,-1, // 2x 4997 -1,-1,-1,-1,-1,-1,-1,-1, // 2x
4998 -1,-1,-1,63,-1,-1,-1,64, 4998 -1,-1,-1,63,-1,-1,-1,64,
@@ -5070,25 +5070,25 @@ namespace OpenSim.Region.ScriptEngine.Common
5070 // length strings return zero. 5070 // length strings return zero.
5071 // </param> 5071 // </param>
5072 // <returns> 5072 // <returns>
5073 // Returns an integer representing the 5073 // Returns an integer representing the
5074 // encoded value providedint he 1st 6 5074 // encoded value providedint he 1st 6
5075 // characters of the string. 5075 // characters of the string.
5076 // </returns> 5076 // </returns>
5077 // <remarks> 5077 // <remarks>
5078 // This is coded to behave like LSL's 5078 // This is coded to behave like LSL's
5079 // implementation (I think), based upon the 5079 // implementation (I think), based upon the
5080 // information available at the Wiki. 5080 // information available at the Wiki.
5081 // If more than 8 characters are supplied, 5081 // If more than 8 characters are supplied,
5082 // zero is returned. 5082 // zero is returned.
5083 // If a NULL string is supplied, zero will 5083 // If a NULL string is supplied, zero will
5084 // be returned. 5084 // be returned.
5085 // If fewer than 6 characters are supplied, then 5085 // If fewer than 6 characters are supplied, then
5086 // the answer will reflect a partial 5086 // the answer will reflect a partial
5087 // accumulation. 5087 // accumulation.
5088 // <para> 5088 // <para>
5089 // The 6-bit segments are 5089 // The 6-bit segments are
5090 // extracted left-to-right in big-endian mode, 5090 // extracted left-to-right in big-endian mode,
5091 // which means that segment 6 only contains the 5091 // which means that segment 6 only contains the
5092 // two low-order bits of the 32 bit integer as 5092 // two low-order bits of the 32 bit integer as
5093 // its high order 2 bits. A short string therefore 5093 // its high order 2 bits. A short string therefore
5094 // means loss of low-order information. E.g. 5094 // means loss of low-order information. E.g.
@@ -5126,39 +5126,39 @@ namespace OpenSim.Region.ScriptEngine.Common
5126 return digit<0?(int)0:number; 5126 return digit<0?(int)0:number;
5127 } 5127 }
5128 number += --digit<<26; 5128 number += --digit<<26;
5129 5129
5130 if ((digit=c2itable[str[1]])<=0) 5130 if ((digit=c2itable[str[1]])<=0)
5131 { 5131 {
5132 return digit<0?(int)0:number; 5132 return digit<0?(int)0:number;
5133 } 5133 }
5134 number += --digit<<20; 5134 number += --digit<<20;
5135 5135
5136 if ((digit=c2itable[str[2]])<=0) 5136 if ((digit=c2itable[str[2]])<=0)
5137 { 5137 {
5138 return digit<0?(int)0:number; 5138 return digit<0?(int)0:number;
5139 } 5139 }
5140 number += --digit<<14; 5140 number += --digit<<14;
5141 5141
5142 if ((digit=c2itable[str[3]])<=0) 5142 if ((digit=c2itable[str[3]])<=0)
5143 { 5143 {
5144 return digit<0?(int)0:number; 5144 return digit<0?(int)0:number;
5145 } 5145 }
5146 number += --digit<<8; 5146 number += --digit<<8;
5147 5147
5148 if ((digit=c2itable[str[4]])<=0) 5148 if ((digit=c2itable[str[4]])<=0)
5149 { 5149 {
5150 return digit<0?(int)0:number; 5150 return digit<0?(int)0:number;
5151 } 5151 }
5152 number += --digit<<2; 5152 number += --digit<<2;
5153 5153
5154 if ((digit=c2itable[str[5]])<=0) 5154 if ((digit=c2itable[str[5]])<=0)
5155 { 5155 {
5156 return digit<0?(int)0:number; 5156 return digit<0?(int)0:number;
5157 } 5157 }
5158 number += --digit>>4; 5158 number += --digit>>4;
5159 5159
5160 // ignore trailing padding 5160 // ignore trailing padding
5161 5161
5162 return number; 5162 return number;
5163 } 5163 }
5164 5164
@@ -5182,8 +5182,8 @@ namespace OpenSim.Region.ScriptEngine.Common
5182 5182
5183 // <summary> 5183 // <summary>
5184 // Scan the string supplied in 'src' and 5184 // Scan the string supplied in 'src' and
5185 // tokenize it based upon two sets of 5185 // tokenize it based upon two sets of
5186 // tokenizers provided in two lists, 5186 // tokenizers provided in two lists,
5187 // separators and spacers. 5187 // separators and spacers.
5188 // </summary> 5188 // </summary>
5189 // 5189 //
@@ -5196,38 +5196,38 @@ namespace OpenSim.Region.ScriptEngine.Common
5196 // Both separators and spacers may be arbitrarily 5196 // Both separators and spacers may be arbitrarily
5197 // long strings. i.e. ":::". 5197 // long strings. i.e. ":::".
5198 // 5198 //
5199 // The function returns an ordered list 5199 // The function returns an ordered list
5200 // representing the tokens found in the supplied 5200 // representing the tokens found in the supplied
5201 // sources string. If two successive tokenizers 5201 // sources string. If two successive tokenizers
5202 // are encountered, then a NULL entry is added 5202 // are encountered, then a NULL entry is added
5203 // to the list. 5203 // to the list.
5204 // 5204 //
5205 // It is a precondition that the source and 5205 // It is a precondition that the source and
5206 // toekizer lisst are non-null. If they are null, 5206 // toekizer lisst are non-null. If they are null,
5207 // then a null pointer exception will be thrown 5207 // then a null pointer exception will be thrown
5208 // while their lengths are being determined. 5208 // while their lengths are being determined.
5209 // 5209 //
5210 // A small amount of working memoryis required 5210 // A small amount of working memoryis required
5211 // of approximately 8*#tokenizers. 5211 // of approximately 8*#tokenizers.
5212 // 5212 //
5213 // There are many ways in which this function 5213 // There are many ways in which this function
5214 // can be implemented, this implementation is 5214 // can be implemented, this implementation is
5215 // fairly naive and assumes that when the 5215 // fairly naive and assumes that when the
5216 // function is invooked with a short source 5216 // function is invooked with a short source
5217 // string and/or short lists of tokenizers, then 5217 // string and/or short lists of tokenizers, then
5218 // performance will not be an issue. 5218 // performance will not be an issue.
5219 // 5219 //
5220 // In order to minimize the perofrmance 5220 // In order to minimize the perofrmance
5221 // effects of long strings, or large numbers 5221 // effects of long strings, or large numbers
5222 // of tokeizers, the function skips as far as 5222 // of tokeizers, the function skips as far as
5223 // possible whenever a toekenizer is found, 5223 // possible whenever a toekenizer is found,
5224 // and eliminates redundant tokenizers as soon 5224 // and eliminates redundant tokenizers as soon
5225 // as is possible. 5225 // as is possible.
5226 // 5226 //
5227 // The implementation tries to avoid any copying 5227 // The implementation tries to avoid any copying
5228 // of arrays or other objects. 5228 // of arrays or other objects.
5229 // </remarks> 5229 // </remarks>
5230 5230
5231 public LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list separators, LSL_Types.list spacers) 5231 public LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list separators, LSL_Types.list spacers)
5232 { 5232 {
5233 int beginning = 0; 5233 int beginning = 0;
@@ -5256,7 +5256,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5256 active[i] = true; 5256 active[i] = true;
5257 5257
5258 offset[mlen] = srclen; 5258 offset[mlen] = srclen;
5259 5259
5260 while (beginning < srclen) 5260 while (beginning < srclen)
5261 { 5261 {
5262 5262
@@ -5270,7 +5270,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5270 { 5270 {
5271 // scan all of the markers 5271 // scan all of the markers
5272 if ((offset[j] = src.IndexOf((string)separray[j],beginning)) == -1) 5272 if ((offset[j] = src.IndexOf((string)separray[j],beginning)) == -1)
5273 { 5273 {
5274 // not present at all 5274 // not present at all
5275 active[j] = false; 5275 active[j] = false;
5276 } 5276 }
@@ -5278,7 +5278,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5278 { 5278 {
5279 // present and correct 5279 // present and correct
5280 if (offset[j] < offset[best]) 5280 if (offset[j] < offset[best])
5281 { 5281 {
5282 // closest so far 5282 // closest so far
5283 best = j; 5283 best = j;
5284 if (offset[best] == beginning) 5284 if (offset[best] == beginning)
@@ -5293,19 +5293,19 @@ namespace OpenSim.Region.ScriptEngine.Common
5293 if (offset[best] != beginning) 5293 if (offset[best] != beginning)
5294 { 5294 {
5295 for (j = seplen; (j < mlen) && (offset[best] > beginning); j++) 5295 for (j = seplen; (j < mlen) && (offset[best] > beginning); j++)
5296 { 5296 {
5297 if (active[j]) 5297 if (active[j])
5298 { 5298 {
5299 // scan all of the markers 5299 // scan all of the markers
5300 if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1) 5300 if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1)
5301 { 5301 {
5302 // not present at all 5302 // not present at all
5303 active[j] = false; 5303 active[j] = false;
5304 } else 5304 } else
5305 { 5305 {
5306 // present and correct 5306 // present and correct
5307 if (offset[j] < offset[best]) 5307 if (offset[j] < offset[best])
5308 { 5308 {
5309 // closest so far 5309 // closest so far
5310 best = j; 5310 best = j;
5311 } 5311 }
@@ -5317,7 +5317,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5317 // This is the normal exit from the scanning loop 5317 // This is the normal exit from the scanning loop
5318 5318
5319 if (best == mlen) 5319 if (best == mlen)
5320 { 5320 {
5321 // no markers were found on this pass 5321 // no markers were found on this pass
5322 // so we're pretty much done 5322 // so we're pretty much done
5323 tokens.Add(src.Substring(beginning, srclen-beginning)); 5323 tokens.Add(src.Substring(beginning, srclen-beginning));
@@ -5478,7 +5478,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5478 //should be similar to : llInstantMessage(llGetOwner(),msg) 5478 //should be similar to : llInstantMessage(llGetOwner(),msg)
5479 // llGetOwner ==> m_host.ObjectOwner.ToString() 5479 // llGetOwner ==> m_host.ObjectOwner.ToString()
5480 llInstantMessage(m_host.ObjectOwner.ToString(),msg); 5480 llInstantMessage(m_host.ObjectOwner.ToString(),msg);
5481 5481
5482 //World.SimChat(Helpers.StringToField(msg), ChatTypeEnum.Owner, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID); 5482 //World.SimChat(Helpers.StringToField(msg), ChatTypeEnum.Owner, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID);
5483 //IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 5483 //IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
5484 //wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); 5484 //wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg);
@@ -5509,19 +5509,19 @@ namespace OpenSim.Region.ScriptEngine.Common
5509 5509
5510 /// <summary> 5510 /// <summary>
5511 /// illListReplaceList removes the sub-list defined by the inclusive indices 5511 /// illListReplaceList removes the sub-list defined by the inclusive indices
5512 /// start and end and inserts the src list in its place. The inclusive 5512 /// start and end and inserts the src list in its place. The inclusive
5513 /// nature of the indices means that at least one element must be deleted 5513 /// nature of the indices means that at least one element must be deleted
5514 /// if the indices are within the bounds of the existing list. I.e. 2,2 5514 /// if the indices are within the bounds of the existing list. I.e. 2,2
5515 /// will remove the element at index 2 and replace it with the source 5515 /// will remove the element at index 2 and replace it with the source
5516 /// list. Both indices may be negative, with the usual interpretation. An 5516 /// list. Both indices may be negative, with the usual interpretation. An
5517 /// interesting case is where end is lower than start. As these indices 5517 /// interesting case is where end is lower than start. As these indices
5518 /// bound the list to be removed, then 0->end, and start->lim are removed 5518 /// bound the list to be removed, then 0->end, and start->lim are removed
5519 /// and the source list is added as a suffix. 5519 /// and the source list is added as a suffix.
5520 /// </summary> 5520 /// </summary>
5521 5521
5522 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) 5522 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end)
5523 { 5523 {
5524 5524
5525 LSL_Types.list pref = null; 5525 LSL_Types.list pref = null;
5526 5526
5527 m_host.AddScriptLPS(1); 5527 m_host.AddScriptLPS(1);
@@ -5542,9 +5542,9 @@ namespace OpenSim.Region.ScriptEngine.Common
5542 // list. 5542 // list.
5543 if (start <= end) 5543 if (start <= end)
5544 { 5544 {
5545 // If greater than zero, then there is going to be a 5545 // If greater than zero, then there is going to be a
5546 // surviving prefix. Otherwise the inclusive nature 5546 // surviving prefix. Otherwise the inclusive nature
5547 // of the indices mean that we're going to add the 5547 // of the indices mean that we're going to add the
5548 // source list as a prefix. 5548 // source list as a prefix.
5549 if (start > 0) 5549 if (start > 0)
5550 { 5550 {
@@ -5580,7 +5580,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5580 } 5580 }
5581 // Finally, if start > end, we strip away a prefix and 5581 // Finally, if start > end, we strip away a prefix and
5582 // a suffix, to leave the list that sits <between> ens 5582 // a suffix, to leave the list that sits <between> ens
5583 // and start, and then tag on the src list. AT least 5583 // and start, and then tag on the src list. AT least
5584 // that's my interpretation. We can get sublist to do 5584 // that's my interpretation. We can get sublist to do
5585 // this for us. Note that one, or both of the indices 5585 // this for us. Note that one, or both of the indices
5586 // might have been negative. 5586 // might have been negative.
@@ -6084,7 +6084,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6084 if (LLUUID.TryParse(id, out key)) 6084 if (LLUUID.TryParse(id, out key))
6085 { 6085 {
6086 ScenePresence av = World.GetScenePresence(key); 6086 ScenePresence av = World.GetScenePresence(key);
6087 6087
6088 if (av != null) 6088 if (av != null)
6089 { 6089 {
6090 foreach (object o in args.Data) 6090 foreach (object o in args.Data)
@@ -6103,7 +6103,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6103 case "4": 6103 case "4":
6104 ret.Add(new LSL_Types.Quaternion((double)av.Rotation.x, (double)av.Rotation.y, (double)av.Rotation.z, (double)av.Rotation.w)); 6104 ret.Add(new LSL_Types.Quaternion((double)av.Rotation.x, (double)av.Rotation.y, (double)av.Rotation.z, (double)av.Rotation.w));
6105 break; 6105 break;
6106 case "5": 6106 case "5":
6107 ret.Add(new LSL_Types.Vector3(av.Velocity.X,av.Velocity.Y,av.Velocity.Z)); 6107 ret.Add(new LSL_Types.Vector3(av.Velocity.X,av.Velocity.Y,av.Velocity.Z));
6108 break; 6108 break;
6109 case "6": 6109 case "6":