Finishing the code cleanup in DNE, make llDie work again in DNE.

Add some compile messages from XEngine into DNE as well.
0.6.0-stable
Melanie Thielker 2008-09-26 17:59:36 +00:00
parent 16b6738cda
commit e5db6a75d0
4 changed files with 287 additions and 235 deletions

View File

@ -46,21 +46,26 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
public class EventManager : iScriptEngineFunctionModule public class EventManager : iScriptEngineFunctionModule
{ {
// //
// Class is instanced in "ScriptEngine" and Uses "EventQueueManager" that is also instanced in "ScriptEngine". // Class is instanced in "ScriptEngine" and Uses "EventQueueManager"
// that is also instanced in "ScriptEngine".
// This class needs a bit of explaining: // This class needs a bit of explaining:
// //
// This class it the link between an event inside OpenSim and the corresponding event in a user script being executed. // This class it the link between an event inside OpenSim and
// the corresponding event in a user script being executed.
// //
// For example when an user touches an object then the "myScriptEngine.World.EventManager.OnObjectGrab" event is fired inside OpenSim. // For example when an user touches an object then the
// We hook up to this event and queue a touch_start in EventQueueManager with the proper LSL parameters. // "myScriptEngine.World.EventManager.OnObjectGrab" event is fired
// inside OpenSim.
// We hook up to this event and queue a touch_start in
// EventQueueManager with the proper LSL parameters.
// It will then be delivered to the script by EventQueueManager. // It will then be delivered to the script by EventQueueManager.
// //
// You can check debug C# dump of an LSL script if you need to verify what exact parameters are needed. // You can check debug C# dump of an LSL script if you need to
// verify what exact parameters are needed.
// //
private ScriptEngine myScriptEngine; private ScriptEngine myScriptEngine;
//public IScriptHost TEMP_OBJECT_ID;
public EventManager(ScriptEngine _ScriptEngine, bool performHookUp) public EventManager(ScriptEngine _ScriptEngine, bool performHookUp)
{ {
myScriptEngine = _ScriptEngine; myScriptEngine = _ScriptEngine;
@ -74,37 +79,45 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
public void HookUpEvents() public void HookUpEvents()
{ {
// Hook up to events from OpenSim myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName +
// We may not want to do it because someone is controlling us and will deliver events to us "]: Hooking up to server events");
myScriptEngine.Log.Info("[" + myScriptEngine.ScriptEngineName + "]: Hooking up to server events"); myScriptEngine.World.EventManager.OnObjectGrab +=
myScriptEngine.World.EventManager.OnObjectGrab += touch_start; touch_start;
myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnObjectDeGrab +=
myScriptEngine.World.EventManager.OnRemoveScript += OnRemoveScript; touch_end;
myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnRemoveScript +=
myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; OnRemoveScript;
myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent += not_at_target; myScriptEngine.World.EventManager.OnScriptChangedEvent +=
myScriptEngine.World.EventManager.OnScriptControlEvent += control; changed;
myScriptEngine.World.EventManager.OnScriptColliderStart += collision_start; myScriptEngine.World.EventManager.OnScriptAtTargetEvent +=
myScriptEngine.World.EventManager.OnScriptColliding += collision; at_target;
myScriptEngine.World.EventManager.OnScriptCollidingEnd += collision_end; myScriptEngine.World.EventManager.OnScriptNotAtTargetEvent +=
not_at_target;
myScriptEngine.World.EventManager.OnScriptControlEvent +=
control;
myScriptEngine.World.EventManager.OnScriptColliderStart +=
collision_start;
myScriptEngine.World.EventManager.OnScriptColliding +=
collision;
myScriptEngine.World.EventManager.OnScriptCollidingEnd +=
collision_end;
// TODO: HOOK ALL EVENTS UP TO SERVER! IMoneyModule money =
IMoneyModule money=myScriptEngine.World.RequestModuleInterface<IMoneyModule>(); myScriptEngine.World.RequestModuleInterface<IMoneyModule>();
if (money != null) if (money != null)
{
money.OnObjectPaid+=HandleObjectPaid; money.OnObjectPaid+=HandleObjectPaid;
} }
}
public void ReadConfig() public void ReadConfig()
{ {
} }
private void HandleObjectPaid(UUID objectID, UUID agentID, int amount) private void HandleObjectPaid(UUID objectID, UUID agentID, int amount)
{ {
SceneObjectPart part=myScriptEngine.World.GetSceneObjectPart(objectID); SceneObjectPart part =
myScriptEngine.World.GetSceneObjectPart(objectID);
if (part != null) if (part != null)
{ {
money(part.LocalId, agentID, amount); money(part.LocalId, agentID, amount);
@ -127,8 +140,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
new DetectParams[0])); new DetectParams[0]));
} }
public void touch_start(uint localID, uint originalID, Vector3 offsetPos, public void touch_start(uint localID, uint originalID,
IClientAPI remoteClient) Vector3 offsetPos, IClientAPI remoteClient)
{ {
// Add to queue for all scripts in ObjectID object // Add to queue for all scripts in ObjectID object
DetectParams[] det = new DetectParams[1]; DetectParams[] det = new DetectParams[1];
@ -138,7 +151,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
if (originalID == 0) if (originalID == 0)
{ {
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID); SceneObjectPart part =
myScriptEngine.World.GetSceneObjectPart(localID);
if (part == null) if (part == null)
return; return;
@ -146,7 +161,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
} }
else else
{ {
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); SceneObjectPart originalPart =
myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum; det[0].LinkNum = originalPart.LinkNum;
} }
@ -196,7 +212,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
if (originalID == 0) if (originalID == 0)
{ {
SceneObjectPart part = myScriptEngine.World.GetSceneObjectPart(localID); SceneObjectPart part =
myScriptEngine.World.GetSceneObjectPart(localID);
if (part == null) if (part == null)
return; return;
@ -204,7 +221,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
} }
else else
{ {
SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); SceneObjectPart originalPart =
myScriptEngine.World.GetSceneObjectPart(originalID);
det[0].LinkNum = originalPart.LinkNum; det[0].LinkNum = originalPart.LinkNum;
} }
@ -213,9 +231,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
det)); det));
} }
public void OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine) public void OnRezScript(uint localID, UUID itemID, string script,
int startParam, bool postOnRez, string engine)
{ {
List<IScriptModule> engines = new List<IScriptModule>(myScriptEngine.World.RequestModuleInterfaces<IScriptModule>()); List<IScriptModule> engines =
new List<IScriptModule>(
myScriptEngine.World.RequestModuleInterfaces<IScriptModule>());
List<string> names = new List<string>(); List<string> names = new List<string>();
foreach (IScriptModule m in engines) foreach (IScriptModule m in engines)
@ -228,7 +249,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
string firstline = script.Substring(0, lineEnd).Trim(); string firstline = script.Substring(0, lineEnd).Trim();
int colon = firstline.IndexOf(':'); int colon = firstline.IndexOf(':');
if (firstline.Length > 2 && firstline.Substring(0, 2) == "//" && colon != -1) if (firstline.Length > 2 &&
firstline.Substring(0, 2) == "//" && colon != -1)
{ {
string engineName = firstline.Substring(2, colon-2); string engineName = firstline.Substring(2, colon-2);
@ -237,15 +259,43 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
engine = engineName; engine = engineName;
script = "//" + script.Substring(script.IndexOf(':')+1); script = "//" + script.Substring(script.IndexOf(':')+1);
} }
else
{
if (engine == myScriptEngine.ScriptEngineName)
{
SceneObjectPart part =
myScriptEngine.World.GetSceneObjectPart(
localID);
TaskInventoryItem item =
part.GetInventoryItem(itemID);
ScenePresence presence =
myScriptEngine.World.GetScenePresence(
item.OwnerID);
if (presence != null)
{
presence.ControllingClient.SendAgentAlertMessage(
"Selected engine unavailable. "+
"Running script on "+
myScriptEngine.ScriptEngineName,
false);
}
}
}
} }
} }
if (engine != myScriptEngine.ScriptEngineName) if (engine != myScriptEngine.ScriptEngineName)
return; return;
myScriptEngine.Log.Debug("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + myScriptEngine.Log.Debug("OnRezScript localID: " + localID +
" LLUID: " + itemID.ToString() + " Size: " +
script.Length); script.Length);
myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script, startParam, postOnRez);
myScriptEngine.m_ScriptManager.StartScript(localID, itemID, script,
startParam, postOnRez);
} }
public void OnRemoveScript(uint localID, UUID itemID) public void OnRemoveScript(uint localID, UUID itemID)

View File

@ -34,20 +34,18 @@ using System.Globalization;
using OpenMetaverse; using OpenMetaverse;
using log4net; using log4net;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.ScriptEngine.Shared;
namespace OpenSim.Region.ScriptEngine.DotNetEngine namespace OpenSim.Region.ScriptEngine.DotNetEngine
{ {
/// <summary> // Because every thread needs some data set for it
/// Because every thread needs some data set for it (time started to execute current function), it will do its work within a class // (time started to execute current function), it will do its work
/// </summary> // within a class
public class EventQueueThreadClass : iScriptEngineFunctionModule public class EventQueueThreadClass : iScriptEngineFunctionModule
{ {
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // How many ms to sleep if queue is empty
/// <summary>
/// How many ms to sleep if queue is empty
/// </summary>
private static int nothingToDoSleepms;// = 50; private static int nothingToDoSleepms;// = 50;
private static ThreadPriority MyThreadPriority; private static ThreadPriority MyThreadPriority;
@ -77,13 +75,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{ {
lock (ScriptEngine.ScriptEngines) lock (ScriptEngine.ScriptEngines)
{ {
foreach (ScriptEngine m_ScriptEngine in ScriptEngine.ScriptEngines) foreach (ScriptEngine m_ScriptEngine in
ScriptEngine.ScriptEngines)
{ {
ScriptEngineName = m_ScriptEngine.ScriptEngineName; ScriptEngineName = m_ScriptEngine.ScriptEngineName;
nothingToDoSleepms = m_ScriptEngine.ScriptConfigSource.GetInt("SleepTimeIfNoScriptExecutionMs", 50); nothingToDoSleepms =
m_ScriptEngine.ScriptConfigSource.GetInt(
"SleepTimeIfNoScriptExecutionMs", 50);
string pri = m_ScriptEngine.ScriptConfigSource.GetString(
"ScriptThreadPriority", "BelowNormal");
// Later with ScriptServer we might want to ask OS for stuff too, so doing this a bit manually
string pri = m_ScriptEngine.ScriptConfigSource.GetString("ScriptThreadPriority", "BelowNormal");
switch (pri.ToLower()) switch (pri.ToLower())
{ {
case "lowest": case "lowest":
@ -102,9 +104,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
MyThreadPriority = ThreadPriority.Highest; MyThreadPriority = ThreadPriority.Highest;
break; break;
default: default:
MyThreadPriority = ThreadPriority.BelowNormal; // Default MyThreadPriority = ThreadPriority.BelowNormal;
m_ScriptEngine.Log.Error("[ScriptEngine.DotNetEngine]: Unknown priority type \"" + pri + m_ScriptEngine.Log.Error(
"\" in config file. Defaulting to \"BelowNormal\"."); "[ScriptEngine.DotNetEngine]: Unknown "+
"priority type \"" + pri +
"\" in config file. Defaulting to "+
"\"BelowNormal\".");
break; break;
} }
} }
@ -128,41 +133,41 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
EventQueueThread.Start(); EventQueueThread.Start();
ThreadTracker.Add(EventQueueThread); ThreadTracker.Add(EventQueueThread);
// Look at this... Don't you wish everyone did that solid coding everywhere? :P // Look at this... Don't you wish everyone did that solid
// coding everywhere? :P
if (ThreadCount == int.MaxValue) if (ThreadCount == int.MaxValue)
ThreadCount = 0; ThreadCount = 0;
ThreadCount++; ThreadCount++;
} }
public void Stop() public void Stop()
{ {
//PleaseShutdown = true; // Set shutdown flag
//Thread.Sleep(100); // Wait a bit
if (EventQueueThread != null && EventQueueThread.IsAlive == true) if (EventQueueThread != null && EventQueueThread.IsAlive == true)
{ {
try try
{ {
EventQueueThread.Abort(); // Send abort EventQueueThread.Abort(); // Send abort
//EventQueueThread.Join(); // Wait for it
} }
catch (Exception) catch (Exception)
{ {
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Exception killing worker thread: " + e.ToString());
} }
} }
} }
private EventQueueManager.QueueItemStruct BlankQIS = new EventQueueManager.QueueItemStruct(); private EventQueueManager.QueueItemStruct BlankQIS =
new EventQueueManager.QueueItemStruct();
private ScriptEngine lastScriptEngine; private ScriptEngine lastScriptEngine;
/// <summary> private uint lastLocalID;
/// Queue processing thread loop
/// </summary> // Queue processing thread loop
private void EventQueueThreadLoop() private void EventQueueThreadLoop()
{ {
CultureInfo USCulture = new CultureInfo("en-US"); CultureInfo USCulture = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = USCulture; Thread.CurrentThread.CurrentCulture = USCulture;
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread spawned");
try try
{ {
while (true) while (true)
@ -177,60 +182,49 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
catch (ThreadAbortException) catch (ThreadAbortException)
{ {
if (lastScriptEngine != null) if (lastScriptEngine != null)
lastScriptEngine.Log.Info("[" + ScriptEngineName + "]: ThreadAbortException while executing function."); lastScriptEngine.Log.Info("[" + ScriptEngineName +
"]: ThreadAbortException while executing "+
"function.");
}
catch (SelfDeleteException) // Must delete SOG
{
SceneObjectPart part =
lastScriptEngine.World.GetSceneObjectPart(
lastLocalID);
if (part != null && part.ParentGroup != null)
lastScriptEngine.World.DeleteSceneObject(
part.ParentGroup);
} }
catch (Exception e) catch (Exception e)
{ {
if (lastScriptEngine != null) if (lastScriptEngine != null)
lastScriptEngine.Log.Error("[" + ScriptEngineName + "]: Exception in EventQueueThreadLoop: " + e.ToString()); lastScriptEngine.Log.Error("[" + ScriptEngineName +
"]: Exception in EventQueueThreadLoop: " +
e.ToString());
} }
} }
} }
catch (ThreadAbortException) catch (ThreadAbortException)
{ {
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: EventQueueManager Worker thread killed: " + tae.Message);
} }
} }
public void DoProcessQueue() public void DoProcessQueue()
{ {
//lock (ScriptEngine.ScriptEngines) foreach (ScriptEngine m_ScriptEngine in
//{ new ArrayList(ScriptEngine.ScriptEngines))
foreach (ScriptEngine m_ScriptEngine in new ArrayList(ScriptEngine.ScriptEngines))
{ {
lastScriptEngine = m_ScriptEngine; lastScriptEngine = m_ScriptEngine;
// Every now and then check if we should shut down
//if (PleaseShutdown || EventQueueManager.ThreadsToExit > 0)
//{
// // Someone should shut down, lets get exclusive lock
// lock (EventQueueManager.ThreadsToExitLock)
// {
// // Lets re-check in case someone grabbed it
// if (EventQueueManager.ThreadsToExit > 0)
// {
// // Its crowded here so we'll shut down
// EventQueueManager.ThreadsToExit--;
// Stop();
// return;
// }
// else
// {
// // We have been asked to shut down
// Stop();
// return;
// }
// }
//}
//try
// {
EventQueueManager.QueueItemStruct QIS = BlankQIS; EventQueueManager.QueueItemStruct QIS = BlankQIS;
bool GotItem = false; bool GotItem = false;
//if (PleaseShutdown) //if (PleaseShutdown)
// return; // return;
if (m_ScriptEngine.m_EventQueueManager == null || m_ScriptEngine.m_EventQueueManager.eventQueue == null) if (m_ScriptEngine.m_EventQueueManager == null ||
m_ScriptEngine.m_EventQueueManager.eventQueue == null)
continue; continue;
if (m_ScriptEngine.m_EventQueueManager.eventQueue.Count == 0) if (m_ScriptEngine.m_EventQueueManager.eventQueue.Count == 0)
@ -241,9 +235,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
else else
{ {
// Something in queue, process // Something in queue, process
//myScriptEngine.Log.Info("[" + ScriptEngineName + "]: Processing event for localID: " + QIS.localID + ", itemID: " + QIS.itemID + ", FunctionName: " + QIS.FunctionName);
// OBJECT BASED LOCK - TWO THREADS WORKING ON SAME OBJECT IS NOT GOOD // OBJECT BASED LOCK - TWO THREADS WORKING ON SAME
// OBJECT IS NOT GOOD
lock (m_ScriptEngine.m_EventQueueManager.eventQueue) lock (m_ScriptEngine.m_EventQueueManager.eventQueue)
{ {
GotItem = false; GotItem = false;
@ -252,11 +246,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Get queue item // Get queue item
QIS = m_ScriptEngine.m_EventQueueManager.eventQueue.Dequeue(); QIS = m_ScriptEngine.m_EventQueueManager.eventQueue.Dequeue();
// Check if object is being processed by someone else // Check if object is being processed by
if (m_ScriptEngine.m_EventQueueManager.TryLock(QIS.localID) == false) // someone else
if (m_ScriptEngine.m_EventQueueManager.TryLock(
QIS.localID) == false)
{ {
// Object is already being processed, requeue it // Object is already being processed, requeue it
m_ScriptEngine.m_EventQueueManager.eventQueue.Enqueue(QIS); m_ScriptEngine.m_EventQueueManager.
eventQueue.Enqueue(QIS);
} }
else else
{ {
@ -272,26 +269,21 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// Execute function // Execute function
try try
{ {
///cfk 2-7-08 dont need this right now and the default Linux build has DEBUG defined
#if DEBUG
//eventQueueManager.m_ScriptEngine.Log.Debug("[" + ScriptEngineName + "]: " +
// "Executing event:\r\n"
// + "QIS.localID: " + QIS.localID
// + ", QIS.itemID: " + QIS.itemID
// + ", QIS.functionName: " +
// QIS.functionName);
#endif
// Only pipe event if land supports it. // Only pipe event if land supports it.
if (m_ScriptEngine.World.PipeEventsForScript(QIS.localID)) if (m_ScriptEngine.World.PipeEventsForScript(
QIS.localID))
{ {
lastLocalID = QIS.localID;
LastExecutionStarted = DateTime.Now.Ticks; LastExecutionStarted = DateTime.Now.Ticks;
KillCurrentScript = false; KillCurrentScript = false;
InExecution = true; InExecution = true;
m_ScriptEngine.m_ScriptManager.ExecuteEvent(QIS.localID, m_ScriptEngine.m_ScriptManager.ExecuteEvent(
QIS.localID,
QIS.itemID, QIS.itemID,
QIS.functionName, QIS.functionName,
QIS.llDetectParams, QIS.llDetectParams,
QIS.param); QIS.param);
InExecution = false; InExecution = false;
} }
} }
@ -299,8 +291,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
{ {
InExecution = false; InExecution = false;
// DISPLAY ERROR INWORLD // DISPLAY ERROR INWORLD
string text = "Error executing script function \"" + QIS.functionName + string text = "Error executing script function \"" +
"\":\r\n"; QIS.functionName + "\":\r\n";
if (e.InnerException != null) if (e.InnerException != null)
{ {
// Send inner exception // Send inner exception
@ -325,21 +318,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
text = text.Substring(0, 1500); text = text.Substring(0, 1500);
IScriptHost m_host = IScriptHost m_host =
m_ScriptEngine.World.GetSceneObjectPart(QIS.localID); m_ScriptEngine.World.GetSceneObjectPart(QIS.localID);
//if (m_host != null) m_ScriptEngine.World.SimChat(
//{ Utils.StringToBytes(text),
m_ScriptEngine.World.SimChat(Utils.StringToBytes(text),
ChatTypeEnum.DebugChannel, 2147483647, ChatTypeEnum.DebugChannel, 2147483647,
m_host.AbsolutePosition, m_host.AbsolutePosition,
m_host.Name, m_host.UUID, false); m_host.Name, m_host.UUID, false);
} }
catch (Exception) catch (Exception)
{ {
//} m_ScriptEngine.m_EventQueueManager.
//else m_ScriptEngine.Log.Error("[" +
//{ ScriptEngineName + "]: " +
// T oconsole
m_ScriptEngine.m_EventQueueManager.m_ScriptEngine.Log.Error("[" + ScriptEngineName +
"]: " +
"Unable to send text in-world:\r\n" + "Unable to send text in-world:\r\n" +
text); text);
} }
@ -348,7 +337,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
// So we are done sending message in-world // So we are done sending message in-world
if (KillCurrentScript) if (KillCurrentScript)
{ {
m_ScriptEngine.m_EventQueueManager.m_ScriptEngine.m_ScriptManager.StopScript( m_ScriptEngine.m_EventQueueManager.
m_ScriptEngine.m_ScriptManager.
StopScript(
QIS.localID, QIS.itemID); QIS.localID, QIS.itemID);
} }
} }
@ -360,22 +351,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
finally finally
{ {
InExecution = false; InExecution = false;
m_ScriptEngine.m_EventQueueManager.ReleaseLock(QIS.localID); m_ScriptEngine.m_EventQueueManager.ReleaseLock(
QIS.localID);
} }
} }
} }
} }
// }
} }
///// <summary>
///// If set to true then threads and stuff should try to make a graceful exit
///// </summary>
//public bool PleaseShutdown
//{
// get { return _PleaseShutdown; }
// set { _PleaseShutdown = value; }
//}
//private bool _PleaseShutdown = false;
} }
} }

View File

@ -439,13 +439,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
#region Perform event execution in script #region Perform event execution in script
/// <summary> // Execute a LL-event-function in Script
/// Execute a LL-event-function in Script
/// </summary>
/// <param name="localID">Object the script is located in</param>
/// <param name="itemID">Script ID</param>
/// <param name="FunctionName">Name of function</param>
/// <param name="args">Arguments to pass to function</param>
internal void ExecuteEvent(uint localID, UUID itemID, internal void ExecuteEvent(uint localID, UUID itemID,
string FunctionName, DetectParams[] qParams, object[] args) string FunctionName, DetectParams[] qParams, object[] args)
{ {
@ -454,8 +448,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
return; return;
detparms[id] = qParams; detparms[id] = qParams;
if (id.Running) if (id.Running)
id.Script.ExecuteEvent(id.State, FunctionName, args); id.Script.ExecuteEvent(id.State, FunctionName, args);
detparms.Remove(id); detparms.Remove(id);
} }

View File

@ -356,6 +356,31 @@ namespace OpenSim.Region.ScriptEngine.XEngine
engine = engineName; engine = engineName;
script = "//" + script.Substring(script.IndexOf(':')+1); script = "//" + script.Substring(script.IndexOf(':')+1);
} }
else
{
if (engine == ScriptEngineName)
{
SceneObjectPart part =
m_Scene.GetSceneObjectPart(
localID);
TaskInventoryItem item =
part.GetInventoryItem(itemID);
ScenePresence presence =
m_Scene.GetScenePresence(
item.OwnerID);
if (presence != null)
{
presence.ControllingClient.SendAgentAlertMessage(
"Selected engine unavailable. "+
"Running script on "+
ScriptEngineName,
false);
}
}
}
} }
} }