aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs13
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs2
-rw-r--r--OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs17
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs81
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs539
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs376
-rw-r--r--OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs24
9 files changed, 533 insertions, 527 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 032b2c2..611a559 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -198,7 +198,6 @@ namespace OpenSim.Data.MSSQL
198 while (reader.Read()) 198 while (reader.Read())
199 items.Add(readInventoryFolder(reader)); 199 items.Add(readInventoryFolder(reader));
200 200
201
202 reader.Close(); 201 reader.Close();
203 result.Dispose(); 202 result.Dispose();
204 203
@@ -321,12 +320,12 @@ namespace OpenSim.Data.MSSQL
321 item.Creator = new LLUUID((string) reader["creatorID"]); 320 item.Creator = new LLUUID((string) reader["creatorID"]);
322 item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]); 321 item.BasePermissions = Convert.ToUInt32(reader["inventoryBasePermissions"]);
323 item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]); 322 item.EveryOnePermissions = Convert.ToUInt32(reader["inventoryEveryOnePermissions"]);
324 item.SalePrice = (int) reader["salePrice"]; 323 item.SalePrice = (int) reader["salePrice"];
325 item.SaleType = Convert.ToByte(reader["saleType"]); 324 item.SaleType = Convert.ToByte(reader["saleType"]);
326 item.CreationDate = (int) reader["creationDate"]; 325 item.CreationDate = (int) reader["creationDate"];
327 item.GroupID = new LLUUID(reader["groupID"].ToString()); 326 item.GroupID = new LLUUID(reader["groupID"].ToString());
328 item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]); 327 item.GroupOwned = Convert.ToBoolean(reader["groupOwned"]);
329 item.Flags = (uint) reader["flags"]; 328 item.Flags = (uint) reader["flags"];
330 329
331 return item; 330 return item;
332 } 331 }
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index b529d4e..90664ff 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -333,7 +333,7 @@ namespace OpenSim.Data.MySQL
333 item.Creator = new LLUUID((string) reader["creatorID"]); 333 item.Creator = new LLUUID((string) reader["creatorID"]);
334 item.BasePermissions = (uint) reader["inventoryBasePermissions"]; 334 item.BasePermissions = (uint) reader["inventoryBasePermissions"];
335 item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"]; 335 item.EveryOnePermissions = (uint) reader["inventoryEveryOnePermissions"];
336 item.SalePrice = (int) reader["salePrice"]; 336 item.SalePrice = (int) reader["salePrice"];
337 item.SaleType = Convert.ToByte(reader["saleType"]); 337 item.SaleType = Convert.ToByte(reader["saleType"]);
338 item.CreationDate = (int) reader["creationDate"]; 338 item.CreationDate = (int) reader["creationDate"];
339 item.GroupID = new LLUUID(reader["groupID"].ToString()); 339 item.GroupID = new LLUUID(reader["groupID"].ToString());
diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
index b613bd0..75e9e57 100644
--- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs
@@ -237,14 +237,14 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions
237 // Outside of this method, they should never be added to objectflags! 237 // Outside of this method, they should never be added to objectflags!
238 // -teravus 238 // -teravus
239 239
240 SceneObjectPart task=m_scene.GetSceneObjectPart(objID); 240 SceneObjectPart task=m_scene.GetSceneObjectPart(objID);
241 241
242 // this shouldn't ever happen.. return no permissions/objectflags. 242 // this shouldn't ever happen.. return no permissions/objectflags.
243 if (task == null) 243 if (task == null)
244 return (uint)0; 244 return (uint)0;
245 245
246 uint objflags = task.GetEffectiveObjectFlags(); 246 uint objflags = task.GetEffectiveObjectFlags();
247 LLUUID objectOwner = task.OwnerID; 247 LLUUID objectOwner = task.OwnerID;
248 248
249 249
250 // Remove any of the objectFlags that are temporary. These will get added back if appropriate 250 // Remove any of the objectFlags that are temporary. These will get added back if appropriate
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
index ae37790..0a4906a 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs
@@ -193,7 +193,7 @@ namespace OpenSim.Region.Environment.Scenes
193 // Is this prim part of the group 193 // Is this prim part of the group
194 if (obj.HasChildPrim(localID)) 194 if (obj.HasChildPrim(localID))
195 { 195 {
196 SceneObjectPart part=obj.GetChildPart(localID); 196 SceneObjectPart part=obj.GetChildPart(localID);
197 if (part != null) 197 if (part != null)
198 { 198 {
199 // If the touched prim handles touches, deliver it 199 // If the touched prim handles touches, deliver it
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index 2bc7fd3..033a419 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -186,8 +186,6 @@ namespace OpenSim.Region.Environment.Scenes
186 string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid)); 186 string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid));
187 } 187 }
188 188
189
190
191 return m_rootPart.GroupPosition; 189 return m_rootPart.GroupPosition;
192 } 190 }
193 set 191 set
@@ -198,7 +196,6 @@ namespace OpenSim.Region.Environment.Scenes
198 m_scene.CrossPrimGroupIntoNewRegion(val, this); 196 m_scene.CrossPrimGroupIntoNewRegion(val, this);
199 } 197 }
200 198
201
202 lock (m_parts) 199 lock (m_parts)
203 { 200 {
204 foreach (SceneObjectPart part in m_parts.Values) 201 foreach (SceneObjectPart part in m_parts.Values)
@@ -969,19 +966,19 @@ namespace OpenSim.Region.Environment.Scenes
969 966
970 public void aggregateScriptEvents() 967 public void aggregateScriptEvents()
971 { 968 {
972 uint objectflagupdate=(uint)RootPart.GetEffectiveObjectFlags(); 969 uint objectflagupdate=(uint)RootPart.GetEffectiveObjectFlags();
973 970
974 scriptEvents aggregateScriptEvents=0; 971 scriptEvents aggregateScriptEvents=0;
975 972
976 lock (m_parts) 973 lock (m_parts)
977 { 974 {
978 foreach (SceneObjectPart part in m_parts.Values) 975 foreach (SceneObjectPart part in m_parts.Values)
979 { 976 {
980 if(part == null) 977 if (part == null)
981 continue; 978 continue;
982 if(part != RootPart) 979 if (part != RootPart)
983 part.ObjectFlags = objectflagupdate; 980 part.ObjectFlags = objectflagupdate;
984 aggregateScriptEvents |= part.m_aggregateScriptEvents; 981 aggregateScriptEvents |= part.m_aggregateScriptEvents;
985 } 982 }
986 } 983 }
987 984
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index 3252b6c..56821c6 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -98,8 +98,8 @@ namespace OpenSim.Region.Environment.Scenes
98 98
99 // TODO: This needs to be persisted in next XML version update! 99 // TODO: This needs to be persisted in next XML version update!
100 [XmlIgnore] public int[] PayPrice = {-2,-2,-2,-2,-2}; 100 [XmlIgnore] public int[] PayPrice = {-2,-2,-2,-2,-2};
101 [XmlIgnore] private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>(); 101 [XmlIgnore] private Dictionary<LLUUID, scriptEvents> m_scriptEvents = new Dictionary<LLUUID, scriptEvents>();
102 [XmlIgnore] public scriptEvents m_aggregateScriptEvents=0; 102 [XmlIgnore] public scriptEvents m_aggregateScriptEvents=0;
103 [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None; 103 [XmlIgnore] private LLObject.ObjectFlags LocalFlags = LLObject.ObjectFlags.None;
104 [XmlIgnore] public bool DIE_AT_EDGE = false; 104 [XmlIgnore] public bool DIE_AT_EDGE = false;
105 105
@@ -190,10 +190,10 @@ namespace OpenSim.Region.Environment.Scenes
190 set { m_name = value; } 190 set { m_name = value; }
191 } 191 }
192 192
193 public scriptEvents ScriptEvents 193 public scriptEvents ScriptEvents
194 { 194 {
195 get { return m_aggregateScriptEvents; } 195 get { return m_aggregateScriptEvents; }
196 } 196 }
197 197
198 protected LLObject.MaterialType m_material = 0; 198 protected LLObject.MaterialType m_material = 0;
199 199
@@ -211,14 +211,14 @@ namespace OpenSim.Region.Environment.Scenes
211 set { m_regionHandle = value; } 211 set { m_regionHandle = value; }
212 } 212 }
213 213
214 public uint GetEffectiveObjectFlags() 214 public uint GetEffectiveObjectFlags()
215 { 215 {
216 LLObject.ObjectFlags f=Flags; 216 LLObject.ObjectFlags f = Flags;
217 if(m_parentGroup == null || m_parentGroup.RootPart == this) 217 if (m_parentGroup == null || m_parentGroup.RootPart == this)
218 f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money); 218 f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money);
219 219
220 return (uint)Flags | (uint)LocalFlags; 220 return (uint)Flags | (uint)LocalFlags;
221 } 221 }
222 222
223 //unkown if this will be kept, added as a way of removing the group position from the group class 223 //unkown if this will be kept, added as a way of removing the group position from the group class
224 protected LLVector3 m_groupPosition; 224 protected LLVector3 m_groupPosition;
@@ -2158,14 +2158,14 @@ namespace OpenSim.Region.Environment.Scenes
2158 } 2158 }
2159 } 2159 }
2160 2160
2161 if(soundID == LLUUID.Zero) 2161 if (soundID == LLUUID.Zero)
2162 return; 2162 return;
2163 2163
2164 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); 2164 List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
2165 foreach (ScenePresence p in avatarts) 2165 foreach (ScenePresence p in avatarts)
2166 { 2166 {
2167 double dis=Util.GetDistanceTo(p.AbsolutePosition, position); 2167 double dis=Util.GetDistanceTo(p.AbsolutePosition, position);
2168 if(dis > 100.0) // Max audio distance 2168 if (dis > 100.0) // Max audio distance
2169 continue; 2169 continue;
2170 2170
2171 // Scale by distance 2171 // Scale by distance
@@ -2623,25 +2623,25 @@ namespace OpenSim.Region.Environment.Scenes
2623 } 2623 }
2624 } 2624 }
2625 2625
2626 public void SetScriptEvents(LLUUID scriptid, int events) 2626 public void SetScriptEvents(LLUUID scriptid, int events)
2627 { 2627 {
2628 scriptEvents oldparts; 2628 scriptEvents oldparts;
2629 lock (m_scriptEvents) 2629 lock (m_scriptEvents)
2630 { 2630 {
2631 if (m_scriptEvents.ContainsKey(scriptid)) 2631 if (m_scriptEvents.ContainsKey(scriptid))
2632 { 2632 {
2633 oldparts = m_scriptEvents[scriptid]; 2633 oldparts = m_scriptEvents[scriptid];
2634 2634
2635 // remove values from aggregated script events 2635 // remove values from aggregated script events
2636 m_scriptEvents[scriptid] = (scriptEvents) events; 2636 m_scriptEvents[scriptid] = (scriptEvents) events;
2637 } 2637 }
2638 else 2638 else
2639 { 2639 {
2640 m_scriptEvents.Add(scriptid, (scriptEvents) events); 2640 m_scriptEvents.Add(scriptid, (scriptEvents) events);
2641 } 2641 }
2642 } 2642 }
2643 aggregateScriptEvents(); 2643 aggregateScriptEvents();
2644 } 2644 }
2645 2645
2646 public void RemoveScriptEvents(LLUUID scriptid) 2646 public void RemoveScriptEvents(LLUUID scriptid)
2647 { 2647 {
@@ -2710,16 +2710,15 @@ namespace OpenSim.Region.Environment.Scenes
2710 } 2710 }
2711 } 2711 }
2712 2712
2713 LocalFlags=(LLObject.ObjectFlags)objectflagupdate; 2713 LocalFlags=(LLObject.ObjectFlags)objectflagupdate;
2714 2714
2715 if(m_parentGroup != null && m_parentGroup.RootPart == this) 2715 if (m_parentGroup != null && m_parentGroup.RootPart == this)
2716 m_parentGroup.aggregateScriptEvents(); 2716 m_parentGroup.aggregateScriptEvents();
2717 else 2717 else
2718 ScheduleFullUpdate(); 2718 ScheduleFullUpdate();
2719 } 2719 }
2720 public void PhysicsCollision(EventArgs e) 2720 public void PhysicsCollision(EventArgs e)
2721 { 2721 {
2722
2723 return; 2722 return;
2724 2723
2725 // 2724 //
@@ -2733,7 +2732,6 @@ namespace OpenSim.Region.Environment.Scenes
2733 //{ 2732 //{
2734 // m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); 2733 // m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
2735 //} 2734 //}
2736
2737 } 2735 }
2738 2736
2739 public void SetDieAtEdge(bool p) 2737 public void SetDieAtEdge(bool p)
@@ -2755,5 +2753,4 @@ namespace OpenSim.Region.Environment.Scenes
2755 return m_parentGroup.RootPart.DIE_AT_EDGE; 2753 return m_parentGroup.RootPart.DIE_AT_EDGE;
2756 } 2754 }
2757 } 2755 }
2758
2759} 2756}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index c8b7d5c..6cebf04 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -303,26 +303,26 @@ namespace OpenSim.Region.ScriptEngine.Common
303 double sqx = r.x*r.x; 303 double sqx = r.x*r.x;
304 double sqy = r.y*r.y; 304 double sqy = r.y*r.y;
305 double sqz = r.z*r.z; 305 double sqz = r.z*r.z;
306 double unit = sqx + sqy + sqz + sqw; // if normalised is one, otherwise is correction factor 306 double unit = sqx + sqy + sqz + sqw; // if normalised is one, otherwise is correction factor
307 double test = r.x*r.y + r.z*r.s; 307 double test = r.x*r.y + r.z*r.s;
308 if (test > 0.499 * unit) // singularity at north pole 308 if (test > 0.499 * unit) // singularity at north pole
309 { 309 {
310 x = 0; 310 x = 0;
311 y = 2 * Math.Atan2(r.x, r.s); 311 y = 2 * Math.Atan2(r.x, r.s);
312 z = Math.PI/2; 312 z = Math.PI/2;
313 return new LSL_Types.Vector3(x, y, z); 313 return new LSL_Types.Vector3(x, y, z);
314 } 314 }
315 if (test < -0.499 * unit) // singularity at south pole 315 if (test < -0.499 * unit) // singularity at south pole
316 { 316 {
317 x = 0; 317 x = 0;
318 y = -2 * Math.Atan2(r.x,r.s); 318 y = -2 * Math.Atan2(r.x,r.s);
319 z = -Math.PI/2; 319 z = -Math.PI/2;
320 return new LSL_Types.Vector3(x, y, z); 320 return new LSL_Types.Vector3(x, y, z);
321 } 321 }
322 x = Math.Atan2(2 * r.x * r.s - 2 * r.y * r.z, -sqx + sqy - sqz + sqw); 322 x = Math.Atan2(2 * r.x * r.s - 2 * r.y * r.z, -sqx + sqy - sqz + sqw);
323 y = Math.Atan2(2*r.y*r.s-2*r.x*r.z , sqx - sqy - sqz + sqw); 323 y = Math.Atan2(2*r.y*r.s-2*r.x*r.z , sqx - sqy - sqz + sqw);
324 z = Math.Asin(2*test/unit); 324 z = Math.Asin(2*test/unit);
325 return new LSL_Types.Vector3(x, y, z); 325 return new LSL_Types.Vector3(x, y, z);
326 } 326 }
327 327
328 328
@@ -490,11 +490,11 @@ namespace OpenSim.Region.ScriptEngine.Common
490 490
491 public void llRegionSay(int channelID, string text) 491 public void llRegionSay(int channelID, string text)
492 { 492 {
493 if(channelID == 0) 493 if (channelID == 0)
494 { 494 {
495 LSLError("Cannot use llRegionSay() on channel 0"); 495 LSLError("Cannot use llRegionSay() on channel 0");
496 return; 496 return;
497 } 497 }
498 498
499 m_host.AddScriptLPS(1); 499 m_host.AddScriptLPS(1);
500 500
@@ -922,11 +922,11 @@ namespace OpenSim.Region.ScriptEngine.Common
922 public void llSetScale(LSL_Types.Vector3 scale) 922 public void llSetScale(LSL_Types.Vector3 scale)
923 { 923 {
924 m_host.AddScriptLPS(1); 924 m_host.AddScriptLPS(1);
925 SetScale(m_host, scale); 925 SetScale(m_host, scale);
926 } 926 }
927 927
928 private void SetScale(SceneObjectPart part, LSL_Types.Vector3 scale) 928 private void SetScale(SceneObjectPart part, LSL_Types.Vector3 scale)
929 { 929 {
930 // TODO: this needs to trigger a persistance save as well 930 // TODO: this needs to trigger a persistance save as well
931 LLVector3 tmp = part.Scale; 931 LLVector3 tmp = part.Scale;
932 tmp.X = (float)scale.x; 932 tmp.X = (float)scale.x;
@@ -947,11 +947,11 @@ namespace OpenSim.Region.ScriptEngine.Common
947 { 947 {
948 m_host.AddScriptLPS(1); 948 m_host.AddScriptLPS(1);
949 949
950 SetColor(m_host, color, face); 950 SetColor(m_host, color, face);
951 } 951 }
952 952
953 private void SetColor(SceneObjectPart part, LSL_Types.Vector3 color, int face) 953 private void SetColor(SceneObjectPart part, LSL_Types.Vector3 color, int face)
954 { 954 {
955 LLObject.TextureEntry tex = part.Shape.Textures; 955 LLObject.TextureEntry tex = part.Shape.Textures;
956 LLColor texcolor; 956 LLColor texcolor;
957 if (face > -1) 957 if (face > -1)
@@ -1010,11 +1010,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1010 { 1010 {
1011 m_host.AddScriptLPS(1); 1011 m_host.AddScriptLPS(1);
1012 1012
1013 SetAlpha(m_host, alpha, face); 1013 SetAlpha(m_host, alpha, face);
1014 } 1014 }
1015 1015
1016 private void SetAlpha(SceneObjectPart part, double alpha, int face) 1016 private void SetAlpha(SceneObjectPart part, double alpha, int face)
1017 { 1017 {
1018 LLObject.TextureEntry tex = part.Shape.Textures; 1018 LLObject.TextureEntry tex = part.Shape.Textures;
1019 LLColor texcolor; 1019 LLColor texcolor;
1020 if (face > -1) 1020 if (face > -1)
@@ -1080,19 +1080,19 @@ namespace OpenSim.Region.ScriptEngine.Common
1080 public void llSetTexture(string texture, int face) 1080 public void llSetTexture(string texture, int face)
1081 { 1081 {
1082 m_host.AddScriptLPS(1); 1082 m_host.AddScriptLPS(1);
1083 SetTexture(m_host, texture, face); 1083 SetTexture(m_host, texture, face);
1084 } 1084 }
1085 1085
1086 private void SetTexture(SceneObjectPart part, string texture, int face) 1086 private void SetTexture(SceneObjectPart part, string texture, int face)
1087 { 1087 {
1088 LLUUID textureID=new LLUUID(); 1088 LLUUID textureID=new LLUUID();
1089 1089
1090 if(!LLUUID.TryParse(texture, out textureID)) 1090 if (!LLUUID.TryParse(texture, out textureID))
1091 { 1091 {
1092 textureID=InventoryKey(texture, (int)AssetType.Texture); 1092 textureID=InventoryKey(texture, (int)AssetType.Texture);
1093 } 1093 }
1094 1094
1095 if(textureID == LLUUID.Zero) 1095 if (textureID == LLUUID.Zero)
1096 return; 1096 return;
1097 1097
1098 LLObject.TextureEntry tex = part.Shape.Textures; 1098 LLObject.TextureEntry tex = part.Shape.Textures;
@@ -1128,11 +1128,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1128 { 1128 {
1129 m_host.AddScriptLPS(1); 1129 m_host.AddScriptLPS(1);
1130 1130
1131 ScaleTexture(m_host, u, v, face); 1131 ScaleTexture(m_host, u, v, face);
1132 } 1132 }
1133 1133
1134 private void ScaleTexture(SceneObjectPart part, double u, double v, int face) 1134 private void ScaleTexture(SceneObjectPart part, double u, double v, int face)
1135 { 1135 {
1136 LLObject.TextureEntry tex = part.Shape.Textures; 1136 LLObject.TextureEntry tex = part.Shape.Textures;
1137 if (face > -1) 1137 if (face > -1)
1138 { 1138 {
@@ -1167,11 +1167,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1167 public void llOffsetTexture(double u, double v, int face) 1167 public void llOffsetTexture(double u, double v, int face)
1168 { 1168 {
1169 m_host.AddScriptLPS(1); 1169 m_host.AddScriptLPS(1);
1170 OffsetTexture(m_host, u, v, face); 1170 OffsetTexture(m_host, u, v, face);
1171 } 1171 }
1172 1172
1173 private void OffsetTexture(SceneObjectPart part, double u, double v, int face) 1173 private void OffsetTexture(SceneObjectPart part, double u, double v, int face)
1174 { 1174 {
1175 LLObject.TextureEntry tex = part.Shape.Textures; 1175 LLObject.TextureEntry tex = part.Shape.Textures;
1176 if (face > -1) 1176 if (face > -1)
1177 { 1177 {
@@ -1206,11 +1206,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1206 public void llRotateTexture(double rotation, int face) 1206 public void llRotateTexture(double rotation, int face)
1207 { 1207 {
1208 m_host.AddScriptLPS(1); 1208 m_host.AddScriptLPS(1);
1209 RotateTexture(m_host, rotation, face); 1209 RotateTexture(m_host, rotation, face);
1210 } 1210 }
1211 1211
1212 private void RotateTexture(SceneObjectPart part, double rotation, int face) 1212 private void RotateTexture(SceneObjectPart part, double rotation, int face)
1213 { 1213 {
1214 LLObject.TextureEntry tex = part.Shape.Textures; 1214 LLObject.TextureEntry tex = part.Shape.Textures;
1215 if (face > -1) 1215 if (face > -1)
1216 { 1216 {
@@ -1264,11 +1264,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1264 { 1264 {
1265 m_host.AddScriptLPS(1); 1265 m_host.AddScriptLPS(1);
1266 1266
1267 SetPos(m_host, pos); 1267 SetPos(m_host, pos);
1268 } 1268 }
1269 1269
1270 private void SetPos(SceneObjectPart part, LSL_Types.Vector3 pos) 1270 private void SetPos(SceneObjectPart part, LSL_Types.Vector3 pos)
1271 { 1271 {
1272 if (part.ParentID != 0) 1272 if (part.ParentID != 0)
1273 { 1273 {
1274 part.UpdateOffSet(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z)); 1274 part.UpdateOffSet(new LLVector3((float)pos.x, (float)pos.y, (float)pos.z));
@@ -1308,11 +1308,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1308 { 1308 {
1309 m_host.AddScriptLPS(1); 1309 m_host.AddScriptLPS(1);
1310 1310
1311 SetRot(m_host, rot); 1311 SetRot(m_host, rot);
1312 } 1312 }
1313 1313
1314 private void SetRot(SceneObjectPart part, LSL_Types.Quaternion rot) 1314 private void SetRot(SceneObjectPart part, LSL_Types.Quaternion rot)
1315 { 1315 {
1316 part.UpdateRotation(new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s)); 1316 part.UpdateRotation(new LLQuaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s));
1317 // Update rotation does not move the object in the physics scene if it's a linkset. 1317 // Update rotation does not move the object in the physics scene if it's a linkset.
1318 part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition; 1318 part.ParentGroup.AbsolutePosition = part.ParentGroup.AbsolutePosition;
@@ -1569,7 +1569,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1569 if (start <= end) 1569 if (start <= end)
1570 { 1570 {
1571 // Implies both bounds are out-of-range. 1571 // Implies both bounds are out-of-range.
1572 if(end < 0 || start >= src.Length) 1572 if (end < 0 || start >= src.Length)
1573 { 1573 {
1574 return String.Empty; 1574 return String.Empty;
1575 } 1575 }
@@ -1577,12 +1577,12 @@ namespace OpenSim.Region.ScriptEngine.Common
1577 // corresponds to the lengt of the substring 1577 // corresponds to the lengt of the substring
1578 // needed (plus one of course). BUT, it 1578 // needed (plus one of course). BUT, it
1579 // must be within bounds. 1579 // must be within bounds.
1580 if(end >= src.Length) 1580 if (end >= src.Length)
1581 { 1581 {
1582 end = src.Length-1; 1582 end = src.Length-1;
1583 } 1583 }
1584 1584
1585 if(start < 0) 1585 if (start < 0)
1586 { 1586 {
1587 return src.Substring(0,end+1); 1587 return src.Substring(0,end+1);
1588 } 1588 }
@@ -1597,21 +1597,21 @@ namespace OpenSim.Region.ScriptEngine.Common
1597 // lower bound. In the inverted case, that 1597 // lower bound. In the inverted case, that
1598 // means the entire string will be returned 1598 // means the entire string will be returned
1599 // unchanged. 1599 // unchanged.
1600 if(start < 0) 1600 if (start < 0)
1601 { 1601 {
1602 return src; 1602 return src;
1603 } 1603 }
1604 // If both indices are greater than the upper 1604 // If both indices are greater than the upper
1605 // bound the result may seem initially counter 1605 // bound the result may seem initially counter
1606 // intuitive. 1606 // intuitive.
1607 if(end >= src.Length) 1607 if (end >= src.Length)
1608 { 1608 {
1609 return src; 1609 return src;
1610 } 1610 }
1611 1611
1612 if(end < 0) 1612 if (end < 0)
1613 { 1613 {
1614 if(start < src.Length) 1614 if (start < src.Length)
1615 { 1615 {
1616 return src.Substring(start); 1616 return src.Substring(start);
1617 } 1617 }
@@ -1622,7 +1622,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1622 } 1622 }
1623 else 1623 else
1624 { 1624 {
1625 if(start < src.Length) 1625 if (start < src.Length)
1626 { 1626 {
1627 return src.Substring(0,end+1) + src.Substring(start); 1627 return src.Substring(0,end+1) + src.Substring(start);
1628 } 1628 }
@@ -1664,18 +1664,18 @@ namespace OpenSim.Region.ScriptEngine.Common
1664 { 1664 {
1665 // If both bounds are outside of the existing 1665 // If both bounds are outside of the existing
1666 // string, then return unchanges. 1666 // string, then return unchanges.
1667 if(end < 0 || start >= src.Length) 1667 if (end < 0 || start >= src.Length)
1668 { 1668 {
1669 return src; 1669 return src;
1670 } 1670 }
1671 // At least one bound is in-range, so we 1671 // At least one bound is in-range, so we
1672 // need to clip the out-of-bound argument. 1672 // need to clip the out-of-bound argument.
1673 if(start < 0) 1673 if (start < 0)
1674 { 1674 {
1675 start = 0; 1675 start = 0;
1676 } 1676 }
1677 1677
1678 if(end >= src.Length) 1678 if (end >= src.Length)
1679 { 1679 {
1680 end = src.Length-1; 1680 end = src.Length-1;
1681 } 1681 }
@@ -1687,14 +1687,14 @@ namespace OpenSim.Region.ScriptEngine.Common
1687 { 1687 {
1688 // In this case, out of bounds means that 1688 // In this case, out of bounds means that
1689 // the existing string is part of the cut. 1689 // the existing string is part of the cut.
1690 if(start < 0 || end >= src.Length) 1690 if (start < 0 || end >= src.Length)
1691 { 1691 {
1692 return String.Empty; 1692 return String.Empty;
1693 } 1693 }
1694 1694
1695 if(end > 0) 1695 if (end > 0)
1696 { 1696 {
1697 if(start < src.Length) 1697 if (start < src.Length)
1698 { 1698 {
1699 return src.Remove(start).Remove(0,end+1); 1699 return src.Remove(start).Remove(0,end+1);
1700 } 1700 }
@@ -1705,7 +1705,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1705 } 1705 }
1706 else 1706 else
1707 { 1707 {
1708 if(start < src.Length) 1708 if (start < src.Length)
1709 { 1709 {
1710 return src.Remove(start); 1710 return src.Remove(start);
1711 } 1711 }
@@ -1741,14 +1741,14 @@ namespace OpenSim.Region.ScriptEngine.Common
1741 // Negative now means it is less than the lower 1741 // Negative now means it is less than the lower
1742 // bound of the string. 1742 // bound of the string.
1743 1743
1744 if(index < 0) 1744 if (index < 0)
1745 { 1745 {
1746 return src+dest; 1746 return src+dest;
1747 } 1747 }
1748 1748
1749 } 1749 }
1750 1750
1751 if(index >= dest.Length) 1751 if (index >= dest.Length)
1752 { 1752 {
1753 return dest+src; 1753 return dest+src;
1754 } 1754 }
@@ -1777,15 +1777,15 @@ namespace OpenSim.Region.ScriptEngine.Common
1777 public int llGiveMoney(string destination, int amount) 1777 public int llGiveMoney(string destination, int amount)
1778 { 1778 {
1779 LLUUID invItemID=InventorySelf(); 1779 LLUUID invItemID=InventorySelf();
1780 if(invItemID == LLUUID.Zero) 1780 if (invItemID == LLUUID.Zero)
1781 return 0; 1781 return 0;
1782 1782
1783 m_host.AddScriptLPS(1); 1783 m_host.AddScriptLPS(1);
1784 1784
1785 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 1785 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
1786 return 0; 1786 return 0;
1787 1787
1788 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0) 1788 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0)
1789 { 1789 {
1790 LSLError("No permissions to give money"); 1790 LSLError("No permissions to give money");
1791 return 0; 1791 return 0;
@@ -1793,7 +1793,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1793 1793
1794 LLUUID toID=new LLUUID(); 1794 LLUUID toID=new LLUUID();
1795 1795
1796 if(!LLUUID.TryParse(destination, out toID)) 1796 if (!LLUUID.TryParse(destination, out toID))
1797 { 1797 {
1798 LSLError("Bad key in llGiveMoney"); 1798 LSLError("Bad key in llGiveMoney");
1799 return 0; 1799 return 0;
@@ -1801,7 +1801,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1801 1801
1802 IMoneyModule money=World.RequestModuleInterface<IMoneyModule>(); 1802 IMoneyModule money=World.RequestModuleInterface<IMoneyModule>();
1803 1803
1804 if(money == null) 1804 if (money == null)
1805 { 1805 {
1806 NotImplemented("llGiveMoney"); 1806 NotImplemented("llGiveMoney");
1807 return 0; 1807 return 0;
@@ -1809,7 +1809,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1809 1809
1810 bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); 1810 bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
1811 1811
1812 if(result) 1812 if (result)
1813 return 1; 1813 return 1;
1814 1814
1815 return 0; 1815 return 0;
@@ -2113,17 +2113,17 @@ namespace OpenSim.Region.ScriptEngine.Common
2113 m_host.AddScriptLPS(1); 2113 m_host.AddScriptLPS(1);
2114 2114
2115 LLUUID invItemID=InventorySelf(); 2115 LLUUID invItemID=InventorySelf();
2116 if(invItemID == LLUUID.Zero) 2116 if (invItemID == LLUUID.Zero)
2117 return; 2117 return;
2118 2118
2119 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 2119 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
2120 return; 2120 return;
2121 2121
2122 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) 2122 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
2123 { 2123 {
2124 // Do NOT try to parse LLUUID, animations cannot be triggered by ID 2124 // Do NOT try to parse LLUUID, animations cannot be triggered by ID
2125 LLUUID animID=InventoryKey(anim, (int)AssetType.Animation); 2125 LLUUID animID=InventoryKey(anim, (int)AssetType.Animation);
2126 if(animID == LLUUID.Zero) 2126 if (animID == LLUUID.Zero)
2127 return; 2127 return;
2128 2128
2129 if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) 2129 if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter))
@@ -2139,22 +2139,22 @@ namespace OpenSim.Region.ScriptEngine.Common
2139 m_host.AddScriptLPS(1); 2139 m_host.AddScriptLPS(1);
2140 2140
2141 LLUUID invItemID=InventorySelf(); 2141 LLUUID invItemID=InventorySelf();
2142 if(invItemID == LLUUID.Zero) 2142 if (invItemID == LLUUID.Zero)
2143 return; 2143 return;
2144 2144
2145 if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) 2145 if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
2146 return; 2146 return;
2147 2147
2148 if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) 2148 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
2149 { 2149 {
2150 LLUUID animID = new LLUUID(); 2150 LLUUID animID = new LLUUID();
2151 2151
2152 if(!LLUUID.TryParse(anim, out animID)) 2152 if (!LLUUID.TryParse(anim, out animID))
2153 { 2153 {
2154 animID=InventoryKey(anim); 2154 animID=InventoryKey(anim);
2155 } 2155 }
2156 2156
2157 if(animID == LLUUID.Zero) 2157 if (animID == LLUUID.Zero)
2158 return; 2158 return;
2159 2159
2160 if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) 2160 if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter))
@@ -2203,15 +2203,15 @@ namespace OpenSim.Region.ScriptEngine.Common
2203 { 2203 {
2204 LLUUID agentID=new LLUUID(); 2204 LLUUID agentID=new LLUUID();
2205 2205
2206 if(!LLUUID.TryParse(agent, out agentID)) 2206 if (!LLUUID.TryParse(agent, out agentID))
2207 return; 2207 return;
2208 2208
2209 LLUUID invItemID=InventorySelf(); 2209 LLUUID invItemID=InventorySelf();
2210 2210
2211 if(invItemID == LLUUID.Zero) 2211 if (invItemID == LLUUID.Zero)
2212 return; // Not in a prim? How?? 2212 return; // Not in a prim? How??
2213 2213
2214 if(agentID == LLUUID.Zero || perm == 0) // Releasing permissions 2214 if (agentID == LLUUID.Zero || perm == 0) // Releasing permissions
2215 { 2215 {
2216 m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero; 2216 m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero;
2217 m_host.TaskInventory[invItemID].PermsMask=0; 2217 m_host.TaskInventory[invItemID].PermsMask=0;
@@ -2226,14 +2226,14 @@ namespace OpenSim.Region.ScriptEngine.Common
2226 2226
2227 bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state 2227 bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state
2228 2228
2229 if(m_host.ParentGroup.RootPart.m_IsAttachment && agent == m_host.ParentGroup.RootPart.m_attachedAvatar) 2229 if (m_host.ParentGroup.RootPart.m_IsAttachment && agent == m_host.ParentGroup.RootPart.m_attachedAvatar)
2230 { 2230 {
2231 // When attached, certain permissions are implicit if requested from owner 2231 // When attached, certain permissions are implicit if requested from owner
2232 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS | 2232 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS |
2233 BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | 2233 BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION |
2234 BuiltIn_Commands_BaseClass.PERMISSION_ATTACH; 2234 BuiltIn_Commands_BaseClass.PERMISSION_ATTACH;
2235 2235
2236 if((perm & (~implicitPerms)) == 0) // Requested only implicit perms 2236 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
2237 { 2237 {
2238 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2238 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2239 m_host.TaskInventory[invItemID].PermsMask=perm; 2239 m_host.TaskInventory[invItemID].PermsMask=perm;
@@ -2244,13 +2244,13 @@ namespace OpenSim.Region.ScriptEngine.Common
2244 return; 2244 return;
2245 } 2245 }
2246 } 2246 }
2247 else if(m_host.m_sitTargetAvatar == agentID) // Sitting avatar 2247 else if (m_host.m_sitTargetAvatar == agentID) // Sitting avatar
2248 { 2248 {
2249 // When agent is sitting, certain permissions are implicit if requested from sitting agent 2249 // When agent is sitting, certain permissions are implicit if requested from sitting agent
2250 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | 2250 int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION |
2251 BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA; 2251 BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA;
2252 2252
2253 if((perm & (~implicitPerms)) == 0) // Requested only implicit perms 2253 if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
2254 { 2254 {
2255 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2255 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2256 m_host.TaskInventory[invItemID].PermsMask=perm; 2256 m_host.TaskInventory[invItemID].PermsMask=perm;
@@ -2265,11 +2265,11 @@ namespace OpenSim.Region.ScriptEngine.Common
2265 if (World.m_innerScene.ScenePresences.ContainsKey(agentID)) 2265 if (World.m_innerScene.ScenePresences.ContainsKey(agentID))
2266 { 2266 {
2267 string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID); 2267 string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID);
2268 if(ownerName == String.Empty) 2268 if (ownerName == String.Empty)
2269 ownerName="(hippos)"; 2269 ownerName="(hippos)";
2270 2270
2271 ScenePresence presence = World.m_innerScene.ScenePresences[agentID]; 2271 ScenePresence presence = World.m_innerScene.ScenePresences[agentID];
2272 if(!m_waitingForScriptAnswer) 2272 if (!m_waitingForScriptAnswer)
2273 { 2273 {
2274 m_host.TaskInventory[invItemID].PermsGranter=agentID; 2274 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2275 m_host.TaskInventory[invItemID].PermsMask=0; 2275 m_host.TaskInventory[invItemID].PermsMask=0;
@@ -2288,12 +2288,12 @@ namespace OpenSim.Region.ScriptEngine.Common
2288 2288
2289 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer) 2289 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer)
2290 { 2290 {
2291 if(taskID != m_host.UUID) 2291 if (taskID != m_host.UUID)
2292 return; 2292 return;
2293 2293
2294 LLUUID invItemID=InventorySelf(); 2294 LLUUID invItemID=InventorySelf();
2295 2295
2296 if(invItemID == LLUUID.Zero) 2296 if (invItemID == LLUUID.Zero)
2297 return; 2297 return;
2298 2298
2299 client.OnScriptAnswer-=handleScriptAnswer; 2299 client.OnScriptAnswer-=handleScriptAnswer;
@@ -2310,7 +2310,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2310 2310
2311 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 2311 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
2312 { 2312 {
2313 if(item.Type == 10 && item.ItemID == m_itemID) 2313 if (item.Type == 10 && item.ItemID == m_itemID)
2314 { 2314 {
2315 return item.PermsGranter.ToString(); 2315 return item.PermsGranter.ToString();
2316 } 2316 }
@@ -2325,7 +2325,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2325 2325
2326 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 2326 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
2327 { 2327 {
2328 if(item.Type == 10 && item.ItemID == m_itemID) 2328 if (item.Type == 10 && item.ItemID == m_itemID)
2329 { 2329 {
2330 return item.PermsMask; 2330 return item.PermsMask;
2331 } 2331 }
@@ -2541,16 +2541,23 @@ namespace OpenSim.Region.ScriptEngine.Common
2541 // These functions are supposed to be robust, 2541 // These functions are supposed to be robust,
2542 // so get the state one step at a time. 2542 // so get the state one step at a time.
2543 2543
2544 if((item = ScriptByName(name)) != LLUUID.Zero) 2544 if ((item = ScriptByName(name)) != LLUUID.Zero)
2545 if((sm = m_ScriptEngine.m_ScriptManager) != null) 2545 {
2546 if(sm.Scripts.ContainsKey(m_localID)) 2546 if ((sm = m_ScriptEngine.m_ScriptManager) != null)
2547 if((script = sm.GetScript(m_localID, item)) != null) 2547 {
2548 script.Exec.Running = (run==0) ? false : true; 2548 if (sm.Scripts.ContainsKey(m_localID))
2549 2549 {
2550 if ((script = sm.GetScript(m_localID, item)) != null)
2551 {
2552 script.Exec.Running = (run==0) ? false : true;
2553 }
2554 }
2555 }
2556 }
2550 2557
2551 // Required by SL 2558 // Required by SL
2552 2559
2553 if(script == null) 2560 if (script == null)
2554 ShoutError("llSetScriptState: script "+name+" not found"); 2561 ShoutError("llSetScriptState: script "+name+" not found");
2555 2562
2556 // If we didn;t find it, then it's safe to 2563 // If we didn;t find it, then it's safe to
@@ -2709,7 +2716,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2709 partItemID = item.ItemID; 2716 partItemID = item.ItemID;
2710 Object[] resobj = new object[] 2717 Object[] resobj = new object[]
2711 { 2718 {
2712 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2719 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2713 }; 2720 };
2714 2721
2715 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2722 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2737,7 +2744,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2737 partItemID = item.ItemID; 2744 partItemID = item.ItemID;
2738 Object[] resobj = new object[] 2745 Object[] resobj = new object[]
2739 { 2746 {
2740 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2747 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2741 }; 2748 };
2742 2749
2743 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2750 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2767,7 +2774,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2767 partItemID = item.ItemID; 2774 partItemID = item.ItemID;
2768 Object[] resobj = new object[] 2775 Object[] resobj = new object[]
2769 { 2776 {
2770 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2777 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2771 }; 2778 };
2772 2779
2773 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2780 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2791,7 +2798,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2791 2798
2792 object[] resobj = new object[] 2799 object[] resobj = new object[]
2793 { 2800 {
2794 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2801 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2795 }; 2802 };
2796 2803
2797 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2804 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2819,7 +2826,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2819 partItemID = item.ItemID; 2826 partItemID = item.ItemID;
2820 Object[] resObjDef = new object[] 2827 Object[] resObjDef = new object[]
2821 { 2828 {
2822 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id) 2829 new LSL_Types.LSLInteger(m_host.LinkNum + 1), new LSL_Types.LSLInteger(num), new LSL_Types.LSLString(msg), new LSL_Types.LSLString(id)
2823 }; 2830 };
2824 2831
2825 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2832 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
@@ -2858,7 +2865,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2858 2865
2859 foreach (TaskInventoryItem item in m_host.TaskInventory.Values) 2866 foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
2860 { 2867 {
2861 if(item.Type == 10 && item.ItemID == m_itemID) 2868 if (item.Type == 10 && item.ItemID == m_itemID)
2862 { 2869 {
2863 result = item.Name!=null?item.Name:String.Empty; 2870 result = item.Name!=null?item.Name:String.Empty;
2864 break; 2871 break;
@@ -3013,9 +3020,9 @@ namespace OpenSim.Region.ScriptEngine.Common
3013 m_host.AddScriptLPS(1); 3020 m_host.AddScriptLPS(1);
3014 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) 3021 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
3015 { 3022 {
3016 if(inv.Value.Name == name) 3023 if (inv.Value.Name == name)
3017 { 3024 {
3018 if((inv.Value.OwnerMask & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) 3025 if ((inv.Value.OwnerMask & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
3019 { 3026 {
3020 return inv.Value.AssetID.ToString(); 3027 return inv.Value.AssetID.ToString();
3021 } 3028 }
@@ -3122,7 +3129,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3122 public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending) 3129 public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending)
3123 { 3130 {
3124 m_host.AddScriptLPS(1); 3131 m_host.AddScriptLPS(1);
3125 return src.Sort(stride, ascending); 3132 return src.Sort(stride, ascending);
3126 } 3133 }
3127 3134
3128 public int llGetListLength(LSL_Types.list src) 3135 public int llGetListLength(LSL_Types.list src)
@@ -3142,14 +3149,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3142 { 3149 {
3143 return 0; 3150 return 0;
3144 } 3151 }
3145 try 3152 try
3146 { 3153 {
3147 return Convert.ToInt32(src.Data[index]); 3154 return Convert.ToInt32(src.Data[index]);
3148 } 3155 }
3149 catch (FormatException e) 3156 catch (FormatException e)
3150 { 3157 {
3151 return 0; 3158 return 0;
3152 } 3159 }
3153 } 3160 }
3154 3161
3155 public double osList2Double(LSL_Types.list src, int index) 3162 public double osList2Double(LSL_Types.list src, int index)
@@ -3177,14 +3184,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3177 { 3184 {
3178 return 0.0; 3185 return 0.0;
3179 } 3186 }
3180 try 3187 try
3181 { 3188 {
3182 return Convert.ToDouble(src.Data[index]); 3189 return Convert.ToDouble(src.Data[index]);
3183 } 3190 }
3184 catch (FormatException e) 3191 catch (FormatException e)
3185 { 3192 {
3186 return 0.0; 3193 return 0.0;
3187 } 3194 }
3188 } 3195 }
3189 3196
3190 public string llList2String(LSL_Types.list src, int index) 3197 public string llList2String(LSL_Types.list src, int index)
@@ -3321,7 +3328,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3321 3328
3322 m_host.AddScriptLPS(1); 3329 m_host.AddScriptLPS(1);
3323 3330
3324 if(src.Data.Length > 0) 3331 if (src.Data.Length > 0)
3325 { 3332 {
3326 ret = src.Data[x++].ToString(); 3333 ret = src.Data[x++].ToString();
3327 for(;x<src.Data.Length;x++) 3334 for(;x<src.Data.Length;x++)
@@ -3361,12 +3368,12 @@ namespace OpenSim.Region.ScriptEngine.Common
3361 length++; 3368 length++;
3362 break; 3369 break;
3363 case '>' : 3370 case '>' :
3364 if(parens > 0) 3371 if (parens > 0)
3365 parens--; 3372 parens--;
3366 length++; 3373 length++;
3367 break; 3374 break;
3368 case ',' : 3375 case ',' :
3369 if(parens == 0) 3376 if (parens == 0)
3370 { 3377 {
3371 result.Add(src.Substring(start,length).Trim()); 3378 result.Add(src.Substring(start,length).Trim());
3372 start += length+1; 3379 start += length+1;
@@ -3411,14 +3418,14 @@ namespace OpenSim.Region.ScriptEngine.Common
3411 3418
3412 m_host.AddScriptLPS(1); 3419 m_host.AddScriptLPS(1);
3413 3420
3414 if(stride == 0) 3421 if (stride == 0)
3415 stride = 1; 3422 stride = 1;
3416 3423
3417 // Stride MUST be a factor of the list length 3424 // Stride MUST be a factor of the list length
3418 // If not, then return the src list. This also 3425 // If not, then return the src list. This also
3419 // traps those cases where stride > length. 3426 // traps those cases where stride > length.
3420 3427
3421 if(src.Length != stride && src.Length%stride == 0) 3428 if (src.Length != stride && src.Length%stride == 0)
3422 { 3429 {
3423 3430
3424 chunkk = src.Length/stride; 3431 chunkk = src.Length/stride;
@@ -3481,26 +3488,26 @@ namespace OpenSim.Region.ScriptEngine.Common
3481 3488
3482 // First step is always to deal with negative indices 3489 // First step is always to deal with negative indices
3483 3490
3484 if(start < 0) 3491 if (start < 0)
3485 start = src.Length+start; 3492 start = src.Length+start;
3486 if(end < 0) 3493 if (end < 0)
3487 end = src.Length+end; 3494 end = src.Length+end;
3488 3495
3489 // Out of bounds indices are OK, just trim them 3496 // Out of bounds indices are OK, just trim them
3490 // accordingly 3497 // accordingly
3491 3498
3492 if(start > src.Length) 3499 if (start > src.Length)
3493 start = src.Length; 3500 start = src.Length;
3494 3501
3495 if(end > src.Length) 3502 if (end > src.Length)
3496 end = src.Length; 3503 end = src.Length;
3497 3504
3498 // There may be one or two ranges to be considered 3505 // There may be one or two ranges to be considered
3499 3506
3500 if(start != end) 3507 if (start != end)
3501 { 3508 {
3502 3509
3503 if(start <= end) 3510 if (start <= end)
3504 { 3511 {
3505 si[0] = start; 3512 si[0] = start;
3506 ei[0] = end; 3513 ei[0] = end;
@@ -3521,23 +3528,23 @@ namespace OpenSim.Region.ScriptEngine.Common
3521 // A negative stride reverses the direction of the 3528 // A negative stride reverses the direction of the
3522 // scan producing an inverted list as a result. 3529 // scan producing an inverted list as a result.
3523 3530
3524 if(stride == 0) 3531 if (stride == 0)
3525 stride = 1; 3532 stride = 1;
3526 3533
3527 if(stride > 0) 3534 if (stride > 0)
3528 for(int i=0;i<src.Length;i+=stride) 3535 for(int i=0;i<src.Length;i+=stride)
3529 { 3536 {
3530 if(i<=ei[0] && i>=si[0]) 3537 if (i<=ei[0] && i>=si[0])
3531 result.Add(src.Data[i]); 3538 result.Add(src.Data[i]);
3532 if(twopass && i>=si[1] && i<=ei[1]) 3539 if (twopass && i>=si[1] && i<=ei[1])
3533 result.Add(src.Data[i]); 3540 result.Add(src.Data[i]);
3534 } 3541 }
3535 else if(stride < 0) 3542 else if (stride < 0)
3536 for(int i=src.Length-1;i>=0;i+=stride) 3543 for(int i=src.Length-1;i>=0;i+=stride)
3537 { 3544 {
3538 if(i<=ei[0] && i>=si[0]) 3545 if (i<=ei[0] && i>=si[0])
3539 result.Add(src.Data[i]); 3546 result.Add(src.Data[i]);
3540 if(twopass && i>=si[1] && i<=ei[1]) 3547 if (twopass && i>=si[1] && i<=ei[1])
3541 result.Add(src.Data[i]); 3548 result.Add(src.Data[i]);
3542 } 3549 }
3543 } 3550 }
@@ -3566,19 +3573,19 @@ namespace OpenSim.Region.ScriptEngine.Common
3566 3573
3567 m_host.AddScriptLPS(1); 3574 m_host.AddScriptLPS(1);
3568 3575
3569 if(index < 0) 3576 if (index < 0)
3570 { 3577 {
3571 index = index+dest.Length; 3578 index = index+dest.Length;
3572 if(index < 0) 3579 if (index < 0)
3573 { 3580 {
3574 index = 0; 3581 index = 0;
3575 } 3582 }
3576 } 3583 }
3577 3584
3578 if(index != 0) 3585 if (index != 0)
3579 { 3586 {
3580 pref = dest.GetSublist(0,index-1); 3587 pref = dest.GetSublist(0,index-1);
3581 if(index < dest.Length) 3588 if (index < dest.Length)
3582 { 3589 {
3583 suff = dest.GetSublist(index,-1); 3590 suff = dest.GetSublist(index,-1);
3584 return pref + src + suff; 3591 return pref + src + suff;
@@ -3590,7 +3597,7 @@ namespace OpenSim.Region.ScriptEngine.Common
3590 } 3597 }
3591 else 3598 else
3592 { 3599 {
3593 if(index < dest.Length) 3600 if (index < dest.Length)
3594 { 3601 {
3595 suff = dest.GetSublist(index,-1); 3602 suff = dest.GetSublist(index,-1);
3596 return src + suff; 3603 return src + suff;
@@ -3618,17 +3625,17 @@ namespace OpenSim.Region.ScriptEngine.Common
3618 3625
3619 // If either list is empty, do not match 3626 // If either list is empty, do not match
3620 3627
3621 if(src.Length != 0 && test.Length != 0) 3628 if (src.Length != 0 && test.Length != 0)
3622 { 3629 {
3623 for(int i=0; i< length; i++) 3630 for(int i=0; i< length; i++)
3624 { 3631 {
3625 if(src.Data[i].Equals(test.Data[0])) 3632 if (src.Data[i].Equals(test.Data[0]))
3626 { 3633 {
3627 int j; 3634 int j;
3628 for(j=1;j<test.Length;j++) 3635 for(j=1;j<test.Length;j++)
3629 if(!src.Data[i+j].Equals(test.Data[j])) 3636 if (!src.Data[i+j].Equals(test.Data[j]))
3630 break; 3637 break;
3631 if(j == test.Length) 3638 if (j == test.Length)
3632 { 3639 {
3633 index = i; 3640 index = i;
3634 break; 3641 break;
@@ -4292,7 +4299,7 @@ namespace OpenSim.Region.ScriptEngine.Common
4292 LSLError("First parameter to llDialog needs to be a key"); 4299 LSLError("First parameter to llDialog needs to be a key");
4293 return; 4300 return;
4294 } 4301 }
4295 if(buttons.Length > 12) 4302 if (buttons.Length > 12)
4296 { 4303 {
4297 LSLError("No more than 12 buttons can be shown"); 4304 LSLError("No more than 12 buttons can be shown");
4298 return; 4305 return;
@@ -4300,12 +4307,12 @@ namespace OpenSim.Region.ScriptEngine.Common
4300 string[] buts = new string[buttons.Length]; 4307 string[] buts = new string[buttons.Length];
4301 for(int i = 0; i < buttons.Length; i++) 4308 for(int i = 0; i < buttons.Length; i++)
4302 { 4309 {
4303 if(buttons.Data[i].ToString() == String.Empty) 4310 if (buttons.Data[i].ToString() == String.Empty)
4304 { 4311 {
4305 LSLError("button label cannot be blank"); 4312 LSLError("button label cannot be blank");
4306 return; 4313 return;
4307 } 4314 }
4308 if(buttons.Data[i].ToString().Length > 24) 4315 if (buttons.Data[i].ToString().Length > 24)
4309 { 4316 {
4310 LSLError("button label cannot be longer than 24 characters"); 4317 LSLError("button label cannot be longer than 24 characters");
4311 return; 4318 return;
@@ -4338,13 +4345,13 @@ namespace OpenSim.Region.ScriptEngine.Common
4338 // These functions are supposed to be robust, 4345 // These functions are supposed to be robust,
4339 // so get the state one step at a time. 4346 // so get the state one step at a time.
4340 4347
4341 if((item = ScriptByName(name)) != LLUUID.Zero) 4348 if ((item = ScriptByName(name)) != LLUUID.Zero)
4342 if((sm = m_ScriptEngine.m_ScriptManager) != null) 4349 if ((sm = m_ScriptEngine.m_ScriptManager) != null)
4343 sm.ResetScript(m_localID, item); 4350 sm.ResetScript(m_localID, item);
4344 4351
4345 // Required by SL 4352 // Required by SL
4346 4353
4347 if(script == null) 4354 if (script == null)
4348 ShoutError("llResetOtherScript: script "+name+" not found"); 4355 ShoutError("llResetOtherScript: script "+name+" not found");
4349 4356
4350 // If we didn;t find it, then it's safe to 4357 // If we didn;t find it, then it's safe to
@@ -4366,14 +4373,20 @@ namespace OpenSim.Region.ScriptEngine.Common
4366 // These functions are supposed to be robust, 4373 // These functions are supposed to be robust,
4367 // so get the state one step at a time. 4374 // so get the state one step at a time.
4368 4375
4369 if((item = ScriptByName(name)) != LLUUID.Zero) 4376 if ((item = ScriptByName(name)) != LLUUID.Zero)
4370 if((sm = m_ScriptEngine.m_ScriptManager) != null) 4377 {
4371 if((script = sm.GetScript(m_localID, item)) != null) 4378 if ((sm = m_ScriptEngine.m_ScriptManager) != null)
4379 {
4380 if ((script = sm.GetScript(m_localID, item)) != null)
4381 {
4372 return script.Exec.Running?1:0; 4382 return script.Exec.Running?1:0;
4383 }
4384 }
4385 }
4373 4386
4374 // Required by SL 4387 // Required by SL
4375 4388
4376 if(script == null) 4389 if (script == null)
4377 ShoutError("llGetScriptState: script "+name+" not found"); 4390 ShoutError("llGetScriptState: script "+name+" not found");
4378 4391
4379 // If we didn;t find it, then it's safe to 4392 // If we didn;t find it, then it's safe to
@@ -4447,107 +4460,107 @@ namespace OpenSim.Region.ScriptEngine.Common
4447 4460
4448 public void llSetPrimitiveParams(LSL_Types.list rules) 4461 public void llSetPrimitiveParams(LSL_Types.list rules)
4449 { 4462 {
4450 llSetLinkPrimitiveParams(m_host.LinkNum+1, rules); 4463 llSetLinkPrimitiveParams(m_host.LinkNum+1, rules);
4451 } 4464 }
4452 4465
4453 public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules) 4466 public void llSetLinkPrimitiveParams(int linknumber, LSL_Types.list rules)
4454 { 4467 {
4455 m_host.AddScriptLPS(1); 4468 m_host.AddScriptLPS(1);
4456 4469
4457 SceneObjectPart part=null; 4470 SceneObjectPart part=null;
4458 4471
4459 if(m_host.LinkNum+1 != linknumber) 4472 if (m_host.LinkNum+1 != linknumber)
4460 { 4473 {
4461 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) 4474 foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
4462 { 4475 {
4463 if ((partInst.LinkNum + 1) == linknumber) 4476 if ((partInst.LinkNum + 1) == linknumber)
4464 { 4477 {
4465 part=partInst; 4478 part=partInst;
4466 break; 4479 break;
4467 } 4480 }
4468 } 4481 }
4469 } 4482 }
4470 else 4483 else
4471 { 4484 {
4472 part=m_host; 4485 part=m_host;
4473 } 4486 }
4474 4487
4475 if(part == null) 4488 if (part == null)
4476 return; 4489 return;
4477 4490
4478 4491
4479 int idx=0; 4492 int idx=0;
4480 4493
4481 while(idx < rules.Length) 4494 while(idx < rules.Length)
4482 { 4495 {
4483 int code=Convert.ToInt32(rules.Data[idx++]); 4496 int code=Convert.ToInt32(rules.Data[idx++]);
4484 4497
4485 int remain=rules.Length-idx; 4498 int remain=rules.Length-idx;
4486 4499
4487 int face; 4500 int face;
4488 LSL_Types.Vector3 v; 4501 LSL_Types.Vector3 v;
4489 4502
4490 switch(code) 4503 switch(code)
4491 { 4504 {
4492 case 6: // PRIM_POSITION 4505 case 6: // PRIM_POSITION
4493 if(remain < 1) 4506 if (remain < 1)
4494 return; 4507 return;
4495 4508
4496 v=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 4509 v=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4497 SetPos(part, v); 4510 SetPos(part, v);
4498 4511
4499 break; 4512 break;
4500 4513
4501 case 8: // PRIM_ROTATION 4514 case 8: // PRIM_ROTATION
4502 if(remain < 1) 4515 if (remain < 1)
4503 return; 4516 return;
4504 4517
4505 LSL_Types.Quaternion q = new LSL_Types.Quaternion(rules.Data[idx++].ToString()); 4518 LSL_Types.Quaternion q = new LSL_Types.Quaternion(rules.Data[idx++].ToString());
4506 SetRot(part, q); 4519 SetRot(part, q);
4507 4520
4508 break; 4521 break;
4509 4522
4510 case 17: // PRIM_TEXTURE 4523 case 17: // PRIM_TEXTURE
4511 if(remain < 5) 4524 if (remain < 5)
4512 return; 4525 return;
4513 4526
4514 face=Convert.ToInt32(rules.Data[idx++]); 4527 face=Convert.ToInt32(rules.Data[idx++]);
4515 string tex=rules.Data[idx++].ToString(); 4528 string tex=rules.Data[idx++].ToString();
4516 LSL_Types.Vector3 repeats=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 4529 LSL_Types.Vector3 repeats=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4517 LSL_Types.Vector3 offsets=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 4530 LSL_Types.Vector3 offsets=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4518 double rotation=Convert.ToDouble(rules.Data[idx++]); 4531 double rotation=Convert.ToDouble(rules.Data[idx++]);
4519 4532
4520 SetTexture(part, tex, face); 4533 SetTexture(part, tex, face);
4521 ScaleTexture(part, repeats.x, repeats.y, face); 4534 ScaleTexture(part, repeats.x, repeats.y, face);
4522 OffsetTexture(part, offsets.x, offsets.y, face); 4535 OffsetTexture(part, offsets.x, offsets.y, face);
4523 RotateTexture(part, rotation, face); 4536 RotateTexture(part, rotation, face);
4524 4537
4525 break; 4538 break;
4526 4539
4527 case 18: // PRIM_COLOR 4540 case 18: // PRIM_COLOR
4528 if(remain < 3) 4541 if (remain < 3)
4529 return; 4542 return;
4530 4543
4531 face=Convert.ToInt32(rules.Data[idx++]); 4544 face=Convert.ToInt32(rules.Data[idx++]);
4532 LSL_Types.Vector3 color=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 4545 LSL_Types.Vector3 color=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4533 double alpha=Convert.ToDouble(rules.Data[idx++]); 4546 double alpha=Convert.ToDouble(rules.Data[idx++]);
4534 4547
4535 SetColor(part, color, face); 4548 SetColor(part, color, face);
4536 SetAlpha(part, alpha, face); 4549 SetAlpha(part, alpha, face);
4537 4550
4538 break; 4551 break;
4539 4552
4540 case 7: // PRIM_SIZE 4553 case 7: // PRIM_SIZE
4541 if(remain < 1) 4554 if (remain < 1)
4542 return; 4555 return;
4543 4556
4544 v=new LSL_Types.Vector3(rules.Data[idx++].ToString()); 4557 v=new LSL_Types.Vector3(rules.Data[idx++].ToString());
4545 SetScale(part, v); 4558 SetScale(part, v);
4546 4559
4547 break; 4560 break;
4548 4561
4549 } 4562 }
4550 } 4563 }
4551 } 4564 }
4552 4565
4553 public string llStringToBase64(string str) 4566 public string llStringToBase64(string str)
@@ -4637,12 +4650,12 @@ namespace OpenSim.Region.ScriptEngine.Common
4637 m_host.AddScriptLPS(1); 4650 m_host.AddScriptLPS(1);
4638 LLUUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); 4651 LLUUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
4639 4652
4640 if(landowner == LLUUID.Zero) 4653 if (landowner == LLUUID.Zero)
4641 { 4654 {
4642 return; 4655 return;
4643 } 4656 }
4644 4657
4645 if(landowner != m_host.ObjectOwner) 4658 if (landowner != m_host.ObjectOwner)
4646 { 4659 {
4647 return; 4660 return;
4648 } 4661 }
@@ -5000,7 +5013,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5000 5013
5001 // Require a well-fromed base64 string 5014 // Require a well-fromed base64 string
5002 5015
5003 if(str.Length > 8) 5016 if (str.Length > 8)
5004 return 0; 5017 return 0;
5005 5018
5006 // The loop is unrolled in the interests 5019 // The loop is unrolled in the interests
@@ -5010,37 +5023,37 @@ namespace OpenSim.Region.ScriptEngine.Common
5010 // -1 == invalid 5023 // -1 == invalid
5011 // 0 == padding 5024 // 0 == padding
5012 5025
5013 if((digit=c2itable[str[0]])<=0) 5026 if ((digit=c2itable[str[0]])<=0)
5014 { 5027 {
5015 return digit<0?(int)0:number; 5028 return digit<0?(int)0:number;
5016 } 5029 }
5017 number += --digit<<26; 5030 number += --digit<<26;
5018 5031
5019 if((digit=c2itable[str[1]])<=0) 5032 if ((digit=c2itable[str[1]])<=0)
5020 { 5033 {
5021 return digit<0?(int)0:number; 5034 return digit<0?(int)0:number;
5022 } 5035 }
5023 number += --digit<<20; 5036 number += --digit<<20;
5024 5037
5025 if((digit=c2itable[str[2]])<=0) 5038 if ((digit=c2itable[str[2]])<=0)
5026 { 5039 {
5027 return digit<0?(int)0:number; 5040 return digit<0?(int)0:number;
5028 } 5041 }
5029 number += --digit<<14; 5042 number += --digit<<14;
5030 5043
5031 if((digit=c2itable[str[3]])<=0) 5044 if ((digit=c2itable[str[3]])<=0)
5032 { 5045 {
5033 return digit<0?(int)0:number; 5046 return digit<0?(int)0:number;
5034 } 5047 }
5035 number += --digit<<8; 5048 number += --digit<<8;
5036 5049
5037 if((digit=c2itable[str[4]])<=0) 5050 if ((digit=c2itable[str[4]])<=0)
5038 { 5051 {
5039 return digit<0?(int)0:number; 5052 return digit<0?(int)0:number;
5040 } 5053 }
5041 number += --digit<<2; 5054 number += --digit<<2;
5042 5055
5043 if((digit=c2itable[str[5]])<=0) 5056 if ((digit=c2itable[str[5]])<=0)
5044 { 5057 {
5045 return digit<0?(int)0:number; 5058 return digit<0?(int)0:number;
5046 } 5059 }
@@ -5156,21 +5169,21 @@ namespace OpenSim.Region.ScriptEngine.Common
5156 5169
5157 for(j=0; j<seplen; j++) 5170 for(j=0; j<seplen; j++)
5158 { 5171 {
5159 if(active[j]) 5172 if (active[j])
5160 { 5173 {
5161 // scan all of the markers 5174 // scan all of the markers
5162 if((offset[j] = src.IndexOf((string)separray[j],beginning)) == -1) 5175 if ((offset[j] = src.IndexOf((string)separray[j],beginning)) == -1)
5163 { 5176 {
5164 // not present at all 5177 // not present at all
5165 active[j] = false; 5178 active[j] = false;
5166 } else 5179 } else
5167 { 5180 {
5168 // present and correct 5181 // present and correct
5169 if(offset[j] < offset[best]) 5182 if (offset[j] < offset[best])
5170 { 5183 {
5171 // closest so far 5184 // closest so far
5172 best = j; 5185 best = j;
5173 if(offset[best] == beginning) 5186 if (offset[best] == beginning)
5174 break; 5187 break;
5175 } 5188 }
5176 } 5189 }
@@ -5179,21 +5192,21 @@ namespace OpenSim.Region.ScriptEngine.Common
5179 5192
5180 // Scan for spacers 5193 // Scan for spacers
5181 5194
5182 if(offset[best] != beginning) 5195 if (offset[best] != beginning)
5183 { 5196 {
5184 for(j=seplen; (j<mlen) && (offset[best] > beginning); j++) 5197 for(j=seplen; (j<mlen) && (offset[best] > beginning); j++)
5185 { 5198 {
5186 if(active[j]) 5199 if (active[j])
5187 { 5200 {
5188 // scan all of the markers 5201 // scan all of the markers
5189 if((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1) 5202 if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1)
5190 { 5203 {
5191 // not present at all 5204 // not present at all
5192 active[j] = false; 5205 active[j] = false;
5193 } else 5206 } else
5194 { 5207 {
5195 // present and correct 5208 // present and correct
5196 if(offset[j] < offset[best]) 5209 if (offset[j] < offset[best])
5197 { 5210 {
5198 // closest so far 5211 // closest so far
5199 best = j; 5212 best = j;
@@ -5205,7 +5218,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5205 5218
5206 // This is the normal exit from the scanning loop 5219 // This is the normal exit from the scanning loop
5207 5220
5208 if(best == mlen) 5221 if (best == mlen)
5209 { 5222 {
5210 // no markers were found on this pass 5223 // no markers were found on this pass
5211 // so we're pretty much done 5224 // so we're pretty much done
@@ -5218,7 +5231,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5218 5231
5219 tokens.Add(src.Substring(beginning,offset[best]-beginning)); 5232 tokens.Add(src.Substring(beginning,offset[best]-beginning));
5220 5233
5221 if(best<seplen) 5234 if (best<seplen)
5222 { 5235 {
5223 beginning = offset[best]+((string)separray[best]).Length; 5236 beginning = offset[best]+((string)separray[best]).Length;
5224 } else 5237 } else
@@ -5235,9 +5248,9 @@ namespace OpenSim.Region.ScriptEngine.Common
5235 // arduous. Alternatively the 'break' could be replced with a return 5248 // arduous. Alternatively the 'break' could be replced with a return
5236 // but that's shabby programming. 5249 // but that's shabby programming.
5237 5250
5238 if(beginning == srclen) 5251 if (beginning == srclen)
5239 { 5252 {
5240 if(srclen != 0) 5253 if (srclen != 0)
5241 tokens.Add(""); 5254 tokens.Add("");
5242 } 5255 }
5243 5256
@@ -5418,30 +5431,30 @@ namespace OpenSim.Region.ScriptEngine.Common
5418 5431
5419 // Note that although we have normalized, both 5432 // Note that although we have normalized, both
5420 // indices could still be negative. 5433 // indices could still be negative.
5421 if(start < 0) 5434 if (start < 0)
5422 { 5435 {
5423 start = start+dest.Length; 5436 start = start+dest.Length;
5424 } 5437 }
5425 5438
5426 if(end < 0) 5439 if (end < 0)
5427 { 5440 {
5428 end = end+dest.Length; 5441 end = end+dest.Length;
5429 } 5442 }
5430 // The comventional case, remove a sequence starting with 5443 // The comventional case, remove a sequence starting with
5431 // start and ending with end. And then insert the source 5444 // start and ending with end. And then insert the source
5432 // list. 5445 // list.
5433 if(start <= end) 5446 if (start <= end)
5434 { 5447 {
5435 // If greater than zero, then there is going to be a 5448 // If greater than zero, then there is going to be a
5436 // surviving prefix. Otherwise the inclusive nature 5449 // surviving prefix. Otherwise the inclusive nature
5437 // of the indices mean that we're going to add the 5450 // of the indices mean that we're going to add the
5438 // source list as a prefix. 5451 // source list as a prefix.
5439 if(start > 0) 5452 if (start > 0)
5440 { 5453 {
5441 pref = dest.GetSublist(0,start-1); 5454 pref = dest.GetSublist(0,start-1);
5442 // Only add a suffix if there is something 5455 // Only add a suffix if there is something
5443 // beyond the end index (it's inclusive too). 5456 // beyond the end index (it's inclusive too).
5444 if(end+1 < dest.Length) 5457 if (end+1 < dest.Length)
5445 { 5458 {
5446 return pref + src + dest.GetSublist(end+1,-1); 5459 return pref + src + dest.GetSublist(end+1,-1);
5447 } 5460 }
@@ -5458,7 +5471,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5458 // is removed. 5471 // is removed.
5459 else 5472 else
5460 { 5473 {
5461 if(end+1 < dest.Length) 5474 if (end+1 < dest.Length)
5462 { 5475 {
5463 return src + dest.GetSublist(end+1,-1); 5476 return src + dest.GetSublist(end+1,-1);
5464 } 5477 }
@@ -5525,7 +5538,7 @@ namespace OpenSim.Region.ScriptEngine.Common
5525 { 5538 {
5526 m_host.AddScriptLPS(1); 5539 m_host.AddScriptLPS(1);
5527 5540
5528 if(quick_pay_buttons.Data.Length != 4) 5541 if (quick_pay_buttons.Data.Length != 4)
5529 { 5542 {
5530 LSLError("List must have 4 elements"); 5543 LSLError("List must have 4 elements");
5531 return; 5544 return;
@@ -5798,14 +5811,14 @@ namespace OpenSim.Region.ScriptEngine.Common
5798 5811
5799 LandData land = World.GetLandData((float)pos.x, (float)pos.y); 5812 LandData land = World.GetLandData((float)pos.x, (float)pos.y);
5800 5813
5801 if(land == null) 5814 if (land == null)
5802 { 5815 {
5803 return 0; 5816 return 0;
5804 } 5817 }
5805 5818
5806 else 5819 else
5807 { 5820 {
5808 if(sim_wide == 1) 5821 if (sim_wide == 1)
5809 { 5822 {
5810 if (category == 0) 5823 if (category == 0)
5811 { 5824 {
@@ -5821,32 +5834,32 @@ namespace OpenSim.Region.ScriptEngine.Common
5821 5834
5822 else 5835 else
5823 { 5836 {
5824 if(category == 0)//Total Prims 5837 if (category == 0)//Total Prims
5825 { 5838 {
5826 return 0;//land. 5839 return 0;//land.
5827 } 5840 }
5828 5841
5829 else if(category == 1)//Owner Prims 5842 else if (category == 1)//Owner Prims
5830 { 5843 {
5831 return land.ownerPrims; 5844 return land.ownerPrims;
5832 } 5845 }
5833 5846
5834 else if(category == 2)//Group Prims 5847 else if (category == 2)//Group Prims
5835 { 5848 {
5836 return land.groupPrims; 5849 return land.groupPrims;
5837 } 5850 }
5838 5851
5839 else if(category == 3)//Other Prims 5852 else if (category == 3)//Other Prims
5840 { 5853 {
5841 return land.otherPrims; 5854 return land.otherPrims;
5842 } 5855 }
5843 5856
5844 else if(category == 4)//Selected 5857 else if (category == 4)//Selected
5845 { 5858 {
5846 return land.selectedPrims; 5859 return land.selectedPrims;
5847 } 5860 }
5848 5861
5849 else if(category == 5)//Temp 5862 else if (category == 5)//Temp
5850 { 5863 {
5851 return 0;//land. 5864 return 0;//land.
5852 } 5865 }
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index edd16a7..923b81e 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -64,11 +64,11 @@ namespace OpenSim.Region.ScriptEngine.Common
64 str = str.Replace('<', ' '); 64 str = str.Replace('<', ' ');
65 str = str.Replace('>', ' '); 65 str = str.Replace('>', ' ');
66 string[] tmps = str.Split(new Char[] { ',', '<', '>' }); 66 string[] tmps = str.Split(new Char[] { ',', '<', '>' });
67 if(tmps.Length < 3) 67 if (tmps.Length < 3)
68 { 68 {
69 x=y=z=0; 69 x=y=z=0;
70 return; 70 return;
71 } 71 }
72 bool res; 72 bool res;
73 res = Double.TryParse(tmps[0], out x); 73 res = Double.TryParse(tmps[0], out x);
74 res = res & Double.TryParse(tmps[1], out y); 74 res = res & Double.TryParse(tmps[1], out y);
@@ -81,26 +81,26 @@ namespace OpenSim.Region.ScriptEngine.Common
81 81
82 public override string ToString() 82 public override string ToString()
83 { 83 {
84 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z); 84 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", x, y, z);
85 return s; 85 return s;
86 } 86 }
87 87
88 public static explicit operator LSLString(Vector3 vec) 88 public static explicit operator LSLString(Vector3 vec)
89 { 89 {
90 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); 90 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
91 return new LSLString(s); 91 return new LSLString(s);
92 } 92 }
93 93
94 public static explicit operator string(Vector3 vec) 94 public static explicit operator string(Vector3 vec)
95 { 95 {
96 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z); 96 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000}>", vec.x, vec.y, vec.z);
97 return s; 97 return s;
98 } 98 }
99 99
100 public static explicit operator Vector3(string s) 100 public static explicit operator Vector3(string s)
101 { 101 {
102 return new Vector3(s); 102 return new Vector3(s);
103 } 103 }
104 104
105 public static bool operator ==(Vector3 lhs, Vector3 rhs) 105 public static bool operator ==(Vector3 lhs, Vector3 rhs)
106 { 106 {
@@ -296,11 +296,11 @@ namespace OpenSim.Region.ScriptEngine.Common
296 str = str.Replace('<', ' '); 296 str = str.Replace('<', ' ');
297 str = str.Replace('>', ' '); 297 str = str.Replace('>', ' ');
298 string[] tmps = str.Split(new Char[] { ',', '<', '>' }); 298 string[] tmps = str.Split(new Char[] { ',', '<', '>' });
299 if(tmps.Length < 4) 299 if (tmps.Length < 4)
300 { 300 {
301 x=y=z=s=0; 301 x=y=z=s=0;
302 return; 302 return;
303 } 303 }
304 bool res; 304 bool res;
305 res = Double.TryParse(tmps[0], out x); 305 res = Double.TryParse(tmps[0], out x);
306 res = res & Double.TryParse(tmps[1], out y); 306 res = res & Double.TryParse(tmps[1], out y);
@@ -330,26 +330,26 @@ namespace OpenSim.Region.ScriptEngine.Common
330 330
331 public override string ToString() 331 public override string ToString()
332 { 332 {
333 string st=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", x, y, z, s); 333 string st=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", x, y, z, s);
334 return st; 334 return st;
335 } 335 }
336 336
337 public static explicit operator string(Quaternion r) 337 public static explicit operator string(Quaternion r)
338 { 338 {
339 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s); 339 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s);
340 return s; 340 return s;
341 } 341 }
342 342
343 public static explicit operator LSLString(Quaternion r) 343 public static explicit operator LSLString(Quaternion r)
344 { 344 {
345 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s); 345 string s=String.Format("<{0:0.000000},{1:0.000000},{2:0.000000},{3:0.000000}>", r.x, r.y, r.z, r.s);
346 return new LSLString(s); 346 return new LSLString(s);
347 } 347 }
348 348
349 public static explicit operator Quaternion(string s) 349 public static explicit operator Quaternion(string s)
350 { 350 {
351 return new Quaternion(s); 351 return new Quaternion(s);
352 } 352 }
353 353
354 public static bool operator ==(Quaternion lhs, Quaternion rhs) 354 public static bool operator ==(Quaternion lhs, Quaternion rhs)
355 { 355 {
@@ -406,19 +406,19 @@ namespace OpenSim.Region.ScriptEngine.Common
406 public int Length 406 public int Length
407 { 407 {
408 get { 408 get {
409 if(m_data == null) 409 if (m_data == null)
410 m_data=new Object[0]; 410 m_data=new Object[0];
411 return m_data.Length; 411 return m_data.Length;
412 } 412 }
413 } 413 }
414 414
415 public object[] Data 415 public object[] Data
416 { 416 {
417 get { 417 get {
418 if(m_data == null) 418 if (m_data == null)
419 m_data=new Object[0]; 419 m_data=new Object[0];
420 return m_data; 420 return m_data;
421 } 421 }
422 } 422 }
423 423
424 public static list operator +(list a, list b) 424 public static list operator +(list a, list b)
@@ -453,67 +453,67 @@ namespace OpenSim.Region.ScriptEngine.Common
453 return ret; 453 return ret;
454 } 454 }
455 455
456 public list DeleteSublist(int start, int end) 456 public list DeleteSublist(int start, int end)
457 { 457 {
458 // Not an easy one 458 // Not an easy one
459 // If start <= end, remove that part 459 // If start <= end, remove that part
460 // if either is negative, count from the end of the array 460 // if either is negative, count from the end of the array
461 // if the resulting start > end, remove all BUT that part 461 // if the resulting start > end, remove all BUT that part
462 462
463 Object[] ret; 463 Object[] ret;
464 464
465 if(start < 0) 465 if (start < 0)
466 start=m_data.Length-start; 466 start=m_data.Length-start;
467 467
468 if(start < 0) 468 if (start < 0)
469 start=0; 469 start=0;
470 470
471 if(end < 0) 471 if (end < 0)
472 end=m_data.Length-end; 472 end=m_data.Length-end;
473 if(end < 0) 473 if (end < 0)
474 end=0; 474 end=0;
475 475
476 if(start > end) 476 if (start > end)
477 { 477 {
478 if(end >= m_data.Length) 478 if (end >= m_data.Length)
479 return new list(new Object[0]); 479 return new list(new Object[0]);
480 480
481 if(start >= m_data.Length) 481 if (start >= m_data.Length)
482 start=m_data.Length-1; 482 start=m_data.Length-1;
483 483
484 return GetSublist(end, start); 484 return GetSublist(end, start);
485 } 485 }
486 486
487 // start >= 0 && end >= 0 here 487 // start >= 0 && end >= 0 here
488 if(start >= m_data.Length) 488 if (start >= m_data.Length)
489 { 489 {
490 ret=new Object[m_data.Length]; 490 ret=new Object[m_data.Length];
491 Array.Copy(m_data, 0, ret, 0, m_data.Length); 491 Array.Copy(m_data, 0, ret, 0, m_data.Length);
492 492
493 return new list(ret); 493 return new list(ret);
494 } 494 }
495 495
496 if(end >= m_data.Length) 496 if (end >= m_data.Length)
497 end=m_data.Length-1; 497 end=m_data.Length-1;
498 498
499 // now, this makes the math easier 499 // now, this makes the math easier
500 int remove=end+1-start; 500 int remove=end+1-start;
501 501
502 ret=new Object[m_data.Length-remove]; 502 ret=new Object[m_data.Length-remove];
503 if(ret.Length == 0) 503 if (ret.Length == 0)
504 return new list(ret); 504 return new list(ret);
505 505
506 int src; 506 int src;
507 int dest=0; 507 int dest=0;
508 508
509 for(src = 0 ; src < m_data.Length ; src++) 509 for(src = 0 ; src < m_data.Length ; src++)
510 { 510 {
511 if(src < start || src > end) 511 if (src < start || src > end)
512 ret[dest++]=m_data[src]; 512 ret[dest++]=m_data[src];
513 } 513 }
514 514
515 return new list(ret); 515 return new list(ret);
516 } 516 }
517 517
518 public list GetSublist(int start, int end) 518 public list GetSublist(int start, int end)
519 { 519 {
@@ -581,13 +581,13 @@ namespace OpenSim.Region.ScriptEngine.Common
581 list result = null; 581 list result = null;
582 582
583 // If end is negative, then prefix list is empty 583 // If end is negative, then prefix list is empty
584 if(end < 0) 584 if (end < 0)
585 { 585 {
586 result = new list(); 586 result = new list();
587 // If start is still negative, then the whole of 587 // If start is still negative, then the whole of
588 // the existing list is returned. This case is 588 // the existing list is returned. This case is
589 // only admitted if end is also still negative. 589 // only admitted if end is also still negative.
590 if(start < 0) 590 if (start < 0)
591 { 591 {
592 return this; 592 return this;
593 } 593 }
@@ -600,7 +600,7 @@ namespace OpenSim.Region.ScriptEngine.Common
600 600
601 // If start is outside of list, then just return 601 // If start is outside of list, then just return
602 // the prefix, whatever it is. 602 // the prefix, whatever it is.
603 if(start >= m_data.Length) 603 if (start >= m_data.Length)
604 { 604 {
605 return result; 605 return result;
606 } 606 }
@@ -610,76 +610,76 @@ namespace OpenSim.Region.ScriptEngine.Common
610 } 610 }
611 } 611 }
612 612
613 public list Sort(int stride, int ascending) 613 public list Sort(int stride, int ascending)
614 { 614 {
615 if(Data.Length == 0) 615 if (Data.Length == 0)
616 return new list(); // Don't even bother 616 return new list(); // Don't even bother
617 617
618 string[] keys; 618 string[] keys;
619 619
620 if(stride == 1) // The simple case 620 if (stride == 1) // The simple case
621 { 621 {
622 Object[] ret=new Object[Data.Length]; 622 Object[] ret=new Object[Data.Length];
623 623
624 Array.Copy(Data, 0, ret, 0, Data.Length); 624 Array.Copy(Data, 0, ret, 0, Data.Length);
625 625
626 keys=new string[Data.Length]; 626 keys=new string[Data.Length];
627 int k; 627 int k;
628 for(k=0;k<Data.Length;k++) 628 for(k=0;k<Data.Length;k++)
629 keys[k]=Data[k].ToString(); 629 keys[k]=Data[k].ToString();
630 630
631 Array.Sort(keys, ret); 631 Array.Sort(keys, ret);
632 632
633 if(ascending == 0) 633 if (ascending == 0)
634 Array.Reverse(ret); 634 Array.Reverse(ret);
635 return new list(ret); 635 return new list(ret);
636 } 636 }
637 637
638 int src=0; 638 int src=0;
639 639
640 int len=(Data.Length+stride-1)/stride; 640 int len=(Data.Length+stride-1)/stride;
641 641
642 keys=new string[len]; 642 keys=new string[len];
643 Object[][] vals=new Object[len][]; 643 Object[][] vals=new Object[len][];
644 644
645 int i; 645 int i;
646 646
647 while(src < Data.Length) 647 while(src < Data.Length)
648 { 648 {
649 Object[] o=new Object[stride]; 649 Object[] o=new Object[stride];
650 650
651 for(i=0;i<stride;i++) 651 for(i=0;i<stride;i++)
652 { 652 {
653 if(src < Data.Length) 653 if (src < Data.Length)
654 o[i]=Data[src++]; 654 o[i]=Data[src++];
655 else 655 else
656 { 656 {
657 o[i]=new Object(); 657 o[i]=new Object();
658 src++; 658 src++;
659 } 659 }
660 } 660 }
661 661
662 int idx=src/stride-1; 662 int idx=src/stride-1;
663 keys[idx]=o[0].ToString(); 663 keys[idx]=o[0].ToString();
664 vals[idx]=o; 664 vals[idx]=o;
665 } 665 }
666 666
667 Array.Sort(keys, vals); 667 Array.Sort(keys, vals);
668 if(ascending == 0) 668 if (ascending == 0)
669 { 669 {
670 Array.Reverse(vals); 670 Array.Reverse(vals);
671 } 671 }
672 672
673 Object[] sorted=new Object[stride*vals.Length]; 673 Object[] sorted=new Object[stride*vals.Length];
674 674
675 int j; 675 int j;
676 676
677 for(i=0;i<vals.Length;i++) 677 for(i=0;i<vals.Length;i++)
678 for(j=0;j<stride;j++) 678 for(j=0;j<stride;j++)
679 sorted[i*stride+j]=vals[i][j]; 679 sorted[i*stride+j]=vals[i][j];
680 680
681 return new list(sorted); 681 return new list(sorted);
682 } 682 }
683 683
684 #region CSV Methods 684 #region CSV Methods
685 685
@@ -693,7 +693,7 @@ namespace OpenSim.Region.ScriptEngine.Common
693 string ret = ""; 693 string ret = "";
694 foreach(object o in this.Data) 694 foreach(object o in this.Data)
695 { 695 {
696 if(ret == "") 696 if (ret == "")
697 { 697 {
698 ret = o.ToString(); 698 ret = o.ToString();
699 } 699 }
@@ -720,20 +720,20 @@ namespace OpenSim.Region.ScriptEngine.Common
720 return output; 720 return output;
721 } 721 }
722 722
723 public static explicit operator String(list l) 723 public static explicit operator String(list l)
724 { 724 {
725 return l.ToSoup(); 725 return l.ToSoup();
726 } 726 }
727 727
728 public static explicit operator LSLString(list l) 728 public static explicit operator LSLString(list l)
729 { 729 {
730 return new LSLString(l.ToSoup()); 730 return new LSLString(l.ToSoup());
731 } 731 }
732 732
733 public override string ToString() 733 public override string ToString()
734 { 734 {
735 return ToSoup(); 735 return ToSoup();
736 } 736 }
737 737
738 #endregion 738 #endregion
739 739
@@ -1068,7 +1068,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1068 1068
1069 public override bool Equals(object o) 1069 public override bool Equals(object o)
1070 { 1070 {
1071 return o.ToString() == value; 1071 return o.ToString() == value;
1072 } 1072 }
1073 1073
1074 public override int GetHashCode() 1074 public override int GetHashCode()
@@ -1089,11 +1089,11 @@ namespace OpenSim.Region.ScriptEngine.Common
1089 m_string = s; 1089 m_string = s;
1090 } 1090 }
1091 1091
1092 public LSLString(double d) 1092 public LSLString(double d)
1093 { 1093 {
1094 string s=String.Format("{0:0.000000}", d); 1094 string s=String.Format("{0:0.000000}", d);
1095 m_string=s; 1095 m_string=s;
1096 } 1096 }
1097 1097
1098 #endregion 1098 #endregion
1099 1099
@@ -1120,10 +1120,10 @@ namespace OpenSim.Region.ScriptEngine.Common
1120 return new LSLString(s); 1120 return new LSLString(s);
1121 } 1121 }
1122 1122
1123 public static string ToString(LSLString s) 1123 public static string ToString(LSLString s)
1124 { 1124 {
1125 return s.m_string; 1125 return s.m_string;
1126 } 1126 }
1127 1127
1128 public override string ToString() 1128 public override string ToString()
1129 { 1129 {
@@ -1140,27 +1140,27 @@ namespace OpenSim.Region.ScriptEngine.Common
1140 return s1.m_string != s2; 1140 return s1.m_string != s2;
1141 } 1141 }
1142 1142
1143 public static explicit operator double(LSLString s) 1143 public static explicit operator double(LSLString s)
1144 { 1144 {
1145 return Convert.ToDouble(s.m_string); 1145 return Convert.ToDouble(s.m_string);
1146 } 1146 }
1147 1147
1148 public static explicit operator LSLInteger(LSLString s) 1148 public static explicit operator LSLInteger(LSLString s)
1149 { 1149 {
1150 return new LSLInteger(Convert.ToInt32(s.m_string)); 1150 return new LSLInteger(Convert.ToInt32(s.m_string));
1151 } 1151 }
1152 1152
1153 public static explicit operator LSLString(double d) 1153 public static explicit operator LSLString(double d)
1154 { 1154 {
1155 return new LSLString(d); 1155 return new LSLString(d);
1156 } 1156 }
1157 1157
1158 #endregion 1158 #endregion
1159 1159
1160 #region Overriders 1160 #region Overriders
1161 public override bool Equals(object o) 1161 public override bool Equals(object o)
1162 { 1162 {
1163 return m_string == o.ToString(); 1163 return m_string == o.ToString();
1164 } 1164 }
1165 1165
1166 public override int GetHashCode() 1166 public override int GetHashCode()
@@ -1212,10 +1212,10 @@ namespace OpenSim.Region.ScriptEngine.Common
1212 return (uint)i.value; 1212 return (uint)i.value;
1213 } 1213 }
1214 1214
1215 static public explicit operator LSLString(LSLInteger i) 1215 static public explicit operator LSLString(LSLInteger i)
1216 { 1216 {
1217 return new LSLString(i.ToString()); 1217 return new LSLString(i.ToString());
1218 } 1218 }
1219 1219
1220 static public implicit operator Boolean(LSLInteger i) 1220 static public implicit operator Boolean(LSLInteger i)
1221 { 1221 {
@@ -1234,10 +1234,10 @@ namespace OpenSim.Region.ScriptEngine.Common
1234 return new LSLInteger(i); 1234 return new LSLInteger(i);
1235 } 1235 }
1236 1236
1237 static public explicit operator LSLInteger(string s) 1237 static public explicit operator LSLInteger(string s)
1238 { 1238 {
1239 return new LSLInteger(int.Parse(s)); 1239 return new LSLInteger(int.Parse(s));
1240 } 1240 }
1241 1241
1242 static public implicit operator LSLInteger(double d) 1242 static public implicit operator LSLInteger(double d)
1243 { 1243 {
@@ -1250,17 +1250,17 @@ namespace OpenSim.Region.ScriptEngine.Common
1250 return ret; 1250 return ret;
1251 } 1251 }
1252 1252
1253 public static LSLInteger operator ++(LSLInteger i) 1253 public static LSLInteger operator ++(LSLInteger i)
1254 { 1254 {
1255 i.value++; 1255 i.value++;
1256 return i; 1256 return i;
1257 } 1257 }
1258 1258
1259 public static LSLInteger operator --(LSLInteger i) 1259 public static LSLInteger operator --(LSLInteger i)
1260 { 1260 {
1261 i.value--; 1261 i.value--;
1262 return i; 1262 return i;
1263 } 1263 }
1264 1264
1265 static public implicit operator System.Double(LSLInteger i) 1265 static public implicit operator System.Double(LSLInteger i)
1266 { 1266 {
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
index 2a6f775..ed11337 100644
--- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
+++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs
@@ -295,18 +295,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
295 if (e.InnerException != null) 295 if (e.InnerException != null)
296 { 296 {
297 // Send inner exception 297 // Send inner exception
298 string[] lines=e.InnerException.ToString().Replace("\r", "").Split('\n'); 298 string[] lines=e.InnerException.ToString().Replace("\r", "").Split('\n');
299 int line=0; 299 int line=0;
300 foreach(string t in lines) 300 foreach(string t in lines)
301 { 301 {
302 int idx=t.IndexOf("SecondLife.Script."); 302 int idx=t.IndexOf("SecondLife.Script.");
303 if(idx != -1) 303 if(idx != -1)
304 { 304 {
305 int colon=t.IndexOf(":"); 305 int colon=t.IndexOf(":");
306 line=Convert.ToInt32(t.Substring(colon+1)); 306 line=Convert.ToInt32(t.Substring(colon+1));
307 break; 307 break;
308 } 308 }
309 } 309 }
310 text += e.InnerException.Message.ToString()+" in line "+line.ToString(); 310 text += e.InnerException.Message.ToString()+" in line "+line.ToString();
311 } 311 }
312 else 312 else