aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs77
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs7
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs223
5 files changed, 165 insertions, 146 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
index 7e50cc6..2da0a74 100644
--- a/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/UserProfiles/UserProfileModule.cs
@@ -1290,9 +1290,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1290 webRequest.ContentType = "application/json-rpc"; 1290 webRequest.ContentType = "application/json-rpc";
1291 webRequest.Method = "POST"; 1291 webRequest.Method = "POST";
1292 1292
1293 Stream dataStream = webRequest.GetRequestStream(); 1293 using (Stream dataStream = webRequest.GetRequestStream())
1294 dataStream.Write(content, 0, content.Length); 1294 dataStream.Write(content, 0, content.Length);
1295 dataStream.Close();
1296 1295
1297 WebResponse webResponse = null; 1296 WebResponse webResponse = null;
1298 try 1297 try
@@ -1306,26 +1305,18 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1306 return false; 1305 return false;
1307 } 1306 }
1308 1307
1309 Stream rstream = webResponse.GetResponseStream(); 1308 using (webResponse)
1310 1309 using (Stream rstream = webResponse.GetResponseStream())
1311 OSDMap mret = new OSDMap();
1312 try
1313 {
1314 mret = (OSDMap)OSDParser.DeserializeJson(rstream);
1315 }
1316 catch (Exception e)
1317 { 1310 {
1318 m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); 1311 OSDMap mret = (OSDMap)OSDParser.DeserializeJson(rstream);
1319 return false;
1320 }
1321 1312
1313 if (mret.ContainsKey("error"))
1314 return false;
1322 1315
1323 if (mret.ContainsKey("error")) 1316 // get params...
1324 return false; 1317 OSD.DeserializeMembers(ref parameters, (OSDMap)mret["result"]);
1325 1318 return true;
1326 // get params... 1319 }
1327 OSD.DeserializeMembers(ref parameters, (OSDMap) mret["result"]);
1328 return true;
1329 } 1320 }
1330 1321
1331 /// <summary> 1322 /// <summary>
@@ -1366,9 +1357,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1366 webRequest.ContentType = "application/json-rpc"; 1357 webRequest.ContentType = "application/json-rpc";
1367 webRequest.Method = "POST"; 1358 webRequest.Method = "POST";
1368 1359
1369 Stream dataStream = webRequest.GetRequestStream(); 1360 using (Stream dataStream = webRequest.GetRequestStream())
1370 dataStream.Write(content, 0, content.Length); 1361 dataStream.Write(content, 0, content.Length);
1371 dataStream.Close();
1372 1362
1373 WebResponse webResponse = null; 1363 WebResponse webResponse = null;
1374 try 1364 try
@@ -1382,29 +1372,32 @@ namespace OpenSim.Region.OptionalModules.Avatar.UserProfiles
1382 return false; 1372 return false;
1383 } 1373 }
1384 1374
1385 Stream rstream = webResponse.GetResponseStream(); 1375 using (webResponse)
1386 1376 using (Stream rstream = webResponse.GetResponseStream())
1387 OSDMap response = new OSDMap();
1388 try
1389 {
1390 response = (OSDMap)OSDParser.DeserializeJson(rstream);
1391 }
1392 catch (Exception e)
1393 { 1377 {
1394 m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message); 1378 OSDMap response = new OSDMap();
1395 return false; 1379 try
1396 } 1380 {
1381 response = (OSDMap)OSDParser.DeserializeJson(rstream);
1382 }
1383 catch (Exception e)
1384 {
1385 m_log.DebugFormat("[PROFILES]: JsonRpcRequest Error {0} - remote user with legacy profiles?", e.Message);
1386 return false;
1387 }
1397 1388
1398 if(response.ContainsKey("error")) 1389 if (response.ContainsKey("error"))
1399 { 1390 {
1400 data = response["error"]; 1391 data = response["error"];
1401 return false; 1392 return false;
1402 } 1393 }
1403 1394
1404 data = response; 1395 data = response;
1405 1396
1406 return true; 1397 return true;
1398 }
1407 } 1399 }
1400
1408 #endregion Web Util 1401 #endregion Web Util
1409 } 1402 }
1410} \ No newline at end of file 1403}
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index c3a8afd..a7237ea 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -488,9 +488,8 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
488 byte[] data = Util.UTF8.GetBytes(OutboundBody); 488 byte[] data = Util.UTF8.GetBytes(OutboundBody);
489 489
490 Request.ContentLength = data.Length; 490 Request.ContentLength = data.Length;
491 Stream bstream = Request.GetRequestStream(); 491 using (Stream bstream = Request.GetRequestStream())
492 bstream.Write(data, 0, data.Length); 492 bstream.Write(data, 0, data.Length);
493 bstream.Close();
494 } 493 }
495 494
496 try 495 try
@@ -584,4 +583,4 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
584 Request.Abort(); 583 Request.Abort();
585 } 584 }
586 } 585 }
587} \ No newline at end of file 586}
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index f57be83..a3b0f39 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -899,7 +899,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
899 finally 899 finally
900 { 900 {
901 if (os != null) 901 if (os != null)
902 os.Close(); 902 os.Dispose();
903 } 903 }
904 904
905 string response_mapItems_reply = null; 905 string response_mapItems_reply = null;
diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
index 296ab87..d059b97 100644
--- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs
@@ -304,7 +304,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady
304 finally 304 finally
305 { 305 {
306 if (os != null) 306 if (os != null)
307 os.Close(); 307 os.Dispose();
308 } 308 }
309 } 309 }
310 } 310 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 7b56abf..91885b7 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -101,7 +101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
101 /// </summary> 101 /// </summary>
102 protected TaskInventoryItem m_item; 102 protected TaskInventoryItem m_item;
103 103
104 protected bool throwErrorOnNotImplemented = true; 104 protected bool throwErrorOnNotImplemented = false;
105 protected AsyncCommandManager AsyncCommands = null; 105 protected AsyncCommandManager AsyncCommands = null;
106 protected float m_ScriptDelayFactor = 1.0f; 106 protected float m_ScriptDelayFactor = 1.0f;
107 protected float m_ScriptDistanceFactor = 1.0f; 107 protected float m_ScriptDistanceFactor = 1.0f;
@@ -261,7 +261,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
261 if ((item = GetScriptByName(name)) != UUID.Zero) 261 if ((item = GetScriptByName(name)) != UUID.Zero)
262 m_ScriptEngine.ResetScript(item); 262 m_ScriptEngine.ResetScript(item);
263 else 263 else
264 ShoutError("llResetOtherScript: script "+name+" not found"); 264 Error("llResetOtherScript", "Can't find script '" + name + "'");
265 } 265 }
266 266
267 public LSL_Integer llGetScriptState(string name) 267 public LSL_Integer llGetScriptState(string name)
@@ -275,7 +275,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
275 return m_ScriptEngine.GetScriptState(item) ?1:0; 275 return m_ScriptEngine.GetScriptState(item) ?1:0;
276 } 276 }
277 277
278 ShoutError("llGetScriptState: script "+name+" not found"); 278 Error("llGetScriptState", "Can't find script '" + name + "'");
279 279
280 // If we didn't find it, then it's safe to 280 // If we didn't find it, then it's safe to
281 // assume it is not running. 281 // assume it is not running.
@@ -298,7 +298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
298 } 298 }
299 else 299 else
300 { 300 {
301 ShoutError("llSetScriptState: script "+name+" not found"); 301 Error("llSetScriptState", "Can't find script '" + name + "'");
302 } 302 }
303 } 303 }
304 304
@@ -890,7 +890,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
890 { 890 {
891 if (channelID == 0) 891 if (channelID == 0)
892 { 892 {
893 LSLError("Cannot use llRegionSay() on channel 0"); 893 Error("llRegionSay", "Cannot use on channel 0");
894 return; 894 return;
895 } 895 }
896 896
@@ -2553,9 +2553,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2553 public void llSound(string sound, double volume, int queue, int loop) 2553 public void llSound(string sound, double volume, int queue, int loop)
2554 { 2554 {
2555 m_host.AddScriptLPS(1); 2555 m_host.AddScriptLPS(1);
2556 // This function has been deprecated 2556 Deprecated("llSound", "Use llPlaySound instead");
2557 // see http://www.lslwiki.net/lslwiki/wakka.php?wakka=llSound
2558 Deprecated("llSound");
2559 } 2557 }
2560 2558
2561 // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound 2559 // Xantor 20080528 PlaySound updated so it accepts an objectinventory name -or- a key to a sound
@@ -2886,7 +2884,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2886 2884
2887 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0) 2885 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
2888 { 2886 {
2889 LSLError("No permissions to give money"); 2887 Error("llGiveMoney", "No permissions to give money");
2890 return; 2888 return;
2891 } 2889 }
2892 2890
@@ -2894,7 +2892,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2894 2892
2895 if (!UUID.TryParse(destination, out toID)) 2893 if (!UUID.TryParse(destination, out toID))
2896 { 2894 {
2897 LSLError("Bad key in llGiveMoney"); 2895 Error("llGiveMoney", "Bad key in llGiveMoney");
2898 return; 2896 return;
2899 } 2897 }
2900 2898
@@ -2914,28 +2912,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2914 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 2912 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
2915 { 2913 {
2916 m_host.AddScriptLPS(1); 2914 m_host.AddScriptLPS(1);
2917 Deprecated("llMakeExplosion"); 2915 Deprecated("llMakeExplosion", "Use llParticleSystem instead");
2918 ScriptSleep(100); 2916 ScriptSleep(100);
2919 } 2917 }
2920 2918
2921 public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset) 2919 public void llMakeFountain(int particles, double scale, double vel, double lifetime, double arc, int bounce, string texture, LSL_Vector offset, double bounce_offset)
2922 { 2920 {
2923 m_host.AddScriptLPS(1); 2921 m_host.AddScriptLPS(1);
2924 Deprecated("llMakeFountain"); 2922 Deprecated("llMakeFountain", "Use llParticleSystem instead");
2925 ScriptSleep(100); 2923 ScriptSleep(100);
2926 } 2924 }
2927 2925
2928 public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 2926 public void llMakeSmoke(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
2929 { 2927 {
2930 m_host.AddScriptLPS(1); 2928 m_host.AddScriptLPS(1);
2931 Deprecated("llMakeSmoke"); 2929 Deprecated("llMakeSmoke", "Use llParticleSystem instead");
2932 ScriptSleep(100); 2930 ScriptSleep(100);
2933 } 2931 }
2934 2932
2935 public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 2933 public void llMakeFire(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
2936 { 2934 {
2937 m_host.AddScriptLPS(1); 2935 m_host.AddScriptLPS(1);
2938 Deprecated("llMakeFire"); 2936 Deprecated("llMakeFire", "Use llParticleSystem instead");
2939 ScriptSleep(100); 2937 ScriptSleep(100);
2940 } 2938 }
2941 2939
@@ -2957,13 +2955,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2957 2955
2958 if (item == null) 2956 if (item == null)
2959 { 2957 {
2960 llSay(0, "Could not find object " + inventory); 2958 Error("llRezAtRoot", "Can't find object '" + inventory + "'");
2961 return; 2959 return;
2962 } 2960 }
2963 2961
2964 if (item.InvType != (int)InventoryType.Object) 2962 if (item.InvType != (int)InventoryType.Object)
2965 { 2963 {
2966 llSay(0, "Unable to create requested object. Object is missing from database."); 2964 Error("llRezAtRoot", "Can't create requested object; object is missing from database");
2967 return; 2965 return;
2968 } 2966 }
2969 2967
@@ -3053,7 +3051,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3053 public void llStopLookAt() 3051 public void llStopLookAt()
3054 { 3052 {
3055 m_host.AddScriptLPS(1); 3053 m_host.AddScriptLPS(1);
3056// NotImplemented("llStopLookAt");
3057 m_host.StopLookAt(); 3054 m_host.StopLookAt();
3058 } 3055 }
3059 3056
@@ -3237,13 +3234,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3237 public void llTakeCamera(string avatar) 3234 public void llTakeCamera(string avatar)
3238 { 3235 {
3239 m_host.AddScriptLPS(1); 3236 m_host.AddScriptLPS(1);
3240 Deprecated("llTakeCamera"); 3237 Deprecated("llTakeCamera", "Use llSetCameraParams instead");
3241 } 3238 }
3242 3239
3243 public void llReleaseCamera(string avatar) 3240 public void llReleaseCamera(string avatar)
3244 { 3241 {
3245 m_host.AddScriptLPS(1); 3242 m_host.AddScriptLPS(1);
3246 Deprecated("llReleaseCamera"); 3243 Deprecated("llReleaseCamera", "Use llClearCameraParams instead");
3247 } 3244 }
3248 3245
3249 public LSL_String llGetOwner() 3246 public LSL_String llGetOwner()
@@ -3320,7 +3317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3320 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>(); 3317 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
3321 if (emailModule == null) 3318 if (emailModule == null)
3322 { 3319 {
3323 ShoutError("llEmail: email module not configured"); 3320 Error("llEmail", "Email module not configured");
3324 return; 3321 return;
3325 } 3322 }
3326 3323
@@ -3334,7 +3331,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3334 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>(); 3331 IEmailModule emailModule = m_ScriptEngine.World.RequestModuleInterface<IEmailModule>();
3335 if (emailModule == null) 3332 if (emailModule == null)
3336 { 3333 {
3337 ShoutError("llGetNextEmail: email module not configured"); 3334 Error("llGetNextEmail", "Email module not configured");
3338 return; 3335 return;
3339 } 3336 }
3340 Email email; 3337 Email email;
@@ -3419,17 +3416,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3419 catch (NotImplementedException) 3416 catch (NotImplementedException)
3420 { 3417 {
3421 // Currently not implemented in DotNetEngine only XEngine 3418 // Currently not implemented in DotNetEngine only XEngine
3422 NotImplemented("llMinEventDelay in DotNetEngine"); 3419 NotImplemented("llMinEventDelay", "In DotNetEngine");
3423 } 3420 }
3424 } 3421 }
3425 3422
3426 /// <summary>
3427 /// llSoundPreload is deprecated. In SL this appears to do absolutely nothing
3428 /// and is documented to have no delay.
3429 /// </summary>
3430 public void llSoundPreload(string sound) 3423 public void llSoundPreload(string sound)
3431 { 3424 {
3432 m_host.AddScriptLPS(1); 3425 m_host.AddScriptLPS(1);
3426 Deprecated("llSoundPreload", "Use llPreloadSound instead");
3433 } 3427 }
3434 3428
3435 public void llRotLookAt(LSL_Rotation target, double strength, double damping) 3429 public void llRotLookAt(LSL_Rotation target, double strength, double damping)
@@ -3734,7 +3728,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3734 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 3728 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3735 && !m_automaticLinkPermission) 3729 && !m_automaticLinkPermission)
3736 { 3730 {
3737 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 3731 Error("llCreateLink", "PERMISSION_CHANGE_LINKS permission not set");
3738 return; 3732 return;
3739 } 3733 }
3740 3734
@@ -3789,7 +3783,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3789 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0 3783 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0
3790 && !m_automaticLinkPermission) 3784 && !m_automaticLinkPermission)
3791 { 3785 {
3792 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!"); 3786 Error("llBreakLink", "PERMISSION_CHANGE_LINKS permission not set");
3793 return; 3787 return;
3794 } 3788 }
3795 3789
@@ -4009,7 +4003,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4009 4003
4010 if (!UUID.TryParse(destination, out destId)) 4004 if (!UUID.TryParse(destination, out destId))
4011 { 4005 {
4012 llSay(0, "Could not parse key " + destination); 4006 Error("llGiveInventory", "Can't parse destination key '" + destination + "'");
4013 return; 4007 return;
4014 } 4008 }
4015 4009
@@ -4017,8 +4011,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4017 4011
4018 if (item == null) 4012 if (item == null)
4019 { 4013 {
4020 llSay(0, String.Format("Could not find object '{0}'", inventory)); 4014 Error("llGiveInventory", "Can't find inventory object '" + inventory + "'");
4021 throw new Exception(String.Format("The inventory object '{0}' could not be found", inventory));
4022 } 4015 }
4023 4016
4024 UUID objId = item.ItemID; 4017 UUID objId = item.ItemID;
@@ -4042,7 +4035,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4042 4035
4043 if (account == null) 4036 if (account == null)
4044 { 4037 {
4045 llSay(0, "Can't find destination "+destId.ToString()); 4038 Error("llGiveInventory", "Can't find destination '" + destId.ToString() + "'");
4046 return; 4039 return;
4047 } 4040 }
4048 } 4041 }
@@ -4394,17 +4387,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
4394 UUID av = new UUID(); 4387 UUID av = new UUID();
4395 if (!UUID.TryParse(agent,out av)) 4388 if (!UUID.TryParse(agent,out av))
4396 { 4389 {
4397 LSLError("First parameter to llTextBox needs to be a key"); 4390 Error("llTextBox", "First parameter must be a key");
4398 return; 4391 return;
4399 } 4392 }
4400 4393
4401 if (message == string.Empty) 4394 if (message == string.Empty)
4402 { 4395 {
4403 ShoutError("Trying to use llTextBox with empty message."); 4396 Error("llTextBox", "Empty message");
4404 } 4397 }
4405 else if (message.Length > 512) 4398 else if (message.Length > 512)
4406 { 4399 {
4407 ShoutError("Trying to use llTextBox with message over 512 characters."); 4400 Error("llTextBox", "Message more than 512 characters");
4408 } 4401 }
4409 else 4402 else
4410 { 4403 {
@@ -6814,17 +6807,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6814 UUID av = new UUID(); 6807 UUID av = new UUID();
6815 if (!UUID.TryParse(avatar,out av)) 6808 if (!UUID.TryParse(avatar,out av))
6816 { 6809 {
6817 LSLError("First parameter to llDialog needs to be a key"); 6810 Error("llDialog", "First parameter must be a key");
6818 return; 6811 return;
6819 } 6812 }
6820 if (buttons.Length < 1) 6813 if (buttons.Length < 1)
6821 { 6814 {
6822 LSLError("No less than 1 button can be shown"); 6815 Error("llDialog", "At least 1 button must be shown");
6823 return; 6816 return;
6824 } 6817 }
6825 if (buttons.Length > 12) 6818 if (buttons.Length > 12)
6826 { 6819 {
6827 LSLError("No more than 12 buttons can be shown"); 6820 Error("llDialog", "No more than 12 buttons can be shown");
6828 return; 6821 return;
6829 } 6822 }
6830 string[] buts = new string[buttons.Length]; 6823 string[] buts = new string[buttons.Length];
@@ -6832,12 +6825,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6832 { 6825 {
6833 if (buttons.Data[i].ToString() == String.Empty) 6826 if (buttons.Data[i].ToString() == String.Empty)
6834 { 6827 {
6835 LSLError("button label cannot be blank"); 6828 Error("llDialog", "Button label cannot be blank");
6836 return; 6829 return;
6837 } 6830 }
6838 if (buttons.Data[i].ToString().Length > 24) 6831 if (buttons.Data[i].ToString().Length > 24)
6839 { 6832 {
6840 LSLError("button label cannot be longer than 24 characters"); 6833 Error("llDialog", "Button label cannot be longer than 24 characters");
6841 return; 6834 return;
6842 } 6835 }
6843 buts[i] = buttons.Data[i].ToString(); 6836 buts[i] = buttons.Data[i].ToString();
@@ -6858,15 +6851,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6858 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0); 6851 m_host.ParentGroup.ScriptSetVolumeDetect(detect != 0);
6859 } 6852 }
6860 6853
6861 /// <summary>
6862 /// This is a depecated function so this just replicates the result of
6863 /// invoking it in SL
6864 /// </summary>
6865 public void llRemoteLoadScript(string target, string name, int running, int start_param) 6854 public void llRemoteLoadScript(string target, string name, int running, int start_param)
6866 { 6855 {
6867 m_host.AddScriptLPS(1); 6856 m_host.AddScriptLPS(1);
6868 // Report an error as it does in SL 6857 Deprecated("llRemoteLoadScript", "Use llRemoteLoadScriptPin instead");
6869 ShoutError("Deprecated. Please use llRemoteLoadScriptPin instead.");
6870 ScriptSleep(3000); 6858 ScriptSleep(3000);
6871 } 6859 }
6872 6860
@@ -6884,7 +6872,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6884 6872
6885 if (!UUID.TryParse(target, out destId)) 6873 if (!UUID.TryParse(target, out destId))
6886 { 6874 {
6887 llSay(0, "Could not parse key " + target); 6875 Error("llRemoteLoadScriptPin", "Can't parse key '" + target + "'");
6888 return; 6876 return;
6889 } 6877 }
6890 6878
@@ -6900,7 +6888,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6900 // make sure the object is a script 6888 // make sure the object is a script
6901 if (item == null || item.Type != 10) 6889 if (item == null || item.Type != 10)
6902 { 6890 {
6903 llSay(0, "Could not find script " + name); 6891 Error("llRemoteLoadScriptPin", "Can't find script '" + name + "'");
6904 return; 6892 return;
6905 } 6893 }
6906 6894
@@ -7948,9 +7936,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7948 } 7936 }
7949 catch (InvalidCastException e) 7937 catch (InvalidCastException e)
7950 { 7938 {
7951 ShoutError(string.Format( 7939 Error(originFunc, string.Format("Error running rule #{0}: arg #{1} - ", rulesParsed, idx - idxStart) + e.Message);
7952 "{0} error running rule #{1}: arg #{2} ",
7953 originFunc, rulesParsed, idx - idxStart) + e.Message);
7954 } 7940 }
7955 finally 7941 finally
7956 { 7942 {
@@ -7983,9 +7969,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7983 string encodedData = Convert.ToBase64String(encData_byte); 7969 string encodedData = Convert.ToBase64String(encData_byte);
7984 return encodedData; 7970 return encodedData;
7985 } 7971 }
7986 catch (Exception e) 7972 catch
7987 { 7973 {
7988 throw new Exception("Error in base64Encode" + e.Message); 7974 Error("llBase64ToString", "Error encoding string");
7975 return String.Empty;
7989 } 7976 }
7990 } 7977 }
7991 7978
@@ -7996,16 +7983,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7996 { 7983 {
7997 return Util.Base64ToString(str); 7984 return Util.Base64ToString(str);
7998 } 7985 }
7999 catch (Exception e) 7986 catch
8000 { 7987 {
8001 throw new Exception("Error in base64Decode" + e.Message); 7988 Error("llBase64ToString", "Error decoding string");
7989 return String.Empty;
8002 } 7990 }
8003 } 7991 }
8004 7992
8005 public LSL_String llXorBase64Strings(string str1, string str2) 7993 public LSL_String llXorBase64Strings(string str1, string str2)
8006 { 7994 {
8007 m_host.AddScriptLPS(1); 7995 m_host.AddScriptLPS(1);
8008 Deprecated("llXorBase64Strings"); 7996 Deprecated("llXorBase64Strings", "Use llXorBase64 instead");
8009 ScriptSleep(300); 7997 ScriptSleep(300);
8010 return String.Empty; 7998 return String.Empty;
8011 } 7999 }
@@ -8013,7 +8001,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
8013 public void llRemoteDataSetRegion() 8001 public void llRemoteDataSetRegion()
8014 { 8002 {
8015 m_host.AddScriptLPS(1); 8003 m_host.AddScriptLPS(1);
8016 Deprecated("llRemoteDataSetRegion"); 8004 Deprecated("llRemoteDataSetRegion", "Use llOpenRemoteDataChannel instead");
8017 } 8005 }
8018 8006
8019 public LSL_Float llLog10(double val) 8007 public LSL_Float llLog10(double val)
@@ -9728,7 +9716,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
9728 9716
9729 if (item == null) 9717 if (item == null)
9730 { 9718 {
9731 llSay(0, "No item name '" + item + "'"); 9719 Error("llGetInventoryCreator", "Can't find item '" + item + "'");
9732 9720
9733 return String.Empty; 9721 return String.Empty;
9734 } 9722 }
@@ -10047,7 +10035,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10047 presence = World.GetScenePresence(agentID); 10035 presence = World.GetScenePresence(agentID);
10048 } 10036 }
10049 } 10037 }
10050 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key"); 10038 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_AGENT must be a key");
10051 ++i; 10039 ++i;
10052 } 10040 }
10053 break; 10041 break;
@@ -10078,7 +10066,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10078 url = (LSL_String)commandList.Data[i + 1]; 10066 url = (LSL_String)commandList.Data[i + 1];
10079 update = true; 10067 update = true;
10080 } 10068 }
10081 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_URL must be a string."); 10069 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_URL must be a string");
10082 ++i; 10070 ++i;
10083 } 10071 }
10084 break; 10072 break;
@@ -10091,7 +10079,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10091 texture = (LSL_String)commandList.Data[i + 1]; 10079 texture = (LSL_String)commandList.Data[i + 1];
10092 update = true; 10080 update = true;
10093 } 10081 }
10094 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or key."); 10082 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TEXTURE must be a string or a key");
10095 ++i; 10083 ++i;
10096 } 10084 }
10097 break; 10085 break;
@@ -10103,7 +10091,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10103 { 10091 {
10104 time = (float)(LSL_Float)commandList.Data[i + 1]; 10092 time = (float)(LSL_Float)commandList.Data[i + 1];
10105 } 10093 }
10106 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TIME must be a float."); 10094 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TIME must be a float");
10107 ++i; 10095 ++i;
10108 } 10096 }
10109 break; 10097 break;
@@ -10117,7 +10105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10117 update = true; 10105 update = true;
10118 } 10106 }
10119 10107
10120 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer."); 10108 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_AUTO_ALIGN must be an integer");
10121 ++i; 10109 ++i;
10122 } 10110 }
10123 break; 10111 break;
@@ -10130,7 +10118,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10130 mediaType = (LSL_String)commandList.Data[i + 1]; 10118 mediaType = (LSL_String)commandList.Data[i + 1];
10131 update = true; 10119 update = true;
10132 } 10120 }
10133 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string."); 10121 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_TYPE must be a string");
10134 ++i; 10122 ++i;
10135 } 10123 }
10136 break; 10124 break;
@@ -10143,7 +10131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10143 description = (LSL_String)commandList.Data[i + 1]; 10131 description = (LSL_String)commandList.Data[i + 1];
10144 update = true; 10132 update = true;
10145 } 10133 }
10146 else ShoutError("The argument of PARCEL_MEDIA_COMMAND_DESC must be a string."); 10134 else Error("llParcelMediaCommandList", "The argument of PARCEL_MEDIA_COMMAND_DESC must be a string");
10147 ++i; 10135 ++i;
10148 } 10136 }
10149 break; 10137 break;
@@ -10159,15 +10147,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10159 height = (LSL_Integer)commandList.Data[i + 2]; 10147 height = (LSL_Integer)commandList.Data[i + 2];
10160 update = true; 10148 update = true;
10161 } 10149 }
10162 else ShoutError("The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer."); 10150 else Error("llParcelMediaCommandList", "The second argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer");
10163 } 10151 }
10164 else ShoutError("The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer."); 10152 else Error("llParcelMediaCommandList", "The first argument of PARCEL_MEDIA_COMMAND_SIZE must be an integer");
10165 i += 2; 10153 i += 2;
10166 } 10154 }
10167 break; 10155 break;
10168 10156
10169 default: 10157 default:
10170 NotImplemented("llParcelMediaCommandList parameter not supported yet: " + Enum.Parse(typeof(ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString()); 10158 NotImplemented("llParcelMediaCommandList", "Parameter not supported yet: " + Enum.Parse(typeof(ParcelMediaCommandEnum), commandList.Data[i].ToString()).ToString());
10171 break; 10159 break;
10172 }//end switch 10160 }//end switch
10173 }//end for 10161 }//end for
@@ -10275,7 +10263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10275 break; 10263 break;
10276 default: 10264 default:
10277 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url; 10265 ParcelMediaCommandEnum mediaCommandEnum = ParcelMediaCommandEnum.Url;
10278 NotImplemented("llParcelMediaQuery parameter do not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString()); 10266 NotImplemented("llParcelMediaQuery", "Parameter not supported yet: " + Enum.Parse(mediaCommandEnum.GetType() , aList.Data[i].ToString()).ToString());
10279 break; 10267 break;
10280 } 10268 }
10281 10269
@@ -10312,7 +10300,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10312 10300
10313 if (quick_pay_buttons.Data.Length < 4) 10301 if (quick_pay_buttons.Data.Length < 4)
10314 { 10302 {
10315 LSLError("List must have at least 4 elements"); 10303 Error("llSetPayPrice", "List must have at least 4 elements");
10316 return; 10304 return;
10317 } 10305 }
10318 m_host.ParentGroup.RootPart.PayPrice[0]=price; 10306 m_host.ParentGroup.RootPart.PayPrice[0]=price;
@@ -10333,7 +10321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10333 10321
10334 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 10322 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
10335 { 10323 {
10336 ShoutError("No permissions to track the camera"); 10324 Error("llGetCameraPos", "No permissions to track the camera");
10337 return Vector3.Zero; 10325 return Vector3.Zero;
10338 } 10326 }
10339 10327
@@ -10356,7 +10344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10356 10344
10357 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0) 10345 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_TRACK_CAMERA) == 0)
10358 { 10346 {
10359 ShoutError("No permissions to track the camera"); 10347 Error("llGetCameraRot", "No permissions to track the camera");
10360 return Quaternion.Identity; 10348 return Quaternion.Identity;
10361 } 10349 }
10362 10350
@@ -10369,24 +10357,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10369 return Quaternion.Identity; 10357 return Quaternion.Identity;
10370 } 10358 }
10371 10359
10372 /// <summary>
10373 /// The SL implementation does nothing, it is deprecated
10374 /// This duplicates SL
10375 /// </summary>
10376 public void llSetPrimURL(string url) 10360 public void llSetPrimURL(string url)
10377 { 10361 {
10378 m_host.AddScriptLPS(1); 10362 m_host.AddScriptLPS(1);
10363 Deprecated("llSetPrimURL", "Use llSetPrimMediaParams instead");
10379 ScriptSleep(2000); 10364 ScriptSleep(2000);
10380 } 10365 }
10381 10366
10382 /// <summary>
10383 /// The SL implementation shouts an error, it is deprecated
10384 /// This duplicates SL
10385 /// </summary>
10386 public void llRefreshPrimURL() 10367 public void llRefreshPrimURL()
10387 { 10368 {
10388 m_host.AddScriptLPS(1); 10369 m_host.AddScriptLPS(1);
10389 ShoutError("llRefreshPrimURL - not yet supported"); 10370 Deprecated("llRefreshPrimURL");
10390 ScriptSleep(20000); 10371 ScriptSleep(20000);
10391 } 10372 }
10392 10373
@@ -10696,7 +10677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10696 if (!ok || flag < 0 || 10677 if (!ok || flag < 0 ||
10697 flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE) 10678 flag > (int)HttpRequestConstants.HTTP_PRAGMA_NO_CACHE)
10698 { 10679 {
10699 throw new ScriptException("Parameter " + i.ToString() + " is an invalid flag"); 10680 Error("llHTTPRequest", "Parameter " + i.ToString() + " is an invalid flag");
10700 } 10681 }
10701 10682
10702 param.Add(parameters.Data[i].ToString()); //Add parameter flag 10683 param.Add(parameters.Data[i].ToString()); //Add parameter flag
@@ -10720,12 +10701,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
10720 { 10701 {
10721 //There must be at least one name/value pair for custom header 10702 //There must be at least one name/value pair for custom header
10722 if (count == 1) 10703 if (count == 1)
10723 throw new ScriptException("Missing name/value for custom header at parameter " + i.ToString()); 10704 Error("llHTTPRequest", "Missing name/value for custom header at parameter " + i.ToString());
10724 break; 10705 break;
10725 } 10706 }
10726 10707
10727 if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase)) 10708 if (HttpStandardHeaders.Contains(parameters.Data[i].ToString(), StringComparer.OrdinalIgnoreCase))
10728 throw new ScriptException("Name is invalid as a custom header at parameter " + i.ToString()); 10709 Error("llHTTPRequest", "Name is invalid as a custom header at parameter " + i.ToString());
10729 10710
10730 param.Add(parameters.Data[i].ToString()); 10711 param.Add(parameters.Data[i].ToString());
10731 param.Add(parameters.Data[i+1].ToString()); 10712 param.Add(parameters.Data[i+1].ToString());
@@ -11242,25 +11223,71 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11242 return item.ItemID; 11223 return item.ItemID;
11243 } 11224 }
11244 11225
11245 internal void ShoutError(string msg) 11226 /// <summary>
11227 /// Reports the script error in the viewer's Script Warning/Error dialog and shouts it on the debug channel.
11228 /// </summary>
11229 /// <param name="command">The name of the command that generated the error.</param>
11230 /// <param name="message">The error message to report to the user.</param>
11231 internal void Error(string command, string message)
11246 { 11232 {
11247 llShout(ScriptBaseClass.DEBUG_CHANNEL, msg); 11233 string text = command + ": " + message;
11234 if (text.Length > 1023)
11235 {
11236 text = text.Substring(0, 1023);
11237 }
11238
11239 World.SimChat(Utils.StringToBytes(text), ChatTypeEnum.DebugChannel, ScriptBaseClass.DEBUG_CHANNEL,
11240 m_host.ParentGroup.RootPart.AbsolutePosition, m_host.Name, m_host.UUID, false);
11241
11242 IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
11243 if (wComm != null)
11244 {
11245 wComm.DeliverMessage(ChatTypeEnum.Shout, ScriptBaseClass.DEBUG_CHANNEL, m_host.Name, m_host.UUID, text);
11246 }
11248 } 11247 }
11249 11248
11250 internal void NotImplemented(string command) 11249 /// <summary>
11250 /// Reports that the command is not implemented as a script error.
11251 /// </summary>
11252 /// <param name="command">The name of the command that is not implemented.</param>
11253 /// <param name="message">Additional information to report to the user. (Optional)</param>
11254 internal void NotImplemented(string command, string message = "")
11251 { 11255 {
11252 if (throwErrorOnNotImplemented) 11256 if (throwErrorOnNotImplemented)
11253 throw new NotImplementedException("Command not implemented: " + command); 11257 {
11254 } 11258 if (message != "")
11259 {
11260 message = " - " + message;
11261 }
11255 11262
11256 internal void Deprecated(string command) 11263 throw new NotImplementedException("Command not implemented: " + command + message);
11257 { 11264 }
11258 throw new ScriptException("Command deprecated: " + command); 11265 else
11266 {
11267 string text = "Command not implemented";
11268 if (message != "")
11269 {
11270 text = text + " - " + message;
11271 }
11272
11273 Error(command, text);
11274 }
11259 } 11275 }
11260 11276
11261 internal void LSLError(string msg) 11277 /// <summary>
11278 /// Reports that the command is deprecated as a script error.
11279 /// </summary>
11280 /// <param name="command">The name of the command that is deprecated.</param>
11281 /// <param name="message">Additional information to report to the user. (Optional)</param>
11282 internal void Deprecated(string command, string message = "")
11262 { 11283 {
11263 throw new ScriptException("LSL Runtime Error: " + msg); 11284 string text = "Command deprecated";
11285 if (message != "")
11286 {
11287 text = text + " - " + message;
11288 }
11289
11290 Error(command, text);
11264 } 11291 }
11265 11292
11266 public delegate void AssetRequestCallback(UUID assetID, AssetBase asset); 11293 public delegate void AssetRequestCallback(UUID assetID, AssetBase asset);
@@ -11292,7 +11319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11292 if (assetID == UUID.Zero) 11319 if (assetID == UUID.Zero)
11293 { 11320 {
11294 // => complain loudly, as specified by the LSL docs 11321 // => complain loudly, as specified by the LSL docs
11295 ShoutError("Notecard '" + name + "' could not be found."); 11322 Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'");
11296 11323
11297 return UUID.Zero.ToString(); 11324 return UUID.Zero.ToString();
11298 } 11325 }
@@ -11314,7 +11341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11314 { 11341 {
11315 if (a == null || a.Type != 7) 11342 if (a == null || a.Type != 7)
11316 { 11343 {
11317 ShoutError("Notecard '" + name + "' could not be found."); 11344 Error("llGetNumberOfNotecardLines", "Can't find notecard '" + name + "'");
11318 return; 11345 return;
11319 } 11346 }
11320 11347
@@ -11345,7 +11372,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11345 if (assetID == UUID.Zero) 11372 if (assetID == UUID.Zero)
11346 { 11373 {
11347 // => complain loudly, as specified by the LSL docs 11374 // => complain loudly, as specified by the LSL docs
11348 ShoutError("Notecard '" + name + "' could not be found."); 11375 Error("llGetNotecardLine", "Can't find notecard '" + name + "'");
11349 11376
11350 return UUID.Zero.ToString(); 11377 return UUID.Zero.ToString();
11351 } 11378 }
@@ -11368,7 +11395,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11368 { 11395 {
11369 if (a == null || a.Type != 7) 11396 if (a == null || a.Type != 7)
11370 { 11397 {
11371 ShoutError("Notecard '" + name + "' could not be found."); 11398 Error("llGetNotecardLine", "Can't find notecard '" + name + "'");
11372 return; 11399 return;
11373 } 11400 }
11374 11401