sending more user-friendly messages to the script error window rather than the thrown exceptions.

Signed-off-by: Melanie <melanie@t-data.com>
0.7.4.1
SignpostMarv 2012-07-16 14:47:03 +01:00 committed by Melanie
parent 5d3723a47f
commit ee7478fa16
1 changed files with 14 additions and 1 deletions

View File

@ -1664,9 +1664,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
CheckThreatLevel(ThreatLevel.Low, "osMessageObject"); CheckThreatLevel(ThreatLevel.Low, "osMessageObject");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
UUID objUUID;
if (!UUID.TryParse(objectUUID, out objUUID)) // prior to patching, a thrown exception regarding invalid GUID format would be shouted instead.
{
OSSLShoutError("osMessageObject() cannot send messages to objects with invalid UUIDs");
return;
}
object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) };
SceneObjectPart sceneOP = World.GetSceneObjectPart(new UUID(objectUUID)); SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID);
if (sceneOP == null) // prior to patching, PostObjectEvent() would cause a throw exception to be shouted instead.
{
OSSLShoutError("osMessageObject() cannot send message to " + objUUID.ToString() + ", object was not found in scene.");
return;
}
m_ScriptEngine.PostObjectEvent( m_ScriptEngine.PostObjectEvent(
sceneOP.LocalId, new EventParams( sceneOP.LocalId, new EventParams(