aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XEngine/XEngine.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs62
1 files changed, 43 insertions, 19 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index b1583b2..79d1944 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -835,35 +835,59 @@ namespace OpenSim.Region.ScriptEngine.XEngine
835 int colon = firstline.IndexOf(':'); 835 int colon = firstline.IndexOf(':');
836 if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1) 836 if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1)
837 { 837 {
838 string engineName = firstline.Substring(2, colon-2); 838 string engineName = firstline.Substring(2, colon - 2);
839 839
840 if (names.Contains(engineName)) 840 if (names.Contains(engineName))
841 { 841 {
842 engine = engineName; 842 engine = engineName;
843 script = "//" + script.Substring(script.IndexOf(':')+1); 843 script = "//" + script.Substring(colon + 1);
844 } 844 }
845 else 845 else
846 { 846 {
847 if (engine == ScriptEngineName) 847 if (engine == ScriptEngineName)
848 { 848 {
849 SceneObjectPart part = 849 // If we are falling back on XEngine as the default engine, then only complain to the user
850 m_Scene.GetSceneObjectPart( 850 // if a script language has been explicitly set and it's one that we recognize. If it's
851 localID); 851 // explicitly not allowed or the script is not in LSL then the user will be informed by a later compiler message.
852 852 //
853 TaskInventoryItem item = 853 // This avoids the overwhelming number of false positives where we're in this code because
854 part.Inventory.GetInventoryItem(itemID); 854 // there's a colon in a comment in the first line of a script for entirely
855 855 // unrelated reasons (e.g. vim settings).
856 ScenePresence presence = 856 //
857 m_Scene.GetScenePresence( 857 // TODO: A better fix would be to deprecate simple : detection and look for some less likely
858 item.OwnerID); 858 // string to begin the comment (like #! in unix shell scripts).
859 859 bool scriptExplicitlyInXEngineLanguage = false;
860 if (presence != null) 860 string restOfScript = script.Substring(colon + 1);
861
862 // FIXME: These are hardcoded because they are currently hardcoded in Compiler.cs
863 if (restOfScript.StartsWith("c#")
864 || restOfScript.StartsWith("vb")
865 || restOfScript.StartsWith("lsl")
866 || restOfScript.StartsWith("js")
867 || restOfScript.StartsWith("yp"))
868 scriptExplicitlyInXEngineLanguage = true;
869
870 if (scriptExplicitlyInXEngineLanguage)
861 { 871 {
862 presence.ControllingClient.SendAgentAlertMessage( 872 SceneObjectPart part =
863 "Selected engine unavailable. "+ 873 m_Scene.GetSceneObjectPart(
864 "Running script on "+ 874 localID);
865 ScriptEngineName, 875
866 false); 876 TaskInventoryItem item =
877 part.Inventory.GetInventoryItem(itemID);
878
879 ScenePresence presence =
880 m_Scene.GetScenePresence(
881 item.OwnerID);
882
883 if (presence != null)
884 {
885 presence.ControllingClient.SendAgentAlertMessage(
886 "Selected engine unavailable. "+
887 "Running script on "+
888 ScriptEngineName,
889 false);
890 }
867 } 891 }
868 } 892 }
869 } 893 }