aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs174
6 files changed, 122 insertions, 90 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 84c2722..cc903e0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2781,7 +2781,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2781 2781
2782 } 2782 }
2783 2783
2784
2785 public void llStopLookAt() 2784 public void llStopLookAt()
2786 { 2785 {
2787 m_host.AddScriptLPS(1); 2786 m_host.AddScriptLPS(1);
@@ -5905,7 +5904,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5905 m_host.AddScriptLPS(1); 5904 m_host.AddScriptLPS(1);
5906 return World.SimulatorFPS; 5905 return World.SimulatorFPS;
5907 } 5906 }
5908 5907
5909 5908
5910 /* particle system rules should be coming into this routine as doubles, that is 5909 /* particle system rules should be coming into this routine as doubles, that is
5911 rule[0] should be an integer from this list and rule[1] should be the arg 5910 rule[0] should be an integer from this list and rule[1] should be the arg
@@ -7523,9 +7522,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7523 break; 7522 break;
7524 7523
7525 case (int)ScriptBaseClass.PRIM_POSITION: 7524 case (int)ScriptBaseClass.PRIM_POSITION:
7526 res.Add(new LSL_Vector(part.AbsolutePosition.X, 7525 LSL_Vector v = new LSL_Vector(part.AbsolutePosition.X,
7527 part.AbsolutePosition.Y, 7526 part.AbsolutePosition.Y,
7528 part.AbsolutePosition.Z)); 7527 part.AbsolutePosition.Z);
7528 // For some reason, the part.AbsolutePosition.* values do not change if the
7529 // linkset is rotated; they always reflect the child prim's world position
7530 // as though the linkset is unrotated. This is incompatible behavior with SL's
7531 // implementation, so will break scripts imported from there (not to mention it
7532 // makes it more difficult to determine a child prim's actual inworld position).
7533 if (part.ParentID != 0)
7534 v = ((v - llGetRootPosition()) * llGetRootRotation()) + llGetRootPosition();
7535 res.Add( v );
7529 break; 7536 break;
7530 7537
7531 case (int)ScriptBaseClass.PRIM_SIZE: 7538 case (int)ScriptBaseClass.PRIM_SIZE:
@@ -7543,6 +7550,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7543 PrimitiveBaseShape Shape = part.Shape; 7550 PrimitiveBaseShape Shape = part.Shape;
7544 int primType = getScriptPrimType(part.Shape); 7551 int primType = getScriptPrimType(part.Shape);
7545 res.Add(new LSL_Integer(primType)); 7552 res.Add(new LSL_Integer(primType));
7553 double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX
7554 double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY.
7546 switch (primType) 7555 switch (primType)
7547 { 7556 {
7548 case ScriptBaseClass.PRIM_TYPE_BOX: 7557 case ScriptBaseClass.PRIM_TYPE_BOX:
@@ -7553,7 +7562,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7553 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0)); 7562 res.Add(new LSL_Float(Shape.ProfileHollow / 50000.0));
7554 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0)); 7563 res.Add(new LSL_Vector(Shape.PathTwistBegin / 100.0, Shape.PathTwist / 100.0, 0));
7555 res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); 7564 res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
7556 res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); 7565 res.Add(new LSL_Vector(topshearx, topsheary, 0));
7557 break; 7566 break;
7558 7567
7559 case ScriptBaseClass.PRIM_TYPE_SPHERE: 7568 case ScriptBaseClass.PRIM_TYPE_SPHERE:
@@ -7588,7 +7597,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7588 res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0)); 7597 res.Add(new LSL_Vector(1 - (Shape.PathScaleX / 100.0 - 1), 1 - (Shape.PathScaleY / 100.0 - 1), 0));
7589 7598
7590 // vector topshear 7599 // vector topshear
7591 res.Add(new LSL_Vector(Shape.PathShearX / 100.0, Shape.PathShearY / 100.0, 0)); 7600 res.Add(new LSL_Vector(topshearx, topsheary, 0));
7592 7601
7593 // vector profilecut 7602 // vector profilecut
7594 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0)); 7603 res.Add(new LSL_Vector(Shape.ProfileBegin / 50000.0, 1 - Shape.ProfileEnd / 50000.0, 0));
@@ -7597,8 +7606,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
7597 res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0)); 7606 res.Add(new LSL_Vector(Shape.PathTaperX / 100.0, Shape.PathTaperY / 100.0, 0));
7598 7607
7599 // float revolutions 7608 // float revolutions
7600 res.Add(new LSL_Float(Shape.PathRevolutions / 50.0)); // needs fixing :( 7609 res.Add(new LSL_Float((Shape.PathRevolutions * 0.015) + 1.0)); // Slightly inaccurate, because an unsigned
7601 7610 // byte is being used to represent the entire
7611 // range of floating-point values from 1.0
7612 // through 4.0 (which is how SL does it).
7613
7602 // float radiusoffset 7614 // float radiusoffset
7603 res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0)); 7615 res.Add(new LSL_Float(Shape.PathRadiusOffset / 100.0));
7604 7616
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
index e427f50..b1fb6c2 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/CSCodeGenerator.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
111 if (emessage.StartsWith(slinfo+": ")) 111 if (emessage.StartsWith(slinfo+": "))
112 emessage = emessage.Substring(slinfo.Length+2); 112 emessage = emessage.Substring(slinfo.Length+2);
113 113
114 message = String.Format("Line ({0},{1}) {2}", 114 message = String.Format("({0},{1}) {2}",
115 e.slInfo.lineNumber - 2, 115 e.slInfo.lineNumber - 2,
116 e.slInfo.charPosition - 1, emessage); 116 e.slInfo.charPosition - 1, emessage);
117 117
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
index 3080c71..d8c0ba5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs
@@ -623,7 +623,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools
623 623
624 // The Second Life viewer's script editor begins 624 // The Second Life viewer's script editor begins
625 // countingn lines and columns at 0, so we subtract 1. 625 // countingn lines and columns at 0, so we subtract 1.
626 errtext += String.Format("Line ({0},{1}): {4} {2}: {3}\n", 626 errtext += String.Format("({0},{1}): {4} {2}: {3}\n",
627 lslPos.Key - 1, lslPos.Value - 1, 627 lslPos.Key - 1, lslPos.Value - 1,
628 CompErr.ErrorNumber, text, severity); 628 CompErr.ErrorNumber, text, severity);
629 hadErrors = true; 629 hadErrors = true;
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
index 3ca7f7c..63afb0b 100644
--- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Tests/CSCodeGeneratorTest.cs
@@ -1673,7 +1673,7 @@ default
1673 { 1673 {
1674 // The syntax error is on line 6, char 5 (expected ';', found 1674 // The syntax error is on line 6, char 5 (expected ';', found
1675 // '}'). 1675 // '}').
1676 Assert.AreEqual("Line (4,4) syntax error", e.Message); 1676 Assert.AreEqual("(4,4) syntax error", e.Message);
1677 throw; 1677 throw;
1678 } 1678 }
1679 } 1679 }
@@ -1698,7 +1698,7 @@ default
1698 catch (System.Exception e) 1698 catch (System.Exception e)
1699 { 1699 {
1700 // The syntax error is on line 5, char 14 (Syntax error) 1700 // The syntax error is on line 5, char 14 (Syntax error)
1701 Assert.AreEqual("Line (3,13) syntax error", e.Message); 1701 Assert.AreEqual("(3,13) syntax error", e.Message);
1702 1702
1703 throw; 1703 throw;
1704 } 1704 }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 8333a27..6ecafd4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -974,7 +974,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
974 if (col == 0) 974 if (col == 0)
975 col++; 975 col++;
976 message = string.Format("Runtime error:\n" + 976 message = string.Format("Runtime error:\n" +
977 "Line ({0}): {1}", scriptLine - 1, 977 "({0}): {1}", scriptLine - 1,
978 e.InnerException.Message); 978 e.InnerException.Message);
979 979
980 System.Console.WriteLine(e.ToString()+"\n"); 980 System.Console.WriteLine(e.ToString()+"\n");
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 2a9a2db..8376846 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -78,6 +78,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
78 private string m_ScriptErrorMessage; 78 private string m_ScriptErrorMessage;
79 private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>(); 79 private Dictionary<string, string> m_uniqueScripts = new Dictionary<string, string>();
80 private bool m_AppDomainLoading; 80 private bool m_AppDomainLoading;
81 private Dictionary<UUID,ArrayList> m_ScriptErrors =
82 new Dictionary<UUID,ArrayList>();
81 83
82 // disable warning: need to keep a reference to XEngine.EventManager 84 // disable warning: need to keep a reference to XEngine.EventManager
83 // alive to avoid it being garbage collected 85 // alive to avoid it being garbage collected
@@ -657,87 +659,97 @@ namespace OpenSim.Region.ScriptEngine.XEngine
657 659
658 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap; 660 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
659 661
660 try 662 lock(m_ScriptErrors)
661 { 663 {
662 lock (m_AddingAssemblies) 664 try
663 { 665 {
664 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap); 666 lock (m_AddingAssemblies)
665 if (!m_AddingAssemblies.ContainsKey(assembly)) { 667 {
666 m_AddingAssemblies[assembly] = 1; 668 m_Compiler.PerformScriptCompile(script, assetID.ToString(), item.OwnerID, out assembly, out linemap);
667 } else { 669 if (!m_AddingAssemblies.ContainsKey(assembly)) {
668 m_AddingAssemblies[assembly]++; 670 m_AddingAssemblies[assembly] = 1;
671 } else {
672 m_AddingAssemblies[assembly]++;
673 }
669 } 674 }
670 }
671 675
672 string[] warnings = m_Compiler.GetWarnings(); 676 string[] warnings = m_Compiler.GetWarnings();
673 677
674 if (warnings != null && warnings.Length != 0) 678 if (warnings != null && warnings.Length != 0)
675 {
676 foreach (string warning in warnings)
677 { 679 {
678 try 680 foreach (string warning in warnings)
679 { 681 {
680 // DISPLAY WARNING INWORLD 682 if (!m_ScriptErrors.ContainsKey(itemID))
681 string text = "Warning:\n" + warning; 683 m_ScriptErrors[itemID] = new ArrayList();
682 if (text.Length > 1000) 684
683 text = text.Substring(0, 1000); 685 m_ScriptErrors[itemID].Add(warning);
684 if (!ShowScriptSaveResponse(item.OwnerID, 686 // try
685 assetID, text, true)) 687 // {
686 { 688 // // DISPLAY WARNING INWORLD
687 if (presence != null && (!postOnRez)) 689 // string text = "Warning:\n" + warning;
688 presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false); 690 // if (text.Length > 1000)
689 691 // text = text.Substring(0, 1000);
690 World.SimChat(Utils.StringToBytes(text), 692 // if (!ShowScriptSaveResponse(item.OwnerID,
691 ChatTypeEnum.DebugChannel, 2147483647, 693 // assetID, text, true))
692 part.AbsolutePosition, 694 // {
693 part.Name, part.UUID, false); 695 // if (presence != null && (!postOnRez))
694 } 696 // presence.ControllingClient.SendAgentAlertMessage("Script saved with warnings, check debug window!", false);
697 //
698 // World.SimChat(Utils.StringToBytes(text),
699 // ChatTypeEnum.DebugChannel, 2147483647,
700 // part.AbsolutePosition,
701 // part.Name, part.UUID, false);
702 // }
703 // }
704 // catch (Exception e2) // LEGIT: User Scripting
705 // {
706 // m_log.Error("[XEngine]: " +
707 // "Error displaying warning in-world: " +
708 // e2.ToString());
709 // m_log.Error("[XEngine]: " +
710 // "Warning:\r\n" +
711 // warning);
712 // }
695 } 713 }
696 catch (Exception e2) // LEGIT: User Scripting
697 {
698 m_log.Error("[XEngine]: " +
699 "Error displaying warning in-world: " +
700 e2.ToString());
701 m_log.Error("[XEngine]: " +
702 "Warning:\r\n" +
703 warning);
704 }
705 }
706 }
707 }
708 catch (Exception e)
709 {
710 try
711 {
712 // DISPLAY ERROR INWORLD
713 m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
714
715 m_ScriptFailCount++;
716 string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
717 if (text.Length > 1000)
718 text = text.Substring(0, 1000);
719 if (!ShowScriptSaveResponse(item.OwnerID,
720 assetID, text, false))
721 {
722 if (presence != null && (!postOnRez))
723 presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
724 World.SimChat(Utils.StringToBytes(text),
725 ChatTypeEnum.DebugChannel, 2147483647,
726 part.AbsolutePosition,
727 part.Name, part.UUID, false);
728 } 714 }
729 } 715 }
730 catch (Exception e2) // LEGIT: User Scripting 716 catch (Exception e)
731 { 717 {
732 m_log.Error("[XEngine]: "+ 718 // try
733 "Error displaying error in-world: " + 719 // {
734 e2.ToString()); 720 if (!m_ScriptErrors.ContainsKey(itemID))
735 m_log.Error("[XEngine]: " + 721 m_ScriptErrors[itemID] = new ArrayList();
736 "Errormessage: Error compiling script:\r\n" + 722 // DISPLAY ERROR INWORLD
737 e.Message.ToString()); 723 // m_ScriptErrorMessage += "Failed to compile script in object: '" + part.ParentGroup.RootPart.Name + "' Script name: '" + item.Name + "' Error message: " + e.Message.ToString();
738 } 724 //
725 m_ScriptFailCount++;
726 m_ScriptErrors[itemID].Add(e.Message.ToString());
727 // string text = "Error compiling script '" + item.Name + "':\n" + e.Message.ToString();
728 // if (text.Length > 1000)
729 // text = text.Substring(0, 1000);
730 // if (!ShowScriptSaveResponse(item.OwnerID,
731 // assetID, text, false))
732 // {
733 // if (presence != null && (!postOnRez))
734 // presence.ControllingClient.SendAgentAlertMessage("Script saved with errors, check debug window!", false);
735 // World.SimChat(Utils.StringToBytes(text),
736 // ChatTypeEnum.DebugChannel, 2147483647,
737 // part.AbsolutePosition,
738 // part.Name, part.UUID, false);
739 // }
740 // }
741 // catch (Exception e2) // LEGIT: User Scripting
742 // {
743 // m_log.Error("[XEngine]: "+
744 // "Error displaying error in-world: " +
745 // e2.ToString());
746 // m_log.Error("[XEngine]: " +
747 // "Errormessage: Error compiling script:\r\n" +
748 // e.Message.ToString());
749 // }
739 750
740 return false; 751 return false;
752 }
741 } 753 }
742 754
743 755
@@ -1252,7 +1264,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1252 return UUID.Zero; 1264 return UUID.Zero;
1253 } 1265 }
1254 1266
1255 [DebuggerNonUserCode]
1256 public void SetState(UUID itemID, string newState) 1267 public void SetState(UUID itemID, string newState)
1257 { 1268 {
1258 IScriptInstance instance = GetInstance(itemID); 1269 IScriptInstance instance = GetInstance(itemID);
@@ -1260,13 +1271,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1260 return; 1271 return;
1261 instance.SetState(newState); 1272 instance.SetState(newState);
1262 } 1273 }
1263 public string GetState(UUID itemID)
1264 {
1265 IScriptInstance instance = GetInstance(itemID);
1266 if (instance == null)
1267 return "default";
1268 return instance.State;
1269 }
1270 1274
1271 public int GetStartParameter(UUID itemID) 1275 public int GetStartParameter(UUID itemID)
1272 { 1276 {
@@ -1552,5 +1556,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1552 1556
1553 return true; 1557 return true;
1554 } 1558 }
1559
1560 public ArrayList GetScriptErrors(UUID itemID)
1561 {
1562 System.Threading.Thread.Sleep(1000);
1563
1564 lock (m_ScriptErrors)
1565 {
1566 if (m_ScriptErrors.ContainsKey(itemID))
1567 {
1568 ArrayList ret = m_ScriptErrors[itemID];
1569 m_ScriptErrors.Remove(itemID);
1570 return ret;
1571 }
1572 return new ArrayList();
1573 }
1574 }
1555 } 1575 }
1556} 1576}