diff options
author | Charles Krinke | 2008-07-04 00:59:38 +0000 |
---|---|---|
committer | Charles Krinke | 2008-07-04 00:59:38 +0000 |
commit | ce5122ebf3077085d1ca6967634b4e0baad94d6c (patch) | |
tree | c65aa10649c677a9f2a39421c2c99d5a4857bc63 /OpenSim | |
parent | Mantis#1660. Thank you, kindly, Melanie for a patch that: (diff) | |
download | opensim-SC-ce5122ebf3077085d1ca6967634b4e0baad94d6c.zip opensim-SC-ce5122ebf3077085d1ca6967634b4e0baad94d6c.tar.gz opensim-SC-ce5122ebf3077085d1ca6967634b4e0baad94d6c.tar.bz2 opensim-SC-ce5122ebf3077085d1ca6967634b4e0baad94d6c.tar.xz |
Mantis#1659. Thank you, Melanie for a patch that:
In LSL, the state command should have an immediate effect.
The OpenSim script engine seems to wait until the function
ends to process the state transition.
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Helpers.cs | 15 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 67 |
3 files changed, 53 insertions, 31 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7887515..06f9f3b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -99,6 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
99 | public void state(string newState) | 99 | public void state(string newState) |
100 | { | 100 | { |
101 | m_ScriptEngine.SetState(m_itemID, newState); | 101 | m_ScriptEngine.SetState(m_itemID, newState); |
102 | throw new EventAbortException(); | ||
102 | } | 103 | } |
103 | 104 | ||
104 | public void llSay(int channelID, string text) | 105 | public void llSay(int channelID, string text) |
@@ -2791,6 +2792,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2791 | { | 2792 | { |
2792 | m_host.AddScriptLPS(1); | 2793 | m_host.AddScriptLPS(1); |
2793 | m_ScriptEngine.ApiResetScript(m_itemID); | 2794 | m_ScriptEngine.ApiResetScript(m_itemID); |
2795 | throw new EventAbortException(); | ||
2794 | } | 2796 | } |
2795 | 2797 | ||
2796 | public void llMessageLinked(int linknum, int num, string msg, string id) | 2798 | public void llMessageLinked(int linknum, int num, string msg, string id) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs index fdd404d..28a2173 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Helpers.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Helpers.cs | |||
@@ -30,6 +30,7 @@ using System.IO; | |||
30 | using System.Threading; | 30 | using System.Threading; |
31 | using System.Collections; | 31 | using System.Collections; |
32 | using System.Collections.Generic; | 32 | using System.Collections.Generic; |
33 | using System.Runtime.Serialization; | ||
33 | using libsecondlife; | 34 | using libsecondlife; |
34 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
35 | using OpenSim.Region.Environment; | 36 | using OpenSim.Region.Environment; |
@@ -37,6 +38,20 @@ using OpenSim.Region.Environment.Scenes; | |||
37 | 38 | ||
38 | namespace OpenSim.Region.ScriptEngine.Shared | 39 | namespace OpenSim.Region.ScriptEngine.Shared |
39 | { | 40 | { |
41 | [Serializable] | ||
42 | public class EventAbortException : Exception | ||
43 | { | ||
44 | public EventAbortException() | ||
45 | { | ||
46 | } | ||
47 | |||
48 | protected EventAbortException( | ||
49 | SerializationInfo info, | ||
50 | StreamingContext context) | ||
51 | { | ||
52 | } | ||
53 | } | ||
54 | |||
40 | public class DetectParams | 55 | public class DetectParams |
41 | { | 56 | { |
42 | public DetectParams() | 57 | public DetectParams() |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 5e3b91a..cbc5112 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1296,44 +1296,49 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1296 | catch (Exception e) | 1296 | catch (Exception e) |
1297 | { | 1297 | { |
1298 | m_InEvent = false; | 1298 | m_InEvent = false; |
1299 | if (e is System.Threading.ThreadAbortException) | 1299 | m_CurrentEvent = String.Empty; |
1300 | |||
1301 | if (!(e is TargetInvocationException) || !(e.InnerException is EventAbortException)) | ||
1300 | { | 1302 | { |
1301 | lock (m_EventQueue) | 1303 | if (e is System.Threading.ThreadAbortException) |
1302 | { | 1304 | { |
1303 | if ((m_EventQueue.Count > 0) && m_RunEvents) | 1305 | lock (m_EventQueue) |
1304 | { | 1306 | { |
1305 | m_CurrentResult=m_Engine.QueueEventHandler(this); | 1307 | if ((m_EventQueue.Count > 0) && m_RunEvents) |
1306 | } | 1308 | { |
1307 | else | 1309 | m_CurrentResult=m_Engine.QueueEventHandler(this); |
1308 | { | 1310 | } |
1309 | m_CurrentResult = null; | 1311 | else |
1312 | { | ||
1313 | m_CurrentResult = null; | ||
1314 | } | ||
1310 | } | 1315 | } |
1311 | } | ||
1312 | 1316 | ||
1313 | m_DetectParams = null; | 1317 | m_DetectParams = null; |
1314 | 1318 | ||
1315 | return 0; | 1319 | return 0; |
1316 | } | 1320 | } |
1317 | 1321 | ||
1318 | try | 1322 | try |
1319 | { | 1323 | { |
1320 | // DISPLAY ERROR INWORLD | 1324 | // DISPLAY ERROR INWORLD |
1321 | string text = "Runtime error:\n" + e.ToString(); | 1325 | string text = "Runtime error:\n" + e.ToString(); |
1322 | if (text.Length > 1400) | 1326 | if (text.Length > 1400) |
1323 | text = text.Substring(0, 1400); | 1327 | text = text.Substring(0, 1400); |
1324 | m_Engine.World.SimChat(Helpers.StringToField(text), | 1328 | m_Engine.World.SimChat(Helpers.StringToField(text), |
1325 | ChatTypeEnum.DebugChannel, 2147483647, | 1329 | ChatTypeEnum.DebugChannel, 2147483647, |
1326 | part.AbsolutePosition, | 1330 | part.AbsolutePosition, |
1327 | part.Name, part.UUID, false); | 1331 | part.Name, part.UUID, false); |
1328 | } | 1332 | } |
1329 | catch (Exception e2) // LEGIT: User Scripting | 1333 | catch (Exception e2) // LEGIT: User Scripting |
1330 | { | 1334 | { |
1331 | m_Engine.Log.Error("[XEngine]: "+ | 1335 | m_Engine.Log.Error("[XEngine]: "+ |
1332 | "Error displaying error in-world: " + | 1336 | "Error displaying error in-world: " + |
1333 | e2.ToString()); | 1337 | e2.ToString()); |
1334 | m_Engine.Log.Error("[XEngine]: " + | 1338 | m_Engine.Log.Error("[XEngine]: " + |
1335 | "Errormessage: Error compiling script:\r\n" + | 1339 | "Errormessage: Error compiling script:\r\n" + |
1336 | e.ToString()); | 1340 | e.ToString()); |
1341 | } | ||
1337 | } | 1342 | } |
1338 | } | 1343 | } |
1339 | } | 1344 | } |