aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs782
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs171
2 files changed, 530 insertions, 423 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 602a3c8..60ed5c1 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -72,6 +72,7 @@ namespace OpenSim.Region.ScriptEngine.Common
72 72
73 //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]"); 73 //m_log.Info(ScriptEngineName, "LSL_BaseClass.Start() called. Hosted by [" + m_host.Name + ":" + m_host.UUID + "@" + m_host.AbsolutePosition + "]");
74 74
75
75 IConfigSource config = new IniConfigSource(Application.iniFilePath); 76 IConfigSource config = new IniConfigSource(Application.iniFilePath);
76 if (config.Configs["LL-Functions"] == null) 77 if (config.Configs["LL-Functions"] == null)
77 config.AddConfig("LL-Functions"); 78 config.AddConfig("LL-Functions");
@@ -89,7 +90,7 @@ namespace OpenSim.Region.ScriptEngine.Common
89 private void ScriptSleep(int delay) 90 private void ScriptSleep(int delay)
90 { 91 {
91 delay = (int)((float)delay * m_delayFactor); 92 delay = (int)((float)delay * m_delayFactor);
92 if(delay == 0) 93 if (delay == 0)
93 return; 94 return;
94 System.Threading.Thread.Sleep(delay); 95 System.Threading.Thread.Sleep(delay);
95 } 96 }
@@ -128,15 +129,11 @@ namespace OpenSim.Region.ScriptEngine.Common
128 // Object never expires 129 // Object never expires
129 public override Object InitializeLifetimeService() 130 public override Object InitializeLifetimeService()
130 { 131 {
131 //Console.WriteLine("LSL_BuiltIn_Commands: InitializeLifetimeService()");
132 // return null;
133 ILease lease = (ILease)base.InitializeLifetimeService(); 132 ILease lease = (ILease)base.InitializeLifetimeService();
134 133
135 if (lease.CurrentState == LeaseState.Initial) 134 if (lease.CurrentState == LeaseState.Initial)
136 { 135 {
137 lease.InitialLeaseTime = TimeSpan.Zero; // TimeSpan.FromMinutes(1); 136 lease.InitialLeaseTime = TimeSpan.Zero;
138 // lease.SponsorshipTimeout = TimeSpan.FromMinutes(2);
139 // lease.RenewOnCallTime = TimeSpan.FromSeconds(2);
140 } 137 }
141 return lease; 138 return lease;
142 } 139 }
@@ -154,13 +151,13 @@ namespace OpenSim.Region.ScriptEngine.Common
154 151
155 private LLUUID InventorySelf() 152 private LLUUID InventorySelf()
156 { 153 {
157 LLUUID invItemID=new LLUUID(); 154 LLUUID invItemID = new LLUUID();
158 155
159 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) 156 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
160 { 157 {
161 if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID) 158 if (inv.Value.Type == 10 && inv.Value.ItemID == m_itemID)
162 { 159 {
163 invItemID=inv.Key; 160 invItemID = inv.Key;
164 break; 161 break;
165 } 162 }
166 } 163 }
@@ -350,7 +347,6 @@ namespace OpenSim.Region.ScriptEngine.Common
350 return angle; 347 return angle;
351 } 348 }
352 349
353
354 // Old implementation of llRot2Euler, now normalized 350 // Old implementation of llRot2Euler, now normalized
355 351
356 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r) 352 public LSL_Types.Vector3 llRot2Euler(LSL_Types.Quaternion r)
@@ -441,8 +437,8 @@ namespace OpenSim.Region.ScriptEngine.Common
441 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up) 437 public LSL_Types.Quaternion llAxes2Rot(LSL_Types.Vector3 fwd, LSL_Types.Vector3 left, LSL_Types.Vector3 up)
442 { 438 {
443 m_host.AddScriptLPS(1); 439 m_host.AddScriptLPS(1);
444 double x,y,z,s; 440 double x, y, z, s;
445 int f=0; 441 int f = 0;
446 // Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s> 442 // Important Note: q1=<x,y,z,s> is equal to q2=<-x,-y,-z,-s>
447 // Computing quaternion x,y,z,s values 443 // Computing quaternion x,y,z,s values
448 x = ((fwd.x - left.y - up.z + 1) / 4); 444 x = ((fwd.x - left.y - up.z + 1) / 4);
@@ -459,9 +455,9 @@ namespace OpenSim.Region.ScriptEngine.Common
459 s = Math.Sqrt(Math.Sqrt(s)); 455 s = Math.Sqrt(Math.Sqrt(s));
460 456
461 // Set f for signs detection 457 // Set f for signs detection
462 if (fwd.y+left.x >= 0){f+=1;} 458 if (fwd.y + left.x >= 0) { f += 1; }
463 if (fwd.z+up.x >= 0){f+=2;} 459 if (fwd.z + up.x >= 0) { f += 2; }
464 if (left.z-up.y >= 0){f+=4;} 460 if (left.z - up.y >= 0) { f += 4; }
465 // Set correct quaternion signs based on f value 461 // Set correct quaternion signs based on f value
466 if (f == 0) { x = -x; } 462 if (f == 0) { x = -x; }
467 if (f == 1) { x = -x; y = -y; } 463 if (f == 1) { x = -x; y = -y; }
@@ -549,7 +545,7 @@ namespace OpenSim.Region.ScriptEngine.Common
549 545
550 // Fast Algebric Calculations instead of Vectors & Quaternions Product 546 // Fast Algebric Calculations instead of Vectors & Quaternions Product
551 x = 2 * (r.x * r.z + r.y * r.s); 547 x = 2 * (r.x * r.z + r.y * r.s);
552 y = 2*(-r.x * r.s + r.y * r.z); 548 y = 2 * (-r.x * r.s + r.y * r.z);
553 z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s; 549 z = -r.x * r.x - r.y * r.y + r.z * r.z + r.s * r.s;
554 return (new LSL_Types.Vector3(x, y, z)); 550 return (new LSL_Types.Vector3(x, y, z));
555 } 551 }
@@ -571,6 +567,10 @@ namespace OpenSim.Region.ScriptEngine.Common
571 public void llWhisper(int channelID, string text) 567 public void llWhisper(int channelID, string text)
572 { 568 {
573 m_host.AddScriptLPS(1); 569 m_host.AddScriptLPS(1);
570
571 if (text.Length > 1023)
572 text = text.Substring(0, 1023);
573
574 World.SimChat(Helpers.StringToField(text), 574 World.SimChat(Helpers.StringToField(text),
575 ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); 575 ChatTypeEnum.Whisper, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
576 576
@@ -581,6 +581,10 @@ namespace OpenSim.Region.ScriptEngine.Common
581 public void llSay(int channelID, string text) 581 public void llSay(int channelID, string text)
582 { 582 {
583 m_host.AddScriptLPS(1); 583 m_host.AddScriptLPS(1);
584
585 if (text.Length > 1023)
586 text = text.Substring(0, 1023);
587
584 World.SimChat(Helpers.StringToField(text), 588 World.SimChat(Helpers.StringToField(text),
585 ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); 589 ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
586 590
@@ -591,8 +595,12 @@ namespace OpenSim.Region.ScriptEngine.Common
591 public void llShout(int channelID, string text) 595 public void llShout(int channelID, string text)
592 { 596 {
593 m_host.AddScriptLPS(1); 597 m_host.AddScriptLPS(1);
598
599 if (text.Length > 1023)
600 text = text.Substring(0, 1023);
601
594 World.SimChat(Helpers.StringToField(text), 602 World.SimChat(Helpers.StringToField(text),
595 ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false); 603 ChatTypeEnum.Shout, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, true);
596 604
597 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 605 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
598 wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text); 606 wComm.DeliverMessage(ChatTypeEnum.Shout, channelID, m_host.Name, m_host.UUID, text);
@@ -606,6 +614,9 @@ namespace OpenSim.Region.ScriptEngine.Common
606 return; 614 return;
607 } 615 }
608 616
617 if (text.Length > 1023)
618 text = text.Substring(0, 1023);
619
609 m_host.AddScriptLPS(1); 620 m_host.AddScriptLPS(1);
610 621
611 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 622 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
@@ -637,7 +648,7 @@ namespace OpenSim.Region.ScriptEngine.Common
637 648
638 public void llSensor(string name, string id, int type, double range, double arc) 649 public void llSensor(string name, string id, int type, double range, double arc)
639 { 650 {
640 m_host.AddScriptLPS(300); 651 m_host.AddScriptLPS(1);
641 LLUUID keyID = LLUUID.Zero; 652 LLUUID keyID = LLUUID.Zero;
642 LLUUID.TryParse(id, out keyID); 653 LLUUID.TryParse(id, out keyID);
643 654
@@ -651,7 +662,7 @@ namespace OpenSim.Region.ScriptEngine.Common
651 LLUUID.TryParse(id, out keyID); 662 LLUUID.TryParse(id, out keyID);
652 663
653 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host); 664 m_ScriptEngine.m_ASYNCLSLCommandManager.m_SensorRepeat.SetSenseRepeatEvent(m_localID, m_itemID, name, keyID, type, range, arc, rate, m_host);
654 } 665 }
655 666
656 public void llSensorRemove() 667 public void llSensorRemove()
657 { 668 {
@@ -685,7 +696,6 @@ namespace OpenSim.Region.ScriptEngine.Common
685 if (SensedObject == null) 696 if (SensedObject == null)
686 return String.Empty; 697 return String.Empty;
687 return SensedObject.Name; 698 return SensedObject.Name;
688
689 } 699 }
690 700
691 public string llDetectedName(int number) 701 public string llDetectedName(int number)
@@ -821,7 +831,6 @@ namespace OpenSim.Region.ScriptEngine.Common
821 LLUUID SensedUUID = uuidDetectedKey(number); 831 LLUUID SensedUUID = uuidDetectedKey(number);
822 if (SensedUUID == LLUUID.Zero) 832 if (SensedUUID == LLUUID.Zero)
823 return String.Empty; 833 return String.Empty;
824
825 return SensedUUID.ToString(); 834 return SensedUUID.ToString();
826 } 835 }
827 836
@@ -869,7 +878,6 @@ namespace OpenSim.Region.ScriptEngine.Common
869 mask |= 0x02; // active moving 878 mask |= 0x02; // active moving
870 if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ... 879 if (SensedObject is IScript) mask |= 0x08; // Scripted. It COULD have one hidden ...
871 return mask; 880 return mask;
872
873 } 881 }
874 882
875 public LSL_Types.Vector3 llDetectedPos(int number) 883 public LSL_Types.Vector3 llDetectedPos(int number)
@@ -878,7 +886,6 @@ namespace OpenSim.Region.ScriptEngine.Common
878 EntityBase SensedObject = entityDetectedKey(number); 886 EntityBase SensedObject = entityDetectedKey(number);
879 if (SensedObject == null) 887 if (SensedObject == null)
880 return new LSL_Types.Vector3(0, 0, 0); 888 return new LSL_Types.Vector3(0, 0, 0);
881
882 return new LSL_Types.Vector3(SensedObject.AbsolutePosition.X,SensedObject.AbsolutePosition.Y,SensedObject.AbsolutePosition.Z); 889 return new LSL_Types.Vector3(SensedObject.AbsolutePosition.X,SensedObject.AbsolutePosition.Y,SensedObject.AbsolutePosition.Z);
883 } 890 }
884 891
@@ -888,7 +895,6 @@ namespace OpenSim.Region.ScriptEngine.Common
888 EntityBase SensedObject = entityDetectedKey(number); 895 EntityBase SensedObject = entityDetectedKey(number);
889 if (SensedObject == null) 896 if (SensedObject == null)
890 return new LSL_Types.Vector3(0, 0, 0); 897 return new LSL_Types.Vector3(0, 0, 0);
891
892 return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z); 898 return new LSL_Types.Vector3(SensedObject.Velocity.X, SensedObject.Velocity.Y, SensedObject.Velocity.Z);
893 } 899 }
894 900
@@ -911,7 +917,6 @@ namespace OpenSim.Region.ScriptEngine.Common
911 EntityBase SensedObject = entityDetectedKey(number); 917 EntityBase SensedObject = entityDetectedKey(number);
912 if (SensedObject == null) 918 if (SensedObject == null)
913 return new LSL_Types.Quaternion(); 919 return new LSL_Types.Quaternion();
914
915 return new LSL_Types.Quaternion(SensedObject.Rotation.x, SensedObject.Rotation.y, SensedObject.Rotation.z, SensedObject.Rotation.w); 920 return new LSL_Types.Quaternion(SensedObject.Rotation.x, SensedObject.Rotation.y, SensedObject.Rotation.z, SensedObject.Rotation.w);
916 } 921 }
917 922
@@ -986,8 +991,8 @@ namespace OpenSim.Region.ScriptEngine.Common
986 } 991 }
987 else 992 else
988 m_host.ScriptSetPhysicsStatus(false); 993 m_host.ScriptSetPhysicsStatus(false);
989
990 } 994 }
995
991 if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM) 996 if ((status & BuiltIn_Commands_BaseClass.STATUS_PHANTOM) == BuiltIn_Commands_BaseClass.STATUS_PHANTOM)
992 { 997 {
993 if (value == 1) 998 if (value == 1)
@@ -995,27 +1000,32 @@ namespace OpenSim.Region.ScriptEngine.Common
995 else 1000 else
996 m_host.ScriptSetPhantomStatus(false); 1001 m_host.ScriptSetPhantomStatus(false);
997 } 1002 }
1003
998 if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) 1004 if ((status & BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS) == BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS)
999 { 1005 {
1000 m_host.AddFlag(LLObject.ObjectFlags.CastShadows); 1006 m_host.AddFlag(LLObject.ObjectFlags.CastShadows);
1001 } 1007 }
1008
1002 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) 1009 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_X) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_X)
1003 { 1010 {
1004 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X; 1011 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_X;
1005
1006 } 1012 }
1013
1007 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) 1014 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y)
1008 { 1015 {
1009 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y; 1016 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y;
1010 } 1017 }
1018
1011 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) 1019 if ((status & BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z) == BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z)
1012 { 1020 {
1013 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z; 1021 statusrotationaxis |= BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z;
1014 } 1022 }
1023
1015 if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) 1024 if ((status & BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB) == BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB)
1016 { 1025 {
1017 NotImplemented("llSetStatus - STATUS_BLOCK_GRAB"); 1026 NotImplemented("llSetStatus - STATUS_BLOCK_GRAB");
1018 } 1027 }
1028
1019 if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) 1029 if ((status & BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE)
1020 { 1030 {
1021 if (value == 1) 1031 if (value == 1)
@@ -1023,18 +1033,20 @@ namespace OpenSim.Region.ScriptEngine.Common
1023 else 1033 else
1024 m_host.SetDieAtEdge(false); 1034 m_host.SetDieAtEdge(false);
1025 } 1035 }
1036
1026 if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) 1037 if ((status & BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE) == BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE)
1027 { 1038 {
1028 NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE"); 1039 NotImplemented("llSetStatus - STATUS_RETURN_AT_EDGE");
1029 } 1040 }
1041
1030 if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX) 1042 if ((status & BuiltIn_Commands_BaseClass.STATUS_SANDBOX) == BuiltIn_Commands_BaseClass.STATUS_SANDBOX)
1031 { 1043 {
1032 NotImplemented("llSetStatus - STATUS_SANDBOX"); 1044 NotImplemented("llSetStatus - STATUS_SANDBOX");
1033 } 1045 }
1046
1034 if (statusrotationaxis != 0) 1047 if (statusrotationaxis != 0)
1035 { 1048 {
1036 m_host.SetAxisRotation(statusrotationaxis, value); 1049 m_host.SetAxisRotation(statusrotationaxis, value);
1037
1038 } 1050 }
1039 } 1051 }
1040 1052
@@ -1050,23 +1062,26 @@ namespace OpenSim.Region.ScriptEngine.Common
1050 return 1; 1062 return 1;
1051 } 1063 }
1052 return 0; 1064 return 0;
1065
1053 case BuiltIn_Commands_BaseClass.STATUS_PHANTOM: 1066 case BuiltIn_Commands_BaseClass.STATUS_PHANTOM:
1054 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom) 1067 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Phantom) == (uint)LLObject.ObjectFlags.Phantom)
1055 { 1068 {
1056 return 1; 1069 return 1;
1057 } 1070 }
1058 return 0; 1071 return 0;
1072
1059 case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS: 1073 case BuiltIn_Commands_BaseClass.STATUS_CAST_SHADOWS:
1060 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows) 1074 if ((m_host.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.CastShadows) == (uint)LLObject.ObjectFlags.CastShadows)
1061 { 1075 {
1062 return 1; 1076 return 1;
1063 } 1077 }
1064 return 0; 1078 return 0;
1079
1065 case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB: 1080 case BuiltIn_Commands_BaseClass.STATUS_BLOCK_GRAB:
1066 NotImplemented("llGetStatus - STATUS_BLOCK_GRAB"); 1081 NotImplemented("llGetStatus - STATUS_BLOCK_GRAB");
1067 return 0; 1082 return 0;
1068 case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE:
1069 1083
1084 case BuiltIn_Commands_BaseClass.STATUS_DIE_AT_EDGE:
1070 if (m_host.GetDieAtEdge()) 1085 if (m_host.GetDieAtEdge())
1071 return 1; 1086 return 1;
1072 else 1087 else
@@ -1075,15 +1090,19 @@ namespace OpenSim.Region.ScriptEngine.Common
1075 case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE: 1090 case BuiltIn_Commands_BaseClass.STATUS_RETURN_AT_EDGE:
1076 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE"); 1091 NotImplemented("llGetStatus - STATUS_RETURN_AT_EDGE");
1077 return 0; 1092 return 0;
1093
1078 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X: 1094 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_X:
1079 NotImplemented("llGetStatus - STATUS_ROTATE_X"); 1095 NotImplemented("llGetStatus - STATUS_ROTATE_X");
1080 return 0; 1096 return 0;
1097
1081 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y: 1098 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Y:
1082 NotImplemented("llGetStatus - STATUS_ROTATE_Y"); 1099 NotImplemented("llGetStatus - STATUS_ROTATE_Y");
1083 return 0; 1100 return 0;
1101
1084 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z: 1102 case BuiltIn_Commands_BaseClass.STATUS_ROTATE_Z:
1085 NotImplemented("llGetStatus - STATUS_ROTATE_Z"); 1103 NotImplemented("llGetStatus - STATUS_ROTATE_Z");
1086 return 0; 1104 return 0;
1105
1087 case BuiltIn_Commands_BaseClass.STATUS_SANDBOX: 1106 case BuiltIn_Commands_BaseClass.STATUS_SANDBOX:
1088 NotImplemented("llGetStatus - STATUS_SANDBOX"); 1107 NotImplemented("llGetStatus - STATUS_SANDBOX");
1089 return 0; 1108 return 0;
@@ -1179,103 +1198,103 @@ namespace OpenSim.Region.ScriptEngine.Common
1179 1198
1180 public void SetGlow(SceneObjectPart part, int face, float glow) 1199 public void SetGlow(SceneObjectPart part, int face, float glow)
1181 { 1200 {
1182 LLObject.TextureEntry tex = part.Shape.Textures; 1201 LLObject.TextureEntry tex = part.Shape.Textures;
1183 if (face > -1) 1202 if (face > -1)
1184 { 1203 {
1185 tex.CreateFace((uint)face); 1204 tex.CreateFace((uint) face);
1186 tex.FaceTextures[face].Glow = glow; 1205 tex.FaceTextures[face].Glow = glow;
1187 part.UpdateTexture(tex); 1206 part.UpdateTexture(tex);
1188 return; 1207 return;
1189 } 1208 }
1190 else if (face == -1) 1209 else if (face == -1)
1191 { 1210 {
1192 for (uint i = 0; i < 32; i++) 1211 for (uint i = 0; i < 32; i++)
1193 { 1212 {
1194 if (tex.FaceTextures[i] != null) 1213 if (tex.FaceTextures[i] != null)
1195 { 1214 {
1196 tex.FaceTextures[i].Glow = glow; 1215 tex.FaceTextures[i].Glow = glow;
1197 } 1216 }
1198 tex.DefaultTexture.Glow = glow; 1217 tex.DefaultTexture.Glow = glow;
1199 } 1218 }
1200 part.UpdateTexture(tex); 1219 part.UpdateTexture(tex);
1201 return; 1220 return;
1202 } 1221 }
1203 } 1222 }
1204 1223
1205 public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump) 1224 public void SetShiny(SceneObjectPart part, int face, int shiny, Bumpiness bump)
1206 { 1225 {
1207 1226
1208 Shininess sval = new Shininess(); 1227 Shininess sval = new Shininess();
1209 1228
1210 switch (shiny) 1229 switch (shiny)
1211 { 1230 {
1212 case 0: 1231 case 0:
1213 sval = Shininess.None; 1232 sval = Shininess.None;
1214 break; 1233 break;
1215 case 1: 1234 case 1:
1216 sval = Shininess.Low; 1235 sval = Shininess.Low;
1217 break; 1236 break;
1218 case 2: 1237 case 2:
1219 sval = Shininess.Medium; 1238 sval = Shininess.Medium;
1220 break; 1239 break;
1221 case 3: 1240 case 3:
1222 sval = Shininess.High; 1241 sval = Shininess.High;
1223 break; 1242 break;
1224 default: 1243 default:
1225 sval = Shininess.None; 1244 sval = Shininess.None;
1226 break; 1245 break;
1227 } 1246 }
1228 1247
1229 LLObject.TextureEntry tex = part.Shape.Textures; 1248 LLObject.TextureEntry tex = part.Shape.Textures;
1230 if (face > -1) 1249 if (face > -1)
1231 { 1250 {
1232 tex.CreateFace((uint)face); 1251 tex.CreateFace((uint) face);
1233 tex.FaceTextures[face].Shiny = sval; 1252 tex.FaceTextures[face].Shiny = sval;
1234 tex.FaceTextures[face].Bump = bump; 1253 tex.FaceTextures[face].Bump = bump;
1235 part.UpdateTexture(tex); 1254 part.UpdateTexture(tex);
1236 return; 1255 return;
1237 } 1256 }
1238 else if (face == -1) 1257 else if (face == -1)
1239 { 1258 {
1240 for (uint i = 0; i < 32; i++) 1259 for (uint i = 0; i < 32; i++)
1241 { 1260 {
1242 if (tex.FaceTextures[i] != null) 1261 if (tex.FaceTextures[i] != null)
1243 { 1262 {
1244 tex.FaceTextures[i].Shiny = sval; 1263 tex.FaceTextures[i].Shiny = sval;
1245 tex.FaceTextures[i].Bump = bump; ; 1264 tex.FaceTextures[i].Bump = bump;;
1246 } 1265 }
1247 tex.DefaultTexture.Shiny = sval; 1266 tex.DefaultTexture.Shiny = sval;
1248 tex.DefaultTexture.Bump = bump; 1267 tex.DefaultTexture.Bump = bump;
1249 } 1268 }
1250 part.UpdateTexture(tex); 1269 part.UpdateTexture(tex);
1251 return; 1270 return;
1252 } 1271 }
1253 } 1272 }
1254 1273
1255 public void SetFullBright(SceneObjectPart part, int face, bool bright) 1274 public void SetFullBright(SceneObjectPart part, int face, bool bright)
1256 { 1275 {
1257 LLObject.TextureEntry tex = part.Shape.Textures; 1276 LLObject.TextureEntry tex = part.Shape.Textures;
1258 if (face > -1) 1277 if (face > -1)
1259 { 1278 {
1260 tex.CreateFace((uint)face); 1279 tex.CreateFace((uint) face);
1261 tex.FaceTextures[face].Fullbright = bright; 1280 tex.FaceTextures[face].Fullbright = bright;
1262 part.UpdateTexture(tex); 1281 part.UpdateTexture(tex);
1263 return; 1282 return;
1264 } 1283 }
1265 else if (face == -1) 1284 else if (face == -1)
1266 { 1285 {
1267 for (uint i = 0; i < 32; i++) 1286 for (uint i = 0; i < 32; i++)
1268 { 1287 {
1269 if (tex.FaceTextures[i] != null) 1288 if (tex.FaceTextures[i] != null)
1270 { 1289 {
1271 tex.FaceTextures[i].Fullbright = bright; 1290 tex.FaceTextures[i].Fullbright = bright;
1272 } 1291 }
1273 } 1292 }
1274 tex.DefaultTexture.Fullbright = bright; 1293 tex.DefaultTexture.Fullbright = bright;
1275 part.UpdateTexture(tex); 1294 part.UpdateTexture(tex);
1276 return; 1295 return;
1277 } 1296 }
1278 } 1297 }
1279 1298
1280 public double llGetAlpha(int face) 1299 public double llGetAlpha(int face)
1281 { 1300 {
@@ -1426,8 +1445,6 @@ namespace OpenSim.Region.ScriptEngine.Common
1426 part.ScheduleFullUpdate(); 1445 part.ScheduleFullUpdate();
1427 } 1446 }
1428 1447
1429
1430
1431 public LSL_Types.Vector3 llGetColor(int face) 1448 public LSL_Types.Vector3 llGetColor(int face)
1432 { 1449 {
1433 m_host.AddScriptLPS(1); 1450 m_host.AddScriptLPS(1);
@@ -1460,6 +1477,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1460 { 1477 {
1461 m_host.AddScriptLPS(1); 1478 m_host.AddScriptLPS(1);
1462 SetTexture(m_host, texture, face); 1479 SetTexture(m_host, texture, face);
1480 // ScriptSleep(200);
1463 } 1481 }
1464 1482
1465 private void SetTexture(SceneObjectPart part, string texture, int face) 1483 private void SetTexture(SceneObjectPart part, string texture, int face)
@@ -1504,6 +1522,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1504 m_host.AddScriptLPS(1); 1522 m_host.AddScriptLPS(1);
1505 1523
1506 ScaleTexture(m_host, u, v, face); 1524 ScaleTexture(m_host, u, v, face);
1525 // ScriptSleep(200);
1507 } 1526 }
1508 1527
1509 private void ScaleTexture(SceneObjectPart part, double u, double v, int face) 1528 private void ScaleTexture(SceneObjectPart part, double u, double v, int face)
@@ -1539,6 +1558,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1539 { 1558 {
1540 m_host.AddScriptLPS(1); 1559 m_host.AddScriptLPS(1);
1541 OffsetTexture(m_host, u, v, face); 1560 OffsetTexture(m_host, u, v, face);
1561 // ScriptSleep(200);
1542 } 1562 }
1543 1563
1544 private void OffsetTexture(SceneObjectPart part, double u, double v, int face) 1564 private void OffsetTexture(SceneObjectPart part, double u, double v, int face)
@@ -1574,6 +1594,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1574 { 1594 {
1575 m_host.AddScriptLPS(1); 1595 m_host.AddScriptLPS(1);
1576 RotateTexture(m_host, rotation, face); 1596 RotateTexture(m_host, rotation, face);
1597 // ScriptSleep(200);
1577 } 1598 }
1578 1599
1579 private void RotateTexture(SceneObjectPart part, double rotation, int face) 1600 private void RotateTexture(SceneObjectPart part, double rotation, int face)
@@ -1628,19 +1649,25 @@ namespace OpenSim.Region.ScriptEngine.Common
1628 1649
1629 SetPos(m_host, pos); 1650 SetPos(m_host, pos);
1630 1651
1631 // sleep for 0.2 seconds
1632 ScriptSleep(200); 1652 ScriptSleep(200);
1633 } 1653 }
1634 1654
1635 private void SetPos(SceneObjectPart part, LSL_Types.Vector3 pos) 1655 private void SetPos(SceneObjectPart part, LSL_Types.Vector3 targetPos)
1636 { 1656 {
1657 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
1658 LSL_Types.Vector3 currentPos = llGetLocalPos();
1659 if (llVecDist(currentPos, targetPos) > 10)
1660 {
1661 targetPos = currentPos + 10 * llVecNorm(targetPos - currentPos);
1662 }
1663
1637 if (part.ParentID != 0) 1664 if (part.ParentID != 0)
1638 { 1665 {
1639 part.UpdateOffSet(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); 1666 part.UpdateOffSet(new LLVector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z));
1640 } 1667 }
1641 else 1668 else
1642 { 1669 {
1643 part.UpdateGroupPosition(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); 1670 part.UpdateGroupPosition(new LLVector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z));
1644 } 1671 }
1645 } 1672 }
1646 1673
@@ -1675,7 +1702,6 @@ namespace OpenSim.Region.ScriptEngine.Common
1675 1702
1676 SetRot(m_host, rot); 1703 SetRot(m_host, rot);
1677 1704
1678 // sleep for 0.2 seconds
1679 ScriptSleep(200); 1705 ScriptSleep(200);
1680 } 1706 }
1681 1707
@@ -1954,6 +1980,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1954 { 1980 {
1955 m_host.AddScriptLPS(1); 1981 m_host.AddScriptLPS(1);
1956 m_host.PreloadSound(sound); 1982 m_host.PreloadSound(sound);
1983 // ScriptSleep(1000);
1957 } 1984 }
1958 1985
1959 /// <summary> 1986 /// <summary>
@@ -2237,24 +2264,28 @@ namespace OpenSim.Region.ScriptEngine.Common
2237 { 2264 {
2238 m_host.AddScriptLPS(1); 2265 m_host.AddScriptLPS(1);
2239 Deprecated("llMakeExplosion"); 2266 Deprecated("llMakeExplosion");
2267 // ScriptSleep(100);
2240 } 2268 }
2241 2269
2242 public void llMakeFountain() 2270 public void llMakeFountain()
2243 { 2271 {
2244 m_host.AddScriptLPS(1); 2272 m_host.AddScriptLPS(1);
2245 Deprecated("llMakeFountain"); 2273 Deprecated("llMakeFountain");
2274 // ScriptSleep(100);
2246 } 2275 }
2247 2276
2248 public void llMakeSmoke() 2277 public void llMakeSmoke()
2249 { 2278 {
2250 m_host.AddScriptLPS(1); 2279 m_host.AddScriptLPS(1);
2251 Deprecated("llMakeSmoke"); 2280 Deprecated("llMakeSmoke");
2281 // ScriptSleep(100);
2252 } 2282 }
2253 2283
2254 public void llMakeFire() 2284 public void llMakeFire()
2255 { 2285 {
2256 m_host.AddScriptLPS(1); 2286 m_host.AddScriptLPS(1);
2257 Deprecated("llMakeFire"); 2287 Deprecated("llMakeFire");
2288 // ScriptSleep(100);
2258 } 2289 }
2259 2290
2260 public void llRezAtRoot(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param) 2291 public void llRezAtRoot(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param)
@@ -2305,8 +2336,9 @@ namespace OpenSim.Region.ScriptEngine.Common
2305 //Recoil. 2336 //Recoil.
2306 llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); 2337 llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
2307 found = true; 2338 found = true;
2308 //script delay 2339 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2309 ScriptSleep((int)((groupmass * velmag) / 10)); 2340 ScriptSleep((int)((groupmass * velmag) / 10));
2341 // ScriptSleep(100);
2310 break; 2342 break;
2311 } 2343 }
2312 } 2344 }
@@ -2340,8 +2372,8 @@ namespace OpenSim.Region.ScriptEngine.Common
2340 2372
2341 public void llSleep(double sec) 2373 public void llSleep(double sec)
2342 { 2374 {
2343 m_host.AddScriptLPS((int)(sec * 100)); 2375 m_host.AddScriptLPS(1);
2344 System.Threading.Thread.Sleep((int)(sec * 1000)); 2376 Thread.Sleep((int)(sec * 1000));
2345 } 2377 }
2346 2378
2347 public double llGetMass() 2379 public double llGetMass()
@@ -2460,8 +2492,8 @@ namespace OpenSim.Region.ScriptEngine.Common
2460 msg.fromAgentSession = new Guid(friendTransactionID.ToString());// fromAgentSession.UUID; 2492 msg.fromAgentSession = new Guid(friendTransactionID.ToString());// fromAgentSession.UUID;
2461 msg.toAgentID = new Guid(user); // toAgentID.UUID; 2493 msg.toAgentID = new Guid(user); // toAgentID.UUID;
2462 msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here 2494 msg.imSessionID = new Guid(friendTransactionID.ToString()); // This is the item we're mucking with here
2463 Console.WriteLine("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message); 2495// Console.WriteLine("[Scripting IM]: From:" + msg.fromAgentID.ToString() + " To: " + msg.toAgentID.ToString() + " Session:" + msg.imSessionID.ToString() + " Message:" + message);
2464 Console.WriteLine("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString()); 2496// Console.WriteLine("[Scripting IM]: Filling Session: " + msg.imSessionID.ToString());
2465 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp; 2497 msg.timestamp = (uint)Util.UnixTimeSinceEpoch();// timestamp;
2466 //if (client != null) 2498 //if (client != null)
2467 //{ 2499 //{
@@ -2480,6 +2512,8 @@ namespace OpenSim.Region.ScriptEngine.Common
2480 msg.RegionID = World.RegionInfo.RegionID.UUID;//RegionID.UUID; 2512 msg.RegionID = World.RegionInfo.RegionID.UUID;//RegionID.UUID;
2481 msg.binaryBucket = new byte[0];// binaryBucket; 2513 msg.binaryBucket = new byte[0];// binaryBucket;
2482 World.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); 2514 World.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
2515 // ScriptSleep(2000);
2516
2483 // NotImplemented("llInstantMessage"); 2517 // NotImplemented("llInstantMessage");
2484 } 2518 }
2485 2519
@@ -2491,6 +2525,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2491 return; 2525 return;
2492 2526
2493 emailModule.SendEmail(m_host.UUID, address, subject, message); 2527 emailModule.SendEmail(m_host.UUID, address, subject, message);
2528 // ScriptSleep(20000);
2494 } 2529 }
2495 2530
2496 public void llGetNextEmail(string address, string subject) 2531 public void llGetNextEmail(string address, string subject)
@@ -2914,7 +2949,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2914 SceneObjectGroup parentPrim = null, childPrim = null; 2949 SceneObjectGroup parentPrim = null, childPrim = null;
2915 if (targetPart != null) 2950 if (targetPart != null)
2916 { 2951 {
2917 if (parent == BuiltIn_Commands_BaseClass.TRUE) { 2952 if (parent != 0) {
2918 parentPrim = m_host.ParentGroup; 2953 parentPrim = m_host.ParentGroup;
2919 childPrim = targetPart.ParentGroup; 2954 childPrim = targetPart.ParentGroup;
2920 } 2955 }
@@ -2932,9 +2967,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2932 parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected); 2967 parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected);
2933 parentPrim.GetProperties(client); 2968 parentPrim.GetProperties(client);
2934 2969
2935 // sleep for 1 second
2936 ScriptSleep(1000); 2970 ScriptSleep(1000);
2937
2938 } 2971 }
2939 2972
2940 public void llBreakLink(int linknum) 2973 public void llBreakLink(int linknum)
@@ -3096,6 +3129,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3096 // destination is an object 3129 // destination is an object
3097 World.MoveTaskInventoryItem(destId, m_host, objId); 3130 World.MoveTaskInventoryItem(destId, m_host, objId);
3098 } 3131 }
3132 // ScriptSleep(3000);
3099 } 3133 }
3100 3134
3101 public void llRemoveInventory(string name) 3135 public void llRemoveInventory(string name)
@@ -3134,12 +3168,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3134 { 3168 {
3135 m_host.AddScriptLPS(1); 3169 m_host.AddScriptLPS(1);
3136 NotImplemented("llRequestAgentData"); 3170 NotImplemented("llRequestAgentData");
3171 // ScriptSleep(100);
3137 return String.Empty; 3172 return String.Empty;
3138 } 3173 }
3139 3174
3140 public string llRequestInventoryData(string name) 3175 public string llRequestInventoryData(string name)
3141 { 3176 {
3142 m_host.AddScriptLPS(1); 3177 m_host.AddScriptLPS(1);
3178
3143 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 3179 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
3144 { 3180 {
3145 if (item.Type == 3 && item.Name == name) 3181 if (item.Type == 3 && item.Name == name)
@@ -3167,9 +3203,11 @@ namespace OpenSim.Region.ScriptEngine.Common
3167 reply); 3203 reply);
3168 }, false); 3204 }, false);
3169 3205
3206 // ScriptSleep(1000);
3170 return tid.ToString(); 3207 return tid.ToString();
3171 } 3208 }
3172 } 3209 }
3210 // ScriptSleep(1000);
3173 return String.Empty; 3211 return String.Empty;
3174 } 3212 }
3175 3213
@@ -3193,6 +3231,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3193 World.TeleportClientHome(agentId, presence.ControllingClient); 3231 World.TeleportClientHome(agentId, presence.ControllingClient);
3194 } 3232 }
3195 } 3233 }
3234 // ScriptSleep(5000);
3196 } 3235 }
3197 3236
3198 public void llModifyLand(int action, int brush) 3237 public void llModifyLand(int action, int brush)
@@ -3256,7 +3295,6 @@ namespace OpenSim.Region.ScriptEngine.Common
3256 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3295 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
3257 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj 3296 partLocalID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj
3258 ); 3297 );
3259
3260 } 3298 }
3261 } 3299 }
3262 3300
@@ -3363,7 +3401,6 @@ namespace OpenSim.Region.ScriptEngine.Common
3363 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 3401 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
3364 m_localID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj 3402 m_localID, partItemID, "link_message", EventQueueManager.llDetectNull, resobj
3365 ); 3403 );
3366
3367 } 3404 }
3368 } 3405 }
3369 3406
@@ -3437,12 +3474,12 @@ namespace OpenSim.Region.ScriptEngine.Common
3437 return result; 3474 return result;
3438 3475
3439 } 3476 }
3477
3440 // this function to understand which shape it is (taken from meshmerizer) 3478 // this function to understand which shape it is (taken from meshmerizer)
3441 // quite useful can be used by meshmerizer to have a centralized point of understanding the shape 3479 // quite useful can be used by meshmerizer to have a centralized point of understanding the shape
3442 // except that it refers to scripting constants 3480 // except that it refers to scripting constants
3443 private int getScriptPrimType(PrimitiveBaseShape primShape) 3481 private int getScriptPrimType(PrimitiveBaseShape primShape)
3444 { 3482 {
3445
3446 if (primShape.SculptEntry) 3483 if (primShape.SculptEntry)
3447 return BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT; 3484 return BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT;
3448 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) 3485 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
@@ -3473,9 +3510,8 @@ namespace OpenSim.Region.ScriptEngine.Common
3473 return BuiltIn_Commands_BaseClass.PRIM_TYPE_RING; 3510 return BuiltIn_Commands_BaseClass.PRIM_TYPE_RING;
3474 } 3511 }
3475 return BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX; 3512 return BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX;
3476
3477
3478 } 3513 }
3514
3479 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces 3515 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces
3480 private void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, 3516 private void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
3481 out bool hasDimple, out bool hasProfileCut) 3517 out bool hasDimple, out bool hasProfileCut)
@@ -3553,10 +3589,10 @@ namespace OpenSim.Region.ScriptEngine.Common
3553 ret = 1; 3589 ret = 1;
3554 break; 3590 break;
3555 } 3591 }
3556
3557 return ret; 3592 return ret;
3558 } 3593 }
3559 3594
3595
3560 /* The new / changed functions were tested with the following LSL script: 3596 /* The new / changed functions were tested with the following LSL script:
3561 3597
3562 default 3598 default
@@ -3714,7 +3750,6 @@ namespace OpenSim.Region.ScriptEngine.Common
3714 m_host.ParentGroup.RootPart.AllowedDrop = true; 3750 m_host.ParentGroup.RootPart.AllowedDrop = true;
3715 else 3751 else
3716 m_host.ParentGroup.RootPart.AllowedDrop = false; 3752 m_host.ParentGroup.RootPart.AllowedDrop = false;
3717
3718 } 3753 }
3719 3754
3720 public LSL_Types.Vector3 llGetSunDirection() 3755 public LSL_Types.Vector3 llGetSunDirection()
@@ -4069,16 +4104,16 @@ namespace OpenSim.Region.ScriptEngine.Common
4069 { 4104 {
4070 switch (src[i]) 4105 switch (src[i])
4071 { 4106 {
4072 case '<' : 4107 case '<':
4073 parens++; 4108 parens++;
4074 length++; 4109 length++;
4075 break; 4110 break;
4076 case '>' : 4111 case '>':
4077 if (parens > 0) 4112 if (parens > 0)
4078 parens--; 4113 parens--;
4079 length++; 4114 length++;
4080 break; 4115 break;
4081 case ',' : 4116 case ',':
4082 if (parens == 0) 4117 if (parens == 0)
4083 { 4118 {
4084 result.Add(src.Substring(start,length).Trim()); 4119 result.Add(src.Substring(start,length).Trim());
@@ -4090,7 +4125,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4090 length++; 4125 length++;
4091 } 4126 }
4092 break; 4127 break;
4093 default : 4128 default:
4094 length++; 4129 length++;
4095 break; 4130 break;
4096 } 4131 }
@@ -4099,7 +4134,6 @@ namespace OpenSim.Region.ScriptEngine.Common
4099 result.Add(src.Substring(start,length).Trim()); 4134 result.Add(src.Substring(start,length).Trim());
4100 4135
4101 return result; 4136 return result;
4102
4103 } 4137 }
4104 4138
4105 /// <summary> 4139 /// <summary>
@@ -4115,7 +4149,6 @@ namespace OpenSim.Region.ScriptEngine.Common
4115 4149
4116 public LSL_Types.list llListRandomize(LSL_Types.list src, int stride) 4150 public LSL_Types.list llListRandomize(LSL_Types.list src, int stride)
4117 { 4151 {
4118
4119 LSL_Types.list result; 4152 LSL_Types.list result;
4120 Random rand = new Random(); 4153 Random rand = new Random();
4121 4154
@@ -4174,7 +4207,6 @@ namespace OpenSim.Region.ScriptEngine.Common
4174 } 4207 }
4175 4208
4176 return result; 4209 return result;
4177
4178 } 4210 }
4179 4211
4180 /// <summary> 4212 /// <summary>
@@ -4398,6 +4430,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4398 { 4430 {
4399 m_host.AddScriptLPS(1); 4431 m_host.AddScriptLPS(1);
4400 m_host.AdjustSoundGain(volume); 4432 m_host.AdjustSoundGain(volume);
4433 // ScriptSleep(100);
4401 } 4434 }
4402 4435
4403 public void llSetSoundQueueing(int queue) 4436 public void llSetSoundQueueing(int queue)
@@ -4550,81 +4583,6 @@ namespace OpenSim.Region.ScriptEngine.Common
4550 return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); 4583 return World.GetLandOwner((float)pos.x, (float)pos.y).ToString();
4551 } 4584 }
4552 4585
4553 public string llGetNotecardLine(string name, int line)
4554 {
4555 m_host.AddScriptLPS(1);
4556
4557 // TODO: this script function should actually return
4558 // the requested notecard line via the dataserver event
4559 // once it is implemented - krtaylor
4560
4561 String[] notecardLines = GetNotecardLines(name);
4562
4563 line--; // array starts at 0
4564 if ((!String.IsNullOrEmpty(notecardLines[0])) &&
4565 (line >= 0) &&
4566 (line < notecardLines.Length))
4567 {
4568 return notecardLines[line];
4569 }
4570 else
4571 {
4572 return String.Empty;
4573 }
4574 }
4575
4576 private String[] GetNotecardLines(string name)
4577 {
4578 // bool found = false;
4579 int notecardIndex = 0;
4580 String[] notecardLines = { "0" };
4581 notecardLines[0] = String.Empty;
4582
4583 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
4584 {
4585 if ((inv.Value.Name == name) && (inv.Value.InvType == (int)InventoryType.Notecard))
4586 {
4587 // OK, it has the right name and it is a notecard
4588 // so get the asset that contains the notecard raw data
4589 // and convert it into a string
4590 AssetBase notecardAsset = World.AssetCache.GetAsset(inv.Value.AssetID, false);
4591 String dataString = System.Text.Encoding.ASCII.GetString(notecardAsset.Data);
4592
4593 if (!String.IsNullOrEmpty(dataString))
4594 {
4595 // good, we have the notecard data as a string
4596 // now parse the text lines using the Linden Text delimiters
4597 notecardIndex = dataString.IndexOf("}\nText length ");
4598 if (notecardIndex > 0)
4599 {
4600 notecardIndex = notecardIndex + 2; //get past delimiter
4601 notecardIndex = dataString.IndexOf("\n", notecardIndex);
4602 if (notecardIndex > 0)
4603 {
4604 // Finally got to the first line of the notecard
4605 // now find the end of the notecard text delimited by }<LF>
4606 // parse the lines, delimited by <LF>
4607 notecardIndex = dataString.IndexOf("\n", notecardIndex);
4608 notecardIndex++; // get past delimiter
4609
4610 int notecardLength = dataString.Length - notecardIndex - 3;
4611
4612 // create new string to parse that only consists of the actual lines in the asset
4613 Char[] notecardCharArray = dataString.ToCharArray(notecardIndex, notecardLength);
4614 String notecardString = new String(notecardCharArray);
4615
4616 // split the lines of the notecard into separate strings
4617 char[] delimChar = { '\n' };
4618 notecardLines = notecardString.Split(delimChar);
4619 return notecardLines;
4620 }
4621 }
4622 }
4623 }
4624 }
4625 return notecardLines;
4626 }
4627
4628 public LSL_Types.Vector3 llGetAgentSize(string id) 4586 public LSL_Types.Vector3 llGetAgentSize(string id)
4629 { 4587 {
4630 m_host.AddScriptLPS(1); 4588 m_host.AddScriptLPS(1);
@@ -5071,6 +5029,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5071 land.ParcelAccessList.Add(entry); 5029 land.ParcelAccessList.Add(entry);
5072 } 5030 }
5073 } 5031 }
5032 // ScriptSleep(100);
5074 } 5033 }
5075 5034
5076 public void llSetTouchText(string text) 5035 public void llSetTouchText(string text)
@@ -5158,6 +5117,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5158 buts[i] = buttons.Data[i].ToString(); 5117 buts[i] = buttons.Data[i].ToString();
5159 } 5118 }
5160 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); 5119 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
5120 // ScriptSleep(1000);
5161 } 5121 }
5162 5122
5163 public void llVolumeDetect(int detect) 5123 public void llVolumeDetect(int detect)
@@ -5232,12 +5192,12 @@ namespace OpenSim.Region.ScriptEngine.Common
5232 { 5192 {
5233 m_host.AddScriptLPS(1); 5193 m_host.AddScriptLPS(1);
5234 Deprecated("llRemoteLoadScript"); 5194 Deprecated("llRemoteLoadScript");
5195 // ScriptSleep(3000);
5235 } 5196 }
5236 5197
5237 public void llSetRemoteScriptAccessPin(int pin) 5198 public void llSetRemoteScriptAccessPin(int pin)
5238 { 5199 {
5239 m_host.AddScriptLPS(1); 5200 m_host.AddScriptLPS(1);
5240
5241 m_host.ScriptAccessPin = pin; 5201 m_host.ScriptAccessPin = pin;
5242 } 5202 }
5243 5203
@@ -5287,11 +5247,6 @@ namespace OpenSim.Region.ScriptEngine.Common
5287 ScriptSleep(3000); 5247 ScriptSleep(3000);
5288 } 5248 }
5289 5249
5290 // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval)
5291 // Not sure where these constants should live:
5292 // REMOTE_DATA_CHANNEL = 1
5293 // REMOTE_DATA_REQUEST = 2
5294 // REMOTE_DATA_REPLY = 3
5295 public void llOpenRemoteDataChannel() 5250 public void llOpenRemoteDataChannel()
5296 { 5251 {
5297 m_host.AddScriptLPS(1); 5252 m_host.AddScriptLPS(1);
@@ -5302,12 +5257,14 @@ namespace OpenSim.Region.ScriptEngine.Common
5302 object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) }; 5257 object[] resobj = new object[] { new LSL_Types.LSLInteger(1), new LSL_Types.LSLString(channelID.ToString()), new LSL_Types.LSLString(LLUUID.Zero.ToString()), new LSL_Types.LSLString(String.Empty), new LSL_Types.LSLInteger(0), new LSL_Types.LSLString(String.Empty) };
5303 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj); 5258 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(m_localID, m_itemID, "remote_data", EventQueueManager.llDetectNull, resobj);
5304 } 5259 }
5260 // ScriptSleep(1000);
5305 } 5261 }
5306 5262
5307 public string llSendRemoteData(string channel, string dest, int idata, string sdata) 5263 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
5308 { 5264 {
5309 m_host.AddScriptLPS(1); 5265 m_host.AddScriptLPS(1);
5310 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 5266 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
5267 // ScriptSleep(3000);
5311 return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); 5268 return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString();
5312 } 5269 }
5313 5270
@@ -5316,6 +5273,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5316 m_host.AddScriptLPS(1); 5273 m_host.AddScriptLPS(1);
5317 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 5274 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
5318 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); 5275 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
5276 // ScriptSleep(3000);
5319 } 5277 }
5320 5278
5321 public void llCloseRemoteDataChannel(string channel) 5279 public void llCloseRemoteDataChannel(string channel)
@@ -5323,6 +5281,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5323 m_host.AddScriptLPS(1); 5281 m_host.AddScriptLPS(1);
5324 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 5282 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
5325 xmlrpcMod.CloseXMLRPCChannel(channel); 5283 xmlrpcMod.CloseXMLRPCChannel(channel);
5284 // ScriptSleep(1000);
5326 } 5285 }
5327 5286
5328 public string llMD5String(string src, int nonce) 5287 public string llMD5String(string src, int nonce)
@@ -5900,7 +5859,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5900 break; 5859 break;
5901 case (int)BuiltIn_Commands_BaseClass.PRIM_GLOW: 5860 case (int)BuiltIn_Commands_BaseClass.PRIM_GLOW:
5902 if (remain < 2) 5861 if (remain < 2)
5903 return; 5862 return;
5904 face = Convert.ToInt32(rules.Data[idx++]); 5863 face = Convert.ToInt32(rules.Data[idx++]);
5905 float glow = (float)Convert.ToDouble(rules.Data[idx++]); 5864 float glow = (float)Convert.ToDouble(rules.Data[idx++]);
5906 5865
@@ -5909,7 +5868,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5909 break; 5868 break;
5910 case (int)BuiltIn_Commands_BaseClass.PRIM_BUMP_SHINY: 5869 case (int)BuiltIn_Commands_BaseClass.PRIM_BUMP_SHINY:
5911 if (remain < 3) 5870 if (remain < 3)
5912 return; 5871 return;
5913 face = Convert.ToInt32(rules.Data[idx++]); 5872 face = Convert.ToInt32(rules.Data[idx++]);
5914 int shiny = Convert.ToInt32(rules.Data[idx++]); 5873 int shiny = Convert.ToInt32(rules.Data[idx++]);
5915 Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]); 5874 Bumpiness bump = (Bumpiness)Convert.ToByte(rules.Data[idx++]);
@@ -5918,58 +5877,58 @@ namespace OpenSim.Region.ScriptEngine.Common
5918 5877
5919 break; 5878 break;
5920 case (int)BuiltIn_Commands_BaseClass.PRIM_FULLBRIGHT: 5879 case (int)BuiltIn_Commands_BaseClass.PRIM_FULLBRIGHT:
5921 if (remain < 2) 5880 if (remain < 2)
5922 return; 5881 return;
5923 face = Convert.ToInt32(rules.Data[idx++]); 5882 face = Convert.ToInt32(rules.Data[idx++]);
5924 string bv = rules.Data[idx++].ToString(); 5883 string bv = rules.Data[idx++].ToString();
5925 bool st; 5884 bool st;
5926 if (bv.Equals("1")) 5885 if (bv.Equals("1"))
5927 st = true; 5886 st = true;
5928 else 5887 else
5929 st = false; 5888 st = false;
5930 5889
5931 SetFullBright(part, face, st); 5890 SetFullBright(part, face , st);
5932 break; 5891 break;
5933 case (int)BuiltIn_Commands_BaseClass.PRIM_MATERIAL: 5892 case (int)BuiltIn_Commands_BaseClass.PRIM_MATERIAL:
5934 if (remain < 1) 5893 if (remain < 1)
5935 return; 5894 return;
5936 if (part != null) 5895 if (part != null)
5937 { 5896 {
5938 /* Unhandled at this time - sends "Unhandled" message 5897 /* Unhandled at this time - sends "Unhandled" message
5939 will enable when available 5898 will enable when available
5940 byte material = (byte)Convert.ToByte( rules.Data[idx++]); 5899 byte material = (byte)Convert.ToByte( rules.Data[idx++]);
5941 part.Material = material; 5900 part.Material = material;
5942 */ 5901 */
5943 return; 5902 return;
5944 } 5903 }
5945 break; 5904 break;
5946 case (int)BuiltIn_Commands_BaseClass.PRIM_PHANTOM: 5905 case (int)BuiltIn_Commands_BaseClass.PRIM_PHANTOM:
5947 if (remain < 1) 5906 if (remain < 1)
5948 return; 5907 return;
5949 5908
5950 string ph = rules.Data[idx++].ToString(); 5909 string ph = rules.Data[idx++].ToString();
5951 bool phantom; 5910 bool phantom;
5952 5911
5953 if (ph.Equals("1")) 5912 if (ph.Equals("1"))
5954 phantom = true; 5913 phantom = true;
5955 else 5914 else
5956 phantom = false; 5915 phantom = false;
5957 5916
5958 part.ScriptSetPhantomStatus(phantom); 5917 part.ScriptSetPhantomStatus(phantom);
5959 part.ScheduleFullUpdate(); 5918 part.ScheduleFullUpdate();
5960 break; 5919 break;
5961 case (int)BuiltIn_Commands_BaseClass.PRIM_PHYSICS: 5920 case (int)BuiltIn_Commands_BaseClass.PRIM_PHYSICS:
5962 if (remain < 1) 5921 if (remain < 1)
5963 return; 5922 return;
5964 string phy = rules.Data[idx++].ToString(); 5923 string phy = rules.Data[idx++].ToString();
5965 bool physics; 5924 bool physics;
5966 5925
5967 if (phy.Equals("1")) 5926 if (phy.Equals("1"))
5968 physics = true; 5927 physics = true;
5969 else 5928 else
5970 physics = false; 5929 physics = false;
5971 5930
5972 m_host.ScriptSetPhysicsStatus(physics); 5931 m_host.ScriptSetPhysicsStatus(physics);
5973 part.ScheduleFullUpdate(); 5932 part.ScheduleFullUpdate();
5974 break; 5933 break;
5975 } 5934 }
@@ -6016,6 +5975,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6016 { 5975 {
6017 m_host.AddScriptLPS(1); 5976 m_host.AddScriptLPS(1);
6018 Deprecated("llXorBase64Strings"); 5977 Deprecated("llXorBase64Strings");
5978 // ScriptSleep(300);
6019 } 5979 }
6020 5980
6021 public void llRemoteDataSetRegion() 5981 public void llRemoteDataSetRegion()
@@ -6064,6 +6024,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6064 return; 6024 return;
6065 } 6025 }
6066 World.SetLandMusicURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url); 6026 World.SetLandMusicURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url);
6027 // ScriptSleep(2000);
6067 } 6028 }
6068 6029
6069 public void osSetParcelMediaURL(string url) 6030 public void osSetParcelMediaURL(string url)
@@ -6203,25 +6164,6 @@ namespace OpenSim.Region.ScriptEngine.Common
6203 return m_host.ParentGroup.PrimCount; 6164 return m_host.ParentGroup.PrimCount;
6204 } 6165 }
6205 6166
6206 public int llGetNumberOfNotecardLines(string name)
6207 {
6208 m_host.AddScriptLPS(1);
6209
6210 // TODO: this script function should actually return
6211 // the number of lines via the dataserver event
6212 // once it is implemented - krtaylor
6213
6214 String[] notecardLines = GetNotecardLines(name);
6215 if (!String.IsNullOrEmpty(notecardLines[0]))
6216 {
6217 return notecardLines.Length;
6218 }
6219 else
6220 {
6221 return 0;
6222 }
6223 }
6224
6225 public LSL_Types.list llGetBoundingBox(string obj) 6167 public LSL_Types.list llGetBoundingBox(string obj)
6226 { 6168 {
6227 m_host.AddScriptLPS(1); 6169 m_host.AddScriptLPS(1);
@@ -6292,22 +6234,20 @@ namespace OpenSim.Region.ScriptEngine.Common
6292 break; 6234 break;
6293 6235
6294 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE: 6236 case (int)BuiltIn_Commands_BaseClass.PRIM_TYPE:
6295
6296 // implementing box 6237 // implementing box
6297 PrimitiveBaseShape Shape=m_host.Shape; 6238 PrimitiveBaseShape Shape = m_host.Shape;
6298 int primType=getScriptPrimType(m_host.Shape); 6239 int primType = getScriptPrimType(m_host.Shape);
6299 res.Add(new LSL_Types.LSLInteger(primType)); 6240 res.Add(new LSL_Types.LSLInteger(primType));
6300 switch(primType) 6241 switch (primType)
6301 { 6242 {
6302 case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX: 6243 case BuiltIn_Commands_BaseClass.PRIM_TYPE_BOX:
6303 case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER: 6244 case BuiltIn_Commands_BaseClass.PRIM_TYPE_CYLINDER:
6304 case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM: 6245 case BuiltIn_Commands_BaseClass.PRIM_TYPE_PRISM:
6305
6306 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); 6246 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6307 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 6247 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6308 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); 6248 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6309 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0,Shape.PathTwist / 100.0,0)); 6249 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6310 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0-1), 1 - (Shape.PathScaleY / 100.0-1), 0)); 6250 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
6311 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); 6251 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
6312 break; 6252 break;
6313 6253
@@ -6317,24 +6257,21 @@ namespace OpenSim.Region.ScriptEngine.Common
6317 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); 6257 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6318 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 6258 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6319 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 6259 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6320
6321 break; 6260 break;
6322 6261
6323
6324
6325 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT: 6262 case BuiltIn_Commands_BaseClass.PRIM_TYPE_SCULPT:
6326 res.Add(Shape.SculptTexture.ToString()); 6263 res.Add(Shape.SculptTexture.ToString());
6327 res.Add(new LSL_Types.LSLInteger(Shape.SculptType)); 6264 res.Add(new LSL_Types.LSLInteger(Shape.SculptType));
6328
6329 break; 6265 break;
6266
6330 case BuiltIn_Commands_BaseClass.PRIM_TYPE_RING: 6267 case BuiltIn_Commands_BaseClass.PRIM_TYPE_RING:
6331 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE: 6268 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TUBE:
6332 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS: 6269 case BuiltIn_Commands_BaseClass.PRIM_TYPE_TORUS:
6333 // holeshape 6270 // holeshape
6334 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); 6271 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6335 6272
6336 // cut 6273 // cut
6337 res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0)); 6274 res.Add(new LSL_Types.Vector3(Shape.PathBegin / 50000.0, 1 - Shape.PathEnd / 50000.0, 0));
6338 6275
6339 // hollow 6276 // hollow
6340 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); 6277 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
@@ -6344,29 +6281,27 @@ namespace OpenSim.Region.ScriptEngine.Common
6344 6281
6345 // vector holesize 6282 // vector holesize
6346 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); 6283 res.Add(new LSL_Types.Vector3(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
6347 6284
6348 // vector topshear 6285 // vector topshear
6349 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); 6286 res.Add(new LSL_Types.Vector3(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0));
6350 6287
6351 // vector profilecut 6288 // vector profilecut
6352 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin/ 50000.0, 1 - Shape.ProfileEnd / 50000.0,0)); 6289 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6353 6290
6354 6291
6355 // vector tapera 6292 // vector tapera
6356 res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0,Shape.PathTaperY / 100.0,0)); 6293 res.Add(new LSL_Types.Vector3(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
6357 6294
6358 // float revolutions, 6295 // float revolutions,
6359 res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions/50.0)); // needs fixing :( 6296 res.Add(new LSL_Types.LSLFloat(Shape.PathRevolutions / 50.0)); // needs fixing :(
6360 6297
6361 // float radiusoffset, 6298 // float radiusoffset,
6362 res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset/100.0)); 6299 res.Add(new LSL_Types.LSLFloat(Shape.PathRadiusOffset / 100.0));
6363 6300
6364 // float skew 6301 // float skew
6365 res.Add(new LSL_Types.LSLFloat(Shape.PathSkew/100.0)); 6302 res.Add(new LSL_Types.LSLFloat(Shape.PathSkew / 100.0));
6366 break; 6303 break;
6367
6368 6304
6369
6370 } 6305 }
6371 break; 6306 break;
6372 6307
@@ -6374,7 +6309,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6374 if (remain < 1) 6309 if (remain < 1)
6375 return res; 6310 return res;
6376 6311
6377 int face=Convert.ToInt32(""+rules.Data[idx++]); 6312 int face = Convert.ToInt32("" + rules.Data[idx++]);
6378 if (face == -1) 6313 if (face == -1)
6379 face = 0; 6314 face = 0;
6380 6315
@@ -6395,7 +6330,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6395 if (remain < 1) 6330 if (remain < 1)
6396 return res; 6331 return res;
6397 6332
6398 face=Convert.ToInt32(""+rules.Data[idx++]); 6333 face=Convert.ToInt32("" + rules.Data[idx++]);
6399 6334
6400 tex = m_host.Shape.Textures; 6335 tex = m_host.Shape.Textures;
6401 LLColor texcolor; 6336 LLColor texcolor;
@@ -6753,6 +6688,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6753 { 6688 {
6754 m_host.AddScriptLPS(1); 6689 m_host.AddScriptLPS(1);
6755 m_host.RotationOffset = new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); 6690 m_host.RotationOffset = new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
6691 // ScriptSleep(200);
6756 } 6692 }
6757 6693
6758 // <summary> 6694 // <summary>
@@ -6872,7 +6808,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6872 if (active[j]) 6808 if (active[j])
6873 { 6809 {
6874 // scan all of the markers 6810 // scan all of the markers
6875 if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1) 6811 if ((offset[j] = src.IndexOf((string)spcarray[j-seplen], beginning)) == -1)
6876 { 6812 {
6877 // not present at all 6813 // not present at all
6878 active[j] = false; 6814 active[j] = false;
@@ -6896,7 +6832,7 @@ namespace OpenSim.Region.ScriptEngine.Common
6896 { 6832 {
6897 // no markers were found on this pass 6833 // no markers were found on this pass
6898 // so we're pretty much done 6834 // so we're pretty much done
6899 tokens.Add(src.Substring(beginning, srclen-beginning)); 6835 tokens.Add(src.Substring(beginning, srclen - beginning));
6900 break; 6836 break;
6901 } 6837 }
6902 6838
@@ -6907,14 +6843,13 @@ namespace OpenSim.Region.ScriptEngine.Common
6907 6843
6908 if (best < seplen) 6844 if (best < seplen)
6909 { 6845 {
6910 beginning = offset[best]+((string)separray[best]).Length; 6846 beginning = offset[best] + ((string)separray[best]).Length;
6911 } 6847 }
6912 else 6848 else
6913 { 6849 {
6914 beginning = offset[best]+((string)spcarray[best-seplen]).Length; 6850 beginning = offset[best] + ((string)spcarray[best - seplen]).Length;
6915 tokens.Add(spcarray[best-seplen]); 6851 tokens.Add(spcarray[best - seplen]);
6916 } 6852 }
6917
6918 } 6853 }
6919 6854
6920 // This an awkward an not very intuitive boundary case. If the 6855 // This an awkward an not very intuitive boundary case. If the
@@ -7053,65 +6988,78 @@ namespace OpenSim.Region.ScriptEngine.Common
7053 public void llOwnerSay(string msg) 6988 public void llOwnerSay(string msg)
7054 { 6989 {
7055 m_host.AddScriptLPS(1); 6990 m_host.AddScriptLPS(1);
7056 World.SimChatBroadcast(Helpers.StringToField(msg),
7057 ChatTypeEnum.Owner, 0, m_host.AbsolutePosition,
7058 m_host.Name, m_host.UUID, false);
7059 6991
7060 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); 6992 World.SimChatBroadcast(Helpers.StringToField(msg), ChatTypeEnum.Owner, 0, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
7061 wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg); 6993// IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
6994// wComm.DeliverMessage(ChatTypeEnum.Owner, 0, m_host.Name, m_host.UUID, msg);
7062 } 6995 }
7063 6996
7064 public string llRequestSimulatorData(string simulator, int data) 6997 public string llRequestSimulatorData(string simulator, int data)
7065 { 6998 {
7066 m_host.AddScriptLPS(1); 6999 try
7000 {
7001 m_host.AddScriptLPS(1);
7067 7002
7068 string reply = String.Empty; 7003 string reply = String.Empty;
7069 7004
7070 RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator); 7005 RegionInfo info = m_ScriptEngine.World.RequestClosestRegion(simulator);
7071 7006
7072 switch (data) 7007 switch (data)
7073 { 7008 {
7074 case 5: // DATA_SIM_POS 7009 case 5: // DATA_SIM_POS
7075 if (info == null) 7010 if (info == null)
7076 return LLUUID.Zero.ToString(); 7011 {
7077 reply = new LSL_Types.Vector3( 7012 // ScriptSleep(1000);
7078 info.RegionLocX * Constants.RegionSize, 7013 return LLUUID.Zero.ToString();
7079 info.RegionLocY * Constants.RegionSize, 7014 }
7080 0).ToString(); 7015 reply = new LSL_Types.Vector3(
7081 break; 7016 info.RegionLocX * Constants.RegionSize,
7082 case 6: // DATA_SIM_STATUS 7017 info.RegionLocY * Constants.RegionSize,
7083 if (info != null) 7018 0).ToString();
7084 reply = "up"; // Duh! 7019 break;
7085 else 7020 case 6: // DATA_SIM_STATUS
7086 reply = "unknown"; 7021 if (info != null)
7087 break; 7022 reply = "up"; // Duh!
7088 case 7: // DATA_SIM_RATING 7023 else
7089 if (info == null) 7024 reply = "unknown";
7090 return LLUUID.Zero.ToString(); 7025 break;
7091 int access = info.RegionSettings.Maturity; 7026 case 7: // DATA_SIM_RATING
7092 if (access == 0) 7027 if (info == null)
7093 reply = "PG"; 7028 {
7094 else if (access == 1) 7029 // ScriptSleep(1000);
7095 reply = "MATURE"; 7030 return LLUUID.Zero.ToString();
7096 else 7031 }
7097 reply = "UNKNOWN"; 7032 int access = info.RegionSettings.Maturity;
7098 break; 7033 if (access == 0)
7099 case 128: // SIM_RELEASE 7034 reply = "PG";
7100 reply = m_ScriptEngine.World.GetSimulatorVersion(); 7035 else if (access == 1)
7101 break; 7036 reply = "MATURE";
7102 default: 7037 else
7103 return LLUUID.Zero.ToString(); // Raise no event 7038 reply = "UNKNOWN";
7104 } 7039 break;
7105 LLUUID rq = LLUUID.Random(); 7040 case 128: // SIM_RELEASE
7041 reply = m_ScriptEngine.World.GetSimulatorVersion();
7042 break;
7043 default:
7044 // ScriptSleep(1000);
7045 return LLUUID.Zero.ToString(); // Raise no event
7046 }
7047 LLUUID rq = LLUUID.Random();
7106 7048
7107 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager. 7049 LLUUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.
7108 m_Dataserver.RegisterRequest(m_localID, 7050 m_Dataserver.RegisterRequest(m_localID, m_itemID, rq.ToString());
7109 m_itemID, rq.ToString());
7110 7051
7111 m_ScriptEngine.m_ASYNCLSLCommandManager. 7052 m_ScriptEngine.m_ASYNCLSLCommandManager.
7112 m_Dataserver.DataserverReply(rq.ToString(), reply); 7053 m_Dataserver.DataserverReply(rq.ToString(), reply);
7113 7054
7114 return tid.ToString(); 7055 // ScriptSleep(1000);
7056 return tid.ToString();
7057 }
7058 catch(Exception e)
7059 {
7060 Console.WriteLine(e.ToString());
7061 return LLUUID.Zero.ToString();
7062 }
7115 } 7063 }
7116 7064
7117 public void llForceMouselook(int mouselook) 7065 public void llForceMouselook(int mouselook)
@@ -7145,7 +7093,6 @@ namespace OpenSim.Region.ScriptEngine.Common
7145 7093
7146 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end) 7094 public LSL_Types.list llListReplaceList(LSL_Types.list dest, LSL_Types.list src, int start, int end)
7147 { 7095 {
7148
7149 LSL_Types.list pref = null; 7096 LSL_Types.list pref = null;
7150 7097
7151 m_host.AddScriptLPS(1); 7098 m_host.AddScriptLPS(1);
@@ -7175,9 +7122,9 @@ namespace OpenSim.Region.ScriptEngine.Common
7175 pref = dest.GetSublist(0,start-1); 7122 pref = dest.GetSublist(0,start-1);
7176 // Only add a suffix if there is something 7123 // Only add a suffix if there is something
7177 // beyond the end index (it's inclusive too). 7124 // beyond the end index (it's inclusive too).
7178 if (end+1 < dest.Length) 7125 if (end + 1 < dest.Length)
7179 { 7126 {
7180 return pref + src + dest.GetSublist(end+1,-1); 7127 return pref + src + dest.GetSublist(end + 1, -1);
7181 } 7128 }
7182 else 7129 else
7183 { 7130 {
@@ -7192,9 +7139,9 @@ namespace OpenSim.Region.ScriptEngine.Common
7192 // is removed. 7139 // is removed.
7193 else 7140 else
7194 { 7141 {
7195 if (end+1 < dest.Length) 7142 if (end + 1 < dest.Length)
7196 { 7143 {
7197 return src + dest.GetSublist(end+1,-1); 7144 return src + dest.GetSublist(end + 1, -1);
7198 } 7145 }
7199 else 7146 else
7200 { 7147 {
@@ -7210,7 +7157,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7210 // might have been negative. 7157 // might have been negative.
7211 else 7158 else
7212 { 7159 {
7213 return dest.GetSublist(end+1,start-1)+src; 7160 return dest.GetSublist(end + 1, start - 1) + src;
7214 } 7161 }
7215 } 7162 }
7216 7163
@@ -7220,6 +7167,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7220 LLUUID avatarId = new LLUUID(avatar_id); 7167 LLUUID avatarId = new LLUUID(avatar_id);
7221 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, 7168 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message,
7222 url); 7169 url);
7170 // ScriptSleep(10000);
7223 } 7171 }
7224 7172
7225 public void llParcelMediaCommandList(LSL_Types.list commandList) 7173 public void llParcelMediaCommandList(LSL_Types.list commandList)
@@ -7306,7 +7254,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7306 }//end switch 7254 }//end switch
7307 7255
7308 } 7256 }
7309 7257 // ScriptSleep(2000);
7310 7258
7311 //NotImplemented("llParcelMediaCommandList"); 7259 //NotImplemented("llParcelMediaCommandList");
7312 } 7260 }
@@ -7346,8 +7294,8 @@ namespace OpenSim.Region.ScriptEngine.Common
7346 7294
7347 } 7295 }
7348 } 7296 }
7297 // ScriptSleep(2000);
7349 return list; 7298 return list;
7350
7351 } 7299 }
7352 7300
7353 public LSL_Types.LSLInteger llModPow(int a, int b, int c) 7301 public LSL_Types.LSLInteger llModPow(int a, int b, int c)
@@ -7355,6 +7303,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7355 m_host.AddScriptLPS(1); 7303 m_host.AddScriptLPS(1);
7356 Int64 tmp = 0; 7304 Int64 tmp = 0;
7357 Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); 7305 Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
7306 // ScriptSleep(1000);
7358 return Convert.ToInt32(tmp); 7307 return Convert.ToInt32(tmp);
7359 } 7308 }
7360 7309
@@ -7420,12 +7369,14 @@ namespace OpenSim.Region.ScriptEngine.Common
7420 { 7369 {
7421 m_host.AddScriptLPS(1); 7370 m_host.AddScriptLPS(1);
7422 NotImplemented("llSetPrimURL"); 7371 NotImplemented("llSetPrimURL");
7372 // ScriptSleep(2000);
7423 } 7373 }
7424 7374
7425 public void llRefreshPrimURL() 7375 public void llRefreshPrimURL()
7426 { 7376 {
7427 m_host.AddScriptLPS(1); 7377 m_host.AddScriptLPS(1);
7428 NotImplemented("llRefreshPrimURL"); 7378 NotImplemented("llRefreshPrimURL");
7379 // ScriptSleep(20000);
7429 } 7380 }
7430 7381
7431 public string llEscapeURL(string url) 7382 public string llEscapeURL(string url)
@@ -7458,6 +7409,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7458 { 7409 {
7459 m_host.AddScriptLPS(1); 7410 m_host.AddScriptLPS(1);
7460 NotImplemented("llMapDestination"); 7411 NotImplemented("llMapDestination");
7412 // ScriptSleep(1000);
7461 } 7413 }
7462 7414
7463 public void llAddToLandBanList(string avatar, double hours) 7415 public void llAddToLandBanList(string avatar, double hours)
@@ -7476,6 +7428,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7476 land.ParcelAccessList.Add(entry); 7428 land.ParcelAccessList.Add(entry);
7477 } 7429 }
7478 } 7430 }
7431 // ScriptSleep(100);
7479 } 7432 }
7480 7433
7481 public void llRemoveFromLandPassList(string avatar) 7434 public void llRemoveFromLandPassList(string avatar)
@@ -7497,6 +7450,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7497 } 7450 }
7498 } 7451 }
7499 } 7452 }
7453 // ScriptSleep(100);
7500 } 7454 }
7501 7455
7502 public void llRemoveFromLandBanList(string avatar) 7456 public void llRemoveFromLandBanList(string avatar)
@@ -7518,6 +7472,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7518 } 7472 }
7519 } 7473 }
7520 } 7474 }
7475 // ScriptSleep(100);
7521 } 7476 }
7522 7477
7523 public void llSetCameraParams(LSL_Types.list rules) 7478 public void llSetCameraParams(LSL_Types.list rules)
@@ -7647,7 +7602,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7647 IEstateModule estate = World.RequestModuleInterface<IEstateModule>(); 7602 IEstateModule estate = World.RequestModuleInterface<IEstateModule>();
7648 if (estate == null) 7603 if (estate == null)
7649 return 67108864; 7604 return 67108864;
7650 return estate.GetRegionFlags(); 7605 return (int)estate.GetRegionFlags();
7651 } 7606 }
7652 7607
7653 public string llXorBase64StringsCorrect(string str1, string str2) 7608 public string llXorBase64StringsCorrect(string str1, string str2)
@@ -7725,6 +7680,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7725 } 7680 }
7726 } 7681 }
7727 } 7682 }
7683 // ScriptSleep(100);
7728 } 7684 }
7729 7685
7730 public void llResetLandPassList() 7686 public void llResetLandPassList()
@@ -7741,6 +7697,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7741 } 7697 }
7742 } 7698 }
7743 } 7699 }
7700 // ScriptSleep(100);
7744 } 7701 }
7745 7702
7746 public LSL_Types.LSLInteger llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) 7703 public LSL_Types.LSLInteger llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide)
@@ -7819,6 +7776,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7819 ret.Add(d.Value); 7776 ret.Add(d.Value);
7820 } 7777 }
7821 } 7778 }
7779 // ScriptSleep(2000);
7822 return ret; 7780 return ret;
7823 } 7781 }
7824 7782
@@ -7915,6 +7873,7 @@ namespace OpenSim.Region.ScriptEngine.Common
7915 return; 7873 return;
7916 7874
7917 SetTexture(part, texture, face); 7875 SetTexture(part, texture, face);
7876 // ScriptSleep(200);
7918 } 7877 }
7919 7878
7920 public string llStringTrim(string src, int type) 7879 public string llStringTrim(string src, int type)
@@ -8041,5 +8000,102 @@ namespace OpenSim.Region.ScriptEngine.Common
8041 { 8000 {
8042 throw new Exception("LSL Runtime Error: " + msg); 8001 throw new Exception("LSL Runtime Error: " + msg);
8043 } 8002 }
8003 public int llGetNumberOfNotecardLines(string name)
8004 {
8005 m_host.AddScriptLPS(1);
8006
8007 // TODO: this script function should actually return
8008 // the number of lines via the dataserver event
8009 // once it is implemented - krtaylor
8010
8011 String[] notecardLines = GetNotecardLines(name);
8012 if (!String.IsNullOrEmpty(notecardLines[0]))
8013 {
8014 return notecardLines.Length;
8015 }
8016 else
8017 {
8018 return 0;
8019 }
8020 // ScriptSleep(100);
8021 }
8022
8023 public string llGetNotecardLine(string name, int line)
8024 {
8025 m_host.AddScriptLPS(1);
8026
8027 // TODO: this script function should actually return
8028 // the requested notecard line via the dataserver event
8029 // once it is implemented - krtaylor
8030
8031 String[] notecardLines = GetNotecardLines(name);
8032
8033 line--; // array starts at 0
8034 if ((!String.IsNullOrEmpty(notecardLines[0])) &&
8035 (line >= 0) &&
8036 (line < notecardLines.Length))
8037 {
8038 // ScriptSleep(100);
8039 return notecardLines[line];
8040 }
8041 else
8042 {
8043 // ScriptSleep(100);
8044 return String.Empty;
8045 }
8046 }
8047
8048 private String[] GetNotecardLines(string name)
8049 {
8050 // bool found = false;
8051 int notecardIndex = 0;
8052 String[] notecardLines = { "0" };
8053 notecardLines[0] = String.Empty;
8054
8055 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
8056 {
8057 if ((inv.Value.Name == name) && (inv.Value.InvType == (int)InventoryType.Notecard))
8058 {
8059 // OK, it has the right name and it is a notecard
8060 // so get the asset that contains the notecard raw data
8061 // and convert it into a string
8062 AssetBase notecardAsset = World.AssetCache.GetAsset(inv.Value.AssetID, false);
8063 String dataString = System.Text.Encoding.ASCII.GetString(notecardAsset.Data);
8064
8065 if (!String.IsNullOrEmpty(dataString))
8066 {
8067 // good, we have the notecard data as a string
8068 // now parse the text lines using the Linden Text delimiters
8069 notecardIndex = dataString.IndexOf("}\nText length ");
8070 if (notecardIndex > 0)
8071 {
8072 notecardIndex = notecardIndex + 2; //get past delimiter
8073 notecardIndex = dataString.IndexOf("\n", notecardIndex);
8074 if (notecardIndex > 0)
8075 {
8076 // Finally got to the first line of the notecard
8077 // now find the end of the notecard text delimited by }<LF>
8078 // parse the lines, delimited by <LF>
8079 notecardIndex = dataString.IndexOf("\n", notecardIndex);
8080 notecardIndex++; // get past delimiter
8081
8082 int notecardLength = dataString.Length - notecardIndex - 3;
8083
8084 // create new string to parse that only consists of the actual lines in the asset
8085 Char[] notecardCharArray = dataString.ToCharArray(notecardIndex, notecardLength);
8086 String notecardString = new String(notecardCharArray);
8087
8088 // split the lines of the notecard into separate strings
8089 char[] delimChar = { '\n' };
8090 notecardLines = notecardString.Split(delimChar);
8091 return notecardLines;
8092 }
8093 }
8094 }
8095 }
8096 }
8097 return notecardLines;
8098 }
8099
8044 } 8100 }
8045} 8101}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index c939f74..2b99ce6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -120,20 +120,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
120 throw new EventAbortException(); 120 throw new EventAbortException();
121 } 121 }
122 122
123 public void llSay(int channelID, string text)
124 {
125 m_host.AddScriptLPS(1);
126
127 if (text.Length > 1023)
128 text = text.Substring(0, 1023);
129
130 World.SimChat(Helpers.StringToField(text),
131 ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
132
133 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
134 wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
135 }
136
137 // Extension commands use this: 123 // Extension commands use this:
138 public ICommander GetCommander(string name) 124 public ICommander GetCommander(string name)
139 { 125 {
@@ -569,6 +555,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
569 wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text); 555 wComm.DeliverMessage(ChatTypeEnum.Whisper, channelID, m_host.Name, m_host.UUID, text);
570 } 556 }
571 557
558 public void llSay(int channelID, string text)
559 {
560 m_host.AddScriptLPS(1);
561
562 if (text.Length > 1023)
563 text = text.Substring(0, 1023);
564
565 World.SimChat(Helpers.StringToField(text),
566 ChatTypeEnum.Say, channelID, m_host.AbsolutePosition, m_host.Name, m_host.UUID, false);
567
568 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
569 wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
570 }
571
572 public void llShout(int channelID, string text) 572 public void llShout(int channelID, string text)
573 { 573 {
574 m_host.AddScriptLPS(1); 574 m_host.AddScriptLPS(1);
@@ -1312,6 +1312,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1312 { 1312 {
1313 m_host.AddScriptLPS(1); 1313 m_host.AddScriptLPS(1);
1314 SetTexture(m_host, texture, face); 1314 SetTexture(m_host, texture, face);
1315 // ScriptSleep(200);
1315 } 1316 }
1316 1317
1317 private void SetTexture(SceneObjectPart part, string texture, int face) 1318 private void SetTexture(SceneObjectPart part, string texture, int face)
@@ -1356,6 +1357,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1356 m_host.AddScriptLPS(1); 1357 m_host.AddScriptLPS(1);
1357 1358
1358 ScaleTexture(m_host, u, v, face); 1359 ScaleTexture(m_host, u, v, face);
1360 // ScriptSleep(200);
1359 } 1361 }
1360 1362
1361 private void ScaleTexture(SceneObjectPart part, double u, double v, int face) 1363 private void ScaleTexture(SceneObjectPart part, double u, double v, int face)
@@ -1391,6 +1393,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1391 { 1393 {
1392 m_host.AddScriptLPS(1); 1394 m_host.AddScriptLPS(1);
1393 OffsetTexture(m_host, u, v, face); 1395 OffsetTexture(m_host, u, v, face);
1396 // ScriptSleep(200);
1394 } 1397 }
1395 1398
1396 private void OffsetTexture(SceneObjectPart part, double u, double v, int face) 1399 private void OffsetTexture(SceneObjectPart part, double u, double v, int face)
@@ -1426,6 +1429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1426 { 1429 {
1427 m_host.AddScriptLPS(1); 1430 m_host.AddScriptLPS(1);
1428 RotateTexture(m_host, rotation, face); 1431 RotateTexture(m_host, rotation, face);
1432 // ScriptSleep(200);
1429 } 1433 }
1430 1434
1431 private void RotateTexture(SceneObjectPart part, double rotation, int face) 1435 private void RotateTexture(SceneObjectPart part, double rotation, int face)
@@ -1479,17 +1483,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1479 m_host.AddScriptLPS(1); 1483 m_host.AddScriptLPS(1);
1480 1484
1481 SetPos(m_host, pos); 1485 SetPos(m_host, pos);
1486
1487 ScriptSleep(200);
1482 } 1488 }
1483 1489
1484 private void SetPos(SceneObjectPart part, LSL_Types.Vector3 pos) 1490 private void SetPos(SceneObjectPart part, LSL_Types.Vector3 targetPos)
1485 { 1491 {
1492 // Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
1493 LSL_Types.Vector3 currentPos = llGetLocalPos();
1494 if (llVecDist(currentPos, targetPos) > 10)
1495 {
1496 targetPos = currentPos + 10 * llVecNorm(targetPos - currentPos);
1497 }
1498
1486 if (part.ParentID != 0) 1499 if (part.ParentID != 0)
1487 { 1500 {
1488 part.UpdateOffSet(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); 1501 part.UpdateOffSet(new LLVector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z));
1489 } 1502 }
1490 else 1503 else
1491 { 1504 {
1492 part.UpdateGroupPosition(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); 1505 part.UpdateGroupPosition(new LLVector3((float)targetPos.x, (float)targetPos.y, (float)targetPos.z));
1493 } 1506 }
1494 } 1507 }
1495 1508
@@ -1523,6 +1536,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1523 m_host.AddScriptLPS(1); 1536 m_host.AddScriptLPS(1);
1524 1537
1525 SetRot(m_host, rot); 1538 SetRot(m_host, rot);
1539
1540 ScriptSleep(200);
1526 } 1541 }
1527 1542
1528 private void SetRot(SceneObjectPart part, LSL_Types.Quaternion rot) 1543 private void SetRot(SceneObjectPart part, LSL_Types.Quaternion rot)
@@ -1628,11 +1643,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1628 //No energy force yet 1643 //No energy force yet
1629 1644
1630 if (force.x > 20000) 1645 if (force.x > 20000)
1631 force.x = 20000; 1646 force.x = 20000;
1632 if (force.y > 20000) 1647 if (force.y > 20000)
1633 force.y = 20000; 1648 force.y = 20000;
1634 if (force.z > 20000) 1649 if (force.z > 20000)
1635 force.z = 20000; 1650 force.z = 20000;
1636 1651
1637 m_host.ApplyImpulse(new LLVector3((float)force.x, (float)force.y, (float)force.z), local != 0); 1652 m_host.ApplyImpulse(new LLVector3((float)force.x, (float)force.y, (float)force.z), local != 0);
1638 } 1653 }
@@ -1683,7 +1698,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1683 public double llGetTimeOfDay() 1698 public double llGetTimeOfDay()
1684 { 1699 {
1685 m_host.AddScriptLPS(1); 1700 m_host.AddScriptLPS(1);
1686 return (double) (((DateTime.Now.TimeOfDay.TotalMilliseconds / 1000) % (3600*4))*World.TimeDilation); 1701 return (double)(((DateTime.Now.TimeOfDay.TotalMilliseconds / 1000) % (3600 * 4)) * World.TimeDilation);
1687 } 1702 }
1688 1703
1689 public double llGetWallclock() 1704 public double llGetWallclock()
@@ -1800,6 +1815,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1800 { 1815 {
1801 m_host.AddScriptLPS(1); 1816 m_host.AddScriptLPS(1);
1802 m_host.PreloadSound(sound); 1817 m_host.PreloadSound(sound);
1818 // ScriptSleep(1000);
1803 } 1819 }
1804 1820
1805 /// <summary> 1821 /// <summary>
@@ -2083,30 +2099,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2083 { 2099 {
2084 m_host.AddScriptLPS(1); 2100 m_host.AddScriptLPS(1);
2085 NotImplemented("llMakeExplosion"); 2101 NotImplemented("llMakeExplosion");
2102 // ScriptSleep(100);
2086 } 2103 }
2087 2104
2088 public void llMakeFountain() 2105 public void llMakeFountain()
2089 { 2106 {
2090 m_host.AddScriptLPS(1); 2107 m_host.AddScriptLPS(1);
2091 NotImplemented("llMakeFountain"); 2108 NotImplemented("llMakeFountain");
2109 // ScriptSleep(100);
2092 } 2110 }
2093 2111
2094 public void llMakeSmoke() 2112 public void llMakeSmoke()
2095 { 2113 {
2096 m_host.AddScriptLPS(1); 2114 m_host.AddScriptLPS(1);
2097 NotImplemented("llMakeSmoke"); 2115 NotImplemented("llMakeSmoke");
2116 // ScriptSleep(100);
2098 } 2117 }
2099 2118
2100 public void llMakeFire() 2119 public void llMakeFire()
2101 { 2120 {
2102 m_host.AddScriptLPS(1); 2121 m_host.AddScriptLPS(1);
2103 NotImplemented("llMakeFire"); 2122 NotImplemented("llMakeFire");
2123 // ScriptSleep(100);
2104 } 2124 }
2105 2125
2106 public void llRezAtRoot(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param) 2126 public void llRezAtRoot(string inventory, LSL_Types.Vector3 pos, LSL_Types.Vector3 vel, LSL_Types.Quaternion rot, int param)
2107 { 2127 {
2108 m_host.AddScriptLPS(1); 2128 m_host.AddScriptLPS(1);
2109 //NotImplemented("llRezObject");
2110 bool found = false; 2129 bool found = false;
2111 2130
2112 // Instead of using return;, I'm using continue; because in our TaskInventory implementation 2131 // Instead of using return;, I'm using continue; because in our TaskInventory implementation
@@ -2157,8 +2176,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2157 //Recoil. 2176 //Recoil.
2158 llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0); 2177 llApplyImpulse(new LSL_Types.Vector3(llvel.X * groupmass, llvel.Y * groupmass, llvel.Z * groupmass), 0);
2159 found = true; 2178 found = true;
2160 //script delay 2179 // Variable script delay? (see (http://wiki.secondlife.com/wiki/LSL_Delay)
2161 ScriptSleep((int)((groupmass * velmag) / 10)); 2180 ScriptSleep((int)((groupmass * velmag) / 10));
2181 // ScriptSleep(100);
2162 break; 2182 break;
2163 } 2183 }
2164 } 2184 }
@@ -2332,6 +2352,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2332 msg.RegionID = World.RegionInfo.RegionID.UUID;//RegionID.UUID; 2352 msg.RegionID = World.RegionInfo.RegionID.UUID;//RegionID.UUID;
2333 msg.binaryBucket = new byte[0];// binaryBucket; 2353 msg.binaryBucket = new byte[0];// binaryBucket;
2334 World.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule); 2354 World.TriggerGridInstantMessage(msg, InstantMessageReceiver.IMModule);
2355 // ScriptSleep(2000);
2356
2335 // NotImplemented("llInstantMessage"); 2357 // NotImplemented("llInstantMessage");
2336 } 2358 }
2337 2359
@@ -2343,6 +2365,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2343 return; 2365 return;
2344 2366
2345 emailModule.SendEmail(m_host.UUID, address, subject, message); 2367 emailModule.SendEmail(m_host.UUID, address, subject, message);
2368 // ScriptSleep(20000);
2346 } 2369 }
2347 2370
2348 public void llGetNextEmail(string address, string subject) 2371 public void llGetNextEmail(string address, string subject)
@@ -2813,9 +2836,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2813 parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected); 2836 parentPrim.RootPart.AddFlag(LLObject.ObjectFlags.CreateSelected);
2814 parentPrim.GetProperties(client); 2837 parentPrim.GetProperties(client);
2815 2838
2816 // sleep for 1 second
2817 ScriptSleep(1000); 2839 ScriptSleep(1000);
2818
2819 } 2840 }
2820 2841
2821 public void llBreakLink(int linknum) 2842 public void llBreakLink(int linknum)
@@ -2962,9 +2983,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2962 // destination is an object 2983 // destination is an object
2963 World.MoveTaskInventoryItem(destId, m_host, objId); 2984 World.MoveTaskInventoryItem(destId, m_host, objId);
2964 } 2985 }
2986 // ScriptSleep(3000);
2965 } 2987 }
2966 2988
2967 public void llRemoveInventory(string item) 2989 public void llRemoveInventory(string name)
2968 { 2990 {
2969 m_host.AddScriptLPS(1); 2991 m_host.AddScriptLPS(1);
2970 NotImplemented("llRemoveInventory"); 2992 NotImplemented("llRemoveInventory");
@@ -3040,6 +3062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3040 AsyncCommands. 3062 AsyncCommands.
3041 DataserverPlugin.DataserverReply(rq.ToString(), reply); 3063 DataserverPlugin.DataserverReply(rq.ToString(), reply);
3042 3064
3065 // ScriptSleep(100);
3043 return tid.ToString(); 3066 return tid.ToString();
3044 } 3067 }
3045 3068
@@ -3075,10 +3098,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3075 reply); 3098 reply);
3076 }, false); 3099 }, false);
3077 3100
3101 // ScriptSleep(1000);
3078 return tid.ToString(); 3102 return tid.ToString();
3079 } 3103 }
3080 } 3104 }
3081 3105 // ScriptSleep(1000);
3082 return String.Empty; 3106 return String.Empty;
3083 } 3107 }
3084 3108
@@ -3102,6 +3126,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3102 World.TeleportClientHome(agentId, presence.ControllingClient); 3126 World.TeleportClientHome(agentId, presence.ControllingClient);
3103 } 3127 }
3104 } 3128 }
3129 // ScriptSleep(5000);
3105 } 3130 }
3106 3131
3107 public void llModifyLand(int action, int brush) 3132 public void llModifyLand(int action, int brush)
@@ -3351,7 +3376,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3351 // except that it refers to scripting constants 3376 // except that it refers to scripting constants
3352 private int getScriptPrimType(PrimitiveBaseShape primShape) 3377 private int getScriptPrimType(PrimitiveBaseShape primShape)
3353 { 3378 {
3354
3355 if (primShape.SculptEntry && primShape.SculptType != (byte)0 && primShape.SculptData.Length > 0) 3379 if (primShape.SculptEntry && primShape.SculptType != (byte)0 && primShape.SculptData.Length > 0)
3356 return ScriptBaseClass.PRIM_TYPE_SCULPT; 3380 return ScriptBaseClass.PRIM_TYPE_SCULPT;
3357 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) 3381 if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
@@ -3382,11 +3406,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3382 return ScriptBaseClass.PRIM_TYPE_RING; 3406 return ScriptBaseClass.PRIM_TYPE_RING;
3383 } 3407 }
3384 return ScriptBaseClass.PRIM_TYPE_BOX; 3408 return ScriptBaseClass.PRIM_TYPE_BOX;
3385
3386
3387 } 3409 }
3410
3388 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces 3411 // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces
3389 private void hasCutHollowDimpleProfileCut(int primType,PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, 3412 private void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
3390 out bool hasDimple, out bool hasProfileCut) 3413 out bool hasDimple, out bool hasProfileCut)
3391 { 3414 {
3392 if (primType == ScriptBaseClass.PRIM_TYPE_BOX 3415 if (primType == ScriptBaseClass.PRIM_TYPE_BOX
@@ -3444,25 +3467,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3444 ret = 1; 3467 ret = 1;
3445 if (hasCut) ret += 2; 3468 if (hasCut) ret += 2;
3446 if (hasProfileCut) ret += 2; 3469 if (hasProfileCut) ret += 2;
3447 if (hasHollow) ret += 1; 3470 if (hasHollow) ret += 1;
3448 break; 3471 break;
3449 case ScriptBaseClass.PRIM_TYPE_TUBE: 3472 case ScriptBaseClass.PRIM_TYPE_TUBE:
3450 ret = 4; 3473 ret = 4;
3451 if (hasCut) ret += 2; 3474 if (hasCut) ret += 2;
3452 if (hasProfileCut) ret += 2; 3475 if (hasProfileCut) ret += 2;
3453 if (hasHollow) ret += 1; 3476 if (hasHollow) ret += 1;
3454 break; 3477 break;
3455 case ScriptBaseClass.PRIM_TYPE_RING: 3478 case ScriptBaseClass.PRIM_TYPE_RING:
3456 ret = 3; 3479 ret = 3;
3457 if (hasCut) ret += 2; 3480 if (hasCut) ret += 2;
3458 if (hasProfileCut) ret += 2; 3481 if (hasProfileCut) ret += 2;
3459 if (hasHollow) ret += 1; 3482 if (hasHollow) ret += 1;
3460 break; 3483 break;
3461 case ScriptBaseClass.PRIM_TYPE_SCULPT: 3484 case ScriptBaseClass.PRIM_TYPE_SCULPT:
3462 ret = 1; 3485 ret = 1;
3463 break; 3486 break;
3464 } 3487 }
3465
3466 return ret; 3488 return ret;
3467 } 3489 }
3468 3490
@@ -4050,10 +4072,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4050 chunks[i] = i; 4072 chunks[i] = i;
4051 4073
4052 // Knuth shuffle the chunkk index 4074 // Knuth shuffle the chunkk index
4053 for (int i = chunkk-1; i >= 1; i--) 4075 for (int i = chunkk - 1; i >= 1; i--)
4054 { 4076 {
4055 // Elect an unrandomized chunk to swap 4077 // Elect an unrandomized chunk to swap
4056 int index = rand.Next(i+1); 4078 int index = rand.Next(i + 1);
4057 int tmp; 4079 int tmp;
4058 4080
4059 // and swap position with first unrandomized chunk 4081 // and swap position with first unrandomized chunk
@@ -4304,6 +4326,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4304 { 4326 {
4305 m_host.AddScriptLPS(1); 4327 m_host.AddScriptLPS(1);
4306 m_host.AdjustSoundGain(volume); 4328 m_host.AdjustSoundGain(volume);
4329 // ScriptSleep(100);
4307 } 4330 }
4308 4331
4309 public void llSetSoundQueueing(int queue) 4332 public void llSetSoundQueueing(int queue)
@@ -4902,6 +4925,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4902 land.ParcelAccessList.Add(entry); 4925 land.ParcelAccessList.Add(entry);
4903 } 4926 }
4904 } 4927 }
4928 // ScriptSleep(100);
4905 } 4929 }
4906 4930
4907 public void llSetTouchText(string text) 4931 public void llSetTouchText(string text)
@@ -4989,6 +5013,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4989 buts[i] = buttons.Data[i].ToString(); 5013 buts[i] = buttons.Data[i].ToString();
4990 } 5014 }
4991 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); 5015 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);
5016 // ScriptSleep(1000);
4992 } 5017 }
4993 5018
4994 public void llVolumeDetect(int detect) 5019 public void llVolumeDetect(int detect)
@@ -5037,6 +5062,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5037 { 5062 {
5038 m_host.AddScriptLPS(1); 5063 m_host.AddScriptLPS(1);
5039 Deprecated("llRemoteLoadScript"); 5064 Deprecated("llRemoteLoadScript");
5065 // ScriptSleep(3000);
5040 } 5066 }
5041 5067
5042 public void llSetRemoteScriptAccessPin(int pin) 5068 public void llSetRemoteScriptAccessPin(int pin)
@@ -5049,13 +5075,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5049 { 5075 {
5050 m_host.AddScriptLPS(1); 5076 m_host.AddScriptLPS(1);
5051 NotImplemented("llRemoteLoadScriptPin"); 5077 NotImplemented("llRemoteLoadScriptPin");
5078 ScriptSleep(3000);
5052 } 5079 }
5053 5080
5054 // remote_data(integer type, key channel, key message_id, string sender, integer ival, string sval)
5055 // Not sure where these constants should live:
5056 // REMOTE_DATA_CHANNEL = 1
5057 // REMOTE_DATA_REQUEST = 2
5058 // REMOTE_DATA_REPLY = 3
5059 public void llOpenRemoteDataChannel() 5081 public void llOpenRemoteDataChannel()
5060 { 5082 {
5061 m_host.AddScriptLPS(1); 5083 m_host.AddScriptLPS(1);
@@ -5068,12 +5090,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5068 "remote_data", resobj, 5090 "remote_data", resobj,
5069 new DetectParams[0])); 5091 new DetectParams[0]));
5070 } 5092 }
5093 // ScriptSleep(1000);
5071 } 5094 }
5072 5095
5073 public string llSendRemoteData(string channel, string dest, int idata, string sdata) 5096 public string llSendRemoteData(string channel, string dest, int idata, string sdata)
5074 { 5097 {
5075 m_host.AddScriptLPS(1); 5098 m_host.AddScriptLPS(1);
5076 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 5099 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
5100 // ScriptSleep(3000);
5077 return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString(); 5101 return (xmlrpcMod.SendRemoteData(m_localID, m_itemID, channel, dest, idata, sdata)).ToString();
5078 } 5102 }
5079 5103
@@ -5082,6 +5106,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5082 m_host.AddScriptLPS(1); 5106 m_host.AddScriptLPS(1);
5083 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 5107 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
5084 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); 5108 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
5109 // ScriptSleep(3000);
5085 } 5110 }
5086 5111
5087 public void llCloseRemoteDataChannel(string channel) 5112 public void llCloseRemoteDataChannel(string channel)
@@ -5089,6 +5114,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5089 m_host.AddScriptLPS(1); 5114 m_host.AddScriptLPS(1);
5090 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 5115 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
5091 xmlrpcMod.CloseXMLRPCChannel(channel); 5116 xmlrpcMod.CloseXMLRPCChannel(channel);
5117 // ScriptSleep(1000);
5092 } 5118 }
5093 5119
5094 public string llMD5String(string src, int nonce) 5120 public string llMD5String(string src, int nonce)
@@ -5782,6 +5808,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5782 { 5808 {
5783 m_host.AddScriptLPS(1); 5809 m_host.AddScriptLPS(1);
5784 Deprecated("llXorBase64Strings"); 5810 Deprecated("llXorBase64Strings");
5811 // ScriptSleep(300);
5785 } 5812 }
5786 5813
5787 public void llRemoteDataSetRegion() 5814 public void llRemoteDataSetRegion()
@@ -5830,6 +5857,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5830 return; 5857 return;
5831 } 5858 }
5832 World.SetLandMusicURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url); 5859 World.SetLandMusicURL(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y, url);
5860 // ScriptSleep(2000);
5833 } 5861 }
5834 5862
5835 public void osSetParcelMediaURL(string url) 5863 public void osSetParcelMediaURL(string url)
@@ -6048,7 +6076,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6048 case ScriptBaseClass.PRIM_TYPE_BOX: 6076 case ScriptBaseClass.PRIM_TYPE_BOX:
6049 case ScriptBaseClass.PRIM_TYPE_CYLINDER: 6077 case ScriptBaseClass.PRIM_TYPE_CYLINDER:
6050 case ScriptBaseClass.PRIM_TYPE_PRISM: 6078 case ScriptBaseClass.PRIM_TYPE_PRISM:
6051
6052 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve)); 6079 res.Add(new LSL_Types.LSLInteger(Shape.ProfileCurve));
6053 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 6080 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6054 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); 6081 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
@@ -6063,16 +6090,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6063 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0)); 6090 res.Add(new LSL_Types.LSLFloat(Shape.ProfileHollow / 50000.0));
6064 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 6091 res.Add(new LSL_Types.Vector3(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
6065 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 6092 res.Add(new LSL_Types.Vector3(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
6066
6067 break; 6093 break;
6068 6094
6069
6070
6071 case ScriptBaseClass.PRIM_TYPE_SCULPT: 6095 case ScriptBaseClass.PRIM_TYPE_SCULPT:
6072 res.Add(Shape.SculptTexture.ToString()); 6096 res.Add(Shape.SculptTexture.ToString());
6073 res.Add(new LSL_Types.LSLInteger(Shape.SculptType)); 6097 res.Add(new LSL_Types.LSLInteger(Shape.SculptType));
6074
6075 break; 6098 break;
6099
6076 case ScriptBaseClass.PRIM_TYPE_RING: 6100 case ScriptBaseClass.PRIM_TYPE_RING:
6077 case ScriptBaseClass.PRIM_TYPE_TUBE: 6101 case ScriptBaseClass.PRIM_TYPE_TUBE:
6078 case ScriptBaseClass.PRIM_TYPE_TORUS: 6102 case ScriptBaseClass.PRIM_TYPE_TORUS:
@@ -6111,8 +6135,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6111 res.Add(new LSL_Types.LSLFloat(Shape.PathSkew / 100.0)); 6135 res.Add(new LSL_Types.LSLFloat(Shape.PathSkew / 100.0));
6112 break; 6136 break;
6113 6137
6114
6115
6116 } 6138 }
6117 break; 6139 break;
6118 6140
@@ -6141,7 +6163,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6141 if (remain < 1) 6163 if (remain < 1)
6142 return res; 6164 return res;
6143 6165
6144 face=Convert.ToInt32(rules.Data[idx++]); 6166 face=Convert.ToInt32("" + rules.Data[idx++]);
6145 6167
6146 tex = m_host.Shape.Textures; 6168 tex = m_host.Shape.Textures;
6147 LLColor texcolor; 6169 LLColor texcolor;
@@ -6499,6 +6521,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6499 { 6521 {
6500 m_host.AddScriptLPS(1); 6522 m_host.AddScriptLPS(1);
6501 m_host.RotationOffset = new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); 6523 m_host.RotationOffset = new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
6524 // ScriptSleep(200);
6502 } 6525 }
6503 6526
6504 // <summary> 6527 // <summary>
@@ -6818,7 +6841,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6818 { 6841 {
6819 case 5: // DATA_SIM_POS 6842 case 5: // DATA_SIM_POS
6820 if (info == null) 6843 if (info == null)
6821 return LLUUID.Zero.ToString(); 6844 {
6845 // ScriptSleep(1000);
6846 return LLUUID.Zero.ToString();
6847 }
6822 reply = new LSL_Types.Vector3( 6848 reply = new LSL_Types.Vector3(
6823 info.RegionLocX * Constants.RegionSize, 6849 info.RegionLocX * Constants.RegionSize,
6824 info.RegionLocY * Constants.RegionSize, 6850 info.RegionLocY * Constants.RegionSize,
@@ -6832,7 +6858,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6832 break; 6858 break;
6833 case 7: // DATA_SIM_RATING 6859 case 7: // DATA_SIM_RATING
6834 if (info == null) 6860 if (info == null)
6835 return LLUUID.Zero.ToString(); 6861 {
6862 // ScriptSleep(1000);
6863 return LLUUID.Zero.ToString();
6864 }
6836 int access = info.RegionSettings.Maturity; 6865 int access = info.RegionSettings.Maturity;
6837 if (access == 0) 6866 if (access == 0)
6838 reply = "PG"; 6867 reply = "PG";
@@ -6845,17 +6874,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6845 reply = m_ScriptEngine.World.GetSimulatorVersion(); 6874 reply = m_ScriptEngine.World.GetSimulatorVersion();
6846 break; 6875 break;
6847 default: 6876 default:
6877 // ScriptSleep(1000);
6848 return LLUUID.Zero.ToString(); // Raise no event 6878 return LLUUID.Zero.ToString(); // Raise no event
6849 } 6879 }
6850 LLUUID rq = LLUUID.Random(); 6880 LLUUID rq = LLUUID.Random();
6851 6881
6852 LLUUID tid = AsyncCommands. 6882 LLUUID tid = AsyncCommands.
6853 DataserverPlugin.RegisterRequest(m_localID, 6883 DataserverPlugin.RegisterRequest(m_localID, m_itemID, rq.ToString());
6854 m_itemID, rq.ToString());
6855 6884
6856 AsyncCommands. 6885 AsyncCommands.
6857 DataserverPlugin.DataserverReply(rq.ToString(), reply); 6886 DataserverPlugin.DataserverReply(rq.ToString(), reply);
6858 6887
6888 // ScriptSleep(1000);
6859 return tid.ToString(); 6889 return tid.ToString();
6860 } 6890 }
6861 catch(Exception e) 6891 catch(Exception e)
@@ -6877,7 +6907,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6877 LLUUID key = new LLUUID(); 6907 LLUUID key = new LLUUID();
6878 if (LLUUID.TryParse(id,out key)) 6908 if (LLUUID.TryParse(id,out key))
6879 { 6909 {
6880 return (double) World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass(); 6910 return (double)World.GetSceneObjectPart(World.Entities[key].LocalId).GetMass();
6881 } 6911 }
6882 return 0; 6912 return 0;
6883 } 6913 }
@@ -6970,6 +7000,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6970 LLUUID avatarId = new LLUUID(avatar_id); 7000 LLUUID avatarId = new LLUUID(avatar_id);
6971 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message, 7001 m_ScriptEngine.World.SendUrlToUser(avatarId, m_host.Name, m_host.UUID, m_host.ObjectOwner, false, message,
6972 url); 7002 url);
7003 // ScriptSleep(10000);
6973 } 7004 }
6974 7005
6975 public void llParcelMediaCommandList(LSL_Types.list commandList) 7006 public void llParcelMediaCommandList(LSL_Types.list commandList)
@@ -7056,7 +7087,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7056 }//end switch 7087 }//end switch
7057 7088
7058 } 7089 }
7059 7090 // ScriptSleep(2000);
7060 7091
7061 //NotImplemented("llParcelMediaCommandList"); 7092 //NotImplemented("llParcelMediaCommandList");
7062 } 7093 }
@@ -7096,8 +7127,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7096 7127
7097 } 7128 }
7098 } 7129 }
7130 // ScriptSleep(2000);
7099 return list; 7131 return list;
7100
7101 } 7132 }
7102 7133
7103 public LSL_Types.LSLInteger llModPow(int a, int b, int c) 7134 public LSL_Types.LSLInteger llModPow(int a, int b, int c)
@@ -7105,6 +7136,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7105 m_host.AddScriptLPS(1); 7136 m_host.AddScriptLPS(1);
7106 Int64 tmp = 0; 7137 Int64 tmp = 0;
7107 Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp); 7138 Math.DivRem(Convert.ToInt64(Math.Pow(a, b)), c, out tmp);
7139 // ScriptSleep(1000);
7108 return Convert.ToInt32(tmp); 7140 return Convert.ToInt32(tmp);
7109 } 7141 }
7110 7142
@@ -7151,8 +7183,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7151 return new LSL_Types.Vector3(); 7183 return new LSL_Types.Vector3();
7152 } 7184 }
7153 ScenePresence presence = World.GetScenePresence(m_host.OwnerID); 7185 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
7154 LSL_Types.Vector3 pos = new LSL_Types.Vector3(presence.CameraPosition.x,presence.CameraPosition.y,presence.CameraPosition.z); 7186 if (presence != null)
7155 return pos; 7187 {
7188 LSL_Types.Vector3 pos = new LSL_Types.Vector3(presence.CameraPosition.x,presence.CameraPosition.y,presence.CameraPosition.z);
7189 return pos;
7190 }
7191 return new LSL_Types.Vector3();
7156 } 7192 }
7157 7193
7158 public LSL_Types.Quaternion llGetCameraRot() 7194 public LSL_Types.Quaternion llGetCameraRot()
@@ -7166,12 +7202,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7166 { 7202 {
7167 m_host.AddScriptLPS(1); 7203 m_host.AddScriptLPS(1);
7168 NotImplemented("llSetPrimURL"); 7204 NotImplemented("llSetPrimURL");
7205 // ScriptSleep(2000);
7169 } 7206 }
7170 7207
7171 public void llRefreshPrimURL() 7208 public void llRefreshPrimURL()
7172 { 7209 {
7173 m_host.AddScriptLPS(1); 7210 m_host.AddScriptLPS(1);
7174 NotImplemented("llRefreshPrimURL"); 7211 NotImplemented("llRefreshPrimURL");
7212 // ScriptSleep(20000);
7175 } 7213 }
7176 7214
7177 public string llEscapeURL(string url) 7215 public string llEscapeURL(string url)
@@ -7204,6 +7242,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7204 { 7242 {
7205 m_host.AddScriptLPS(1); 7243 m_host.AddScriptLPS(1);
7206 NotImplemented("llMapDestination"); 7244 NotImplemented("llMapDestination");
7245 // ScriptSleep(1000);
7207 } 7246 }
7208 7247
7209 public void llAddToLandBanList(string avatar, double hours) 7248 public void llAddToLandBanList(string avatar, double hours)
@@ -7222,6 +7261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7222 land.ParcelAccessList.Add(entry); 7261 land.ParcelAccessList.Add(entry);
7223 } 7262 }
7224 } 7263 }
7264 // ScriptSleep(100);
7225 } 7265 }
7226 7266
7227 public void llRemoveFromLandPassList(string avatar) 7267 public void llRemoveFromLandPassList(string avatar)
@@ -7243,6 +7283,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7243 } 7283 }
7244 } 7284 }
7245 } 7285 }
7286 // ScriptSleep(100);
7246 } 7287 }
7247 7288
7248 public void llRemoveFromLandBanList(string avatar) 7289 public void llRemoveFromLandBanList(string avatar)
@@ -7264,6 +7305,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7264 } 7305 }
7265 } 7306 }
7266 } 7307 }
7308 // ScriptSleep(100);
7267 } 7309 }
7268 7310
7269 public void llSetCameraParams(LSL_Types.list rules) 7311 public void llSetCameraParams(LSL_Types.list rules)
@@ -7471,6 +7513,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7471 } 7513 }
7472 } 7514 }
7473 } 7515 }
7516 // ScriptSleep(100);
7474 } 7517 }
7475 7518
7476 public void llResetLandPassList() 7519 public void llResetLandPassList()
@@ -7487,6 +7530,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7487 } 7530 }
7488 } 7531 }
7489 } 7532 }
7533 // ScriptSleep(100);
7490 } 7534 }
7491 7535
7492 public LSL_Types.LSLInteger llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide) 7536 public LSL_Types.LSLInteger llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide)
@@ -7565,6 +7609,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7565 ret.Add(d.Value); 7609 ret.Add(d.Value);
7566 } 7610 }
7567 } 7611 }
7612 // ScriptSleep(2000);
7568 return ret; 7613 return ret;
7569 } 7614 }
7570 7615
@@ -7661,6 +7706,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7661 return; 7706 return;
7662 7707
7663 SetTexture(part, texture, face); 7708 SetTexture(part, texture, face);
7709 // ScriptSleep(200);
7664 } 7710 }
7665 7711
7666 public string llStringTrim(string src, int type) 7712 public string llStringTrim(string src, int type)
@@ -7810,6 +7856,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7810 AsyncCommands. 7856 AsyncCommands.
7811 DataserverPlugin.DataserverReply(item.AssetID.ToString(), 7857 DataserverPlugin.DataserverReply(item.AssetID.ToString(),
7812 NotecardCache.GetLines(item.AssetID).ToString()); 7858 NotecardCache.GetLines(item.AssetID).ToString());
7859 // ScriptSleep(100);
7813 return tid.ToString(); 7860 return tid.ToString();
7814 } 7861 }
7815 WithNotecard(item.AssetID, delegate (LLUUID id, AssetBase a) 7862 WithNotecard(item.AssetID, delegate (LLUUID id, AssetBase a)
@@ -7823,10 +7870,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7823 DataserverPlugin.DataserverReply(id.ToString(), 7870 DataserverPlugin.DataserverReply(id.ToString(),
7824 NotecardCache.GetLines(id).ToString()); 7871 NotecardCache.GetLines(id).ToString());
7825 }); 7872 });
7826 7873 // ScriptSleep(100);
7827 return tid.ToString(); 7874 return tid.ToString();
7828 } 7875 }
7829 } 7876 }
7877 // ScriptSleep(100);
7830 return LLUUID.Zero.ToString(); 7878 return LLUUID.Zero.ToString();
7831 } 7879 }
7832 7880
@@ -7846,6 +7894,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7846 AsyncCommands. 7894 AsyncCommands.
7847 DataserverPlugin.DataserverReply(item.AssetID.ToString(), 7895 DataserverPlugin.DataserverReply(item.AssetID.ToString(),
7848 NotecardCache.GetLine(item.AssetID, line)); 7896 NotecardCache.GetLine(item.AssetID, line));
7897 // ScriptSleep(100);
7849 return tid.ToString(); 7898 return tid.ToString();
7850 } 7899 }
7851 WithNotecard(item.AssetID, delegate (LLUUID id, AssetBase a) 7900 WithNotecard(item.AssetID, delegate (LLUUID id, AssetBase a)
@@ -7860,10 +7909,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7860 NotecardCache.GetLine(id, line)); 7909 NotecardCache.GetLine(id, line));
7861 }); 7910 });
7862 7911
7912 // ScriptSleep(100);
7863 return tid.ToString(); 7913 return tid.ToString();
7864 } 7914 }
7865 } 7915 }
7866 7916
7917 // ScriptSleep(100);
7867 return String.Empty; 7918 return String.Empty;
7868 } 7919 }
7869 7920