From 08c76989a719803e4cb7c5391bc864046bba31f2 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 23 Feb 2009 02:43:51 +0000 Subject: Mantis#3187. Thank you kindly, DoranZemlja for a patch that: Adds a warning for an LSL construct that exploits a popular list memory saving hack. --- .../ScriptEngine/DotNetEngine/ScriptManager.cs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index 4ede7f1..32eb200 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -218,6 +218,43 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine localID, itemID, "on_rez", new DetectParams[0], new object[] { new LSL_Types.LSLInteger(startParam) }); } + + string[] warnings = LSLCompiler.GetWarnings(); + + if (warnings != null && warnings.Length != 0) + { + if (presence != null && (!postOnRez)) + presence.ControllingClient.SendAgentAlertMessage( + "Script saved with warnings, check debug window!", + false); + + foreach (string warning in warnings) + { + try + { + // DISPLAY WARNING INWORLD + string text = "Warning:\n" + warning; + if (text.Length > 1100) + text = text.Substring(0, 1099); + + World.SimChat(Utils.StringToBytes(text), + ChatTypeEnum.DebugChannel, 2147483647, + m_host.AbsolutePosition, m_host.Name, m_host.UUID, + false); + } + catch (Exception e2) // LEGIT: User Scripting + { + m_log.Error("[" + + m_scriptEngine.ScriptEngineName + + "]: Error displaying warning in-world: " + + e2.ToString()); + m_log.Error("[" + + m_scriptEngine.ScriptEngineName + "]: " + + "Warning:\r\n" + + warning); + } + } + } } catch (Exception e) // LEGIT: User Scripting { -- cgit v1.1