From 66923983a7e5214843e59ae40f3c4ad7587feed8 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 17 Oct 2009 22:36:44 +0100 Subject: Add support for display of the script compilation errors in the script editor's debug pane. This will still use DEBUG_CHANNEL currently, since it is not fully implemented. This also removes the "Compiled successfully" message that pops up in the viewer. --- .../ScriptEngine/Shared/Instance/ScriptInstance.cs | 13 +++---- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 45 +++++++++++++++------- 2 files changed, 38 insertions(+), 20 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 97166cf..2b858ec 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -353,15 +353,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance // m_log.ErrorFormat("[Script] Unable to load script state from xml: {0}\n"+e.ToString(), xml); } } - else - { - ScenePresence presence = m_Engine.World.GetScenePresence(part.OwnerID); +// else +// { +// ScenePresence presence = m_Engine.World.GetScenePresence(part.OwnerID); - if (presence != null && (!postOnRez)) - presence.ControllingClient.SendAgentAlertMessage("Compile successful", false); +// if (presence != null && (!postOnRez)) +// presence.ControllingClient.SendAgentAlertMessage("Compile successful", false); -// // m_log.ErrorFormat("[Script] Unable to load script state, file not found"); - } +// } } public void Init() diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 847da8c..7b19ce3 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -604,9 +604,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine 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 @@ -615,10 +612,17 @@ namespace OpenSim.Region.ScriptEngine.XEngine string text = "Warning:\n" + warning; if (text.Length > 1000) text = text.Substring(0, 1000); - World.SimChat(Utils.StringToBytes(text), - ChatTypeEnum.DebugChannel, 2147483647, - part.AbsolutePosition, - part.Name, part.UUID, false); + if (!ShowScriptSaveResponse(item.OwnerID, + assetID, text, true)) + { + if (presence != null && (!postOnRez)) + presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false); + + World.SimChat(Utils.StringToBytes(text), + ChatTypeEnum.DebugChannel, 2147483647, + part.AbsolutePosition, + part.Name, part.UUID, false); + } } catch (Exception e2) // LEGIT: User Scripting { @@ -634,8 +638,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine } catch (Exception e) { - if (presence != null && (!postOnRez)) - presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false); try { // DISPLAY ERROR INWORLD @@ -645,10 +647,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString(); if (text.Length > 1000) text = text.Substring(0, 1000); - World.SimChat(Utils.StringToBytes(text), - ChatTypeEnum.DebugChannel, 2147483647, - part.AbsolutePosition, - part.Name, part.UUID, false); + if (!ShowScriptSaveResponse(item.OwnerID, + assetID, text, false)) + { + if (presence != null && (!postOnRez)) + presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false); + World.SimChat(Utils.StringToBytes(text), + ChatTypeEnum.DebugChannel, 2147483647, + part.AbsolutePosition, + part.Name, part.UUID, false); + } } catch (Exception e2) // LEGIT: User Scripting { @@ -732,6 +740,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_log.DebugFormat("[XEngine] Loaded script {0}.{1}, script UUID {2}, prim UUID {3} @ {4}", part.ParentGroup.RootPart.Name, item.Name, assetID, part.UUID, part.ParentGroup.RootPart.AbsolutePosition.ToString()); + if (presence != null) + { + ShowScriptSaveResponse(item.OwnerID, + assetID, "Compile successful", true); + } + instance.AppDomain = appDomain; instance.LineMap = linemap; @@ -1250,5 +1264,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine return instance.CanBeDeleted(); } + + private bool ShowScriptSaveResponse(UUID ownerID, UUID assetID, string text, bool compiled) + { + return false; + } } } -- cgit v1.1