This fix allows you to configure a script-to-console-log channel

association. Then, whenever there is an llSay to that channel,
  the message is directed to the OpenSim console log (and NOT
  forwarded to the client). This is a great way to capture scripting
  events to the log. To enable, add ScriptConsoleChannel = -xxx to
  the ScriptEngine parameters in the .ini file. Note that the
  message is written using Console.WriteLine rather than
  the rather more fragile log4net service. The console channel is
  also not subjected to the 1024 character limit imposed on regular
  say traffic.

Signed-off-by: dr scofield (aka dirk husemann) <drscofield@xyzzyxyzzy.net>
remotes/origin/0.6.7-post-fixes
Alan M Webb 2009-09-16 10:33:42 -04:00 committed by dr scofield (aka dirk husemann)
parent d4c98ddffc
commit 9cbb865985
1 changed files with 70 additions and 49 deletions

View File

@ -85,6 +85,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected bool m_automaticLinkPermission = false; protected bool m_automaticLinkPermission = false;
protected IMessageTransferModule m_TransferModule = null; protected IMessageTransferModule m_TransferModule = null;
protected int m_notecardLineReadCharsMax = 255; protected int m_notecardLineReadCharsMax = 255;
protected int m_scriptConsoleChannel = 0;
protected bool m_scriptConsoleChannelEnabled = false;
protected IUrlModule m_UrlModule = null; protected IUrlModule m_UrlModule = null;
public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID) public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, uint localID, UUID itemID)
@ -94,21 +96,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_localID = localID; m_localID = localID;
m_itemID = itemID; m_itemID = itemID;
m_ScriptDelayFactor = m_ScriptDelayFactor = m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f);
m_ScriptEngine.Config.GetFloat("ScriptDelayFactor", 1.0f); m_ScriptDistanceFactor = m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f);
m_ScriptDistanceFactor = m_MinTimerInterval = m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f);
m_ScriptEngine.Config.GetFloat("ScriptDistanceLimitFactor", 1.0f); m_automaticLinkPermission = m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
m_MinTimerInterval = m_scriptConsoleChannel = m_ScriptEngine.Config.GetInt("ScriptConsoleChannel", 0);
m_ScriptEngine.Config.GetFloat("MinTimerInterval", 0.5f); m_scriptConsoleChannelEnabled = (m_scriptConsoleChannel != 0);
m_automaticLinkPermission = m_notecardLineReadCharsMax = m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
m_notecardLineReadCharsMax =
m_ScriptEngine.Config.GetInt("NotecardLineReadCharsMax", 255);
if (m_notecardLineReadCharsMax > 65535) if (m_notecardLineReadCharsMax > 65535)
m_notecardLineReadCharsMax = 65535; m_notecardLineReadCharsMax = 65535;
m_TransferModule = m_TransferModule = m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
if (m_UrlModule != null) if (m_UrlModule != null)
{ {
@ -742,6 +740,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_scriptConsoleChannelEnabled && (channelID == m_scriptConsoleChannel))
{
Console.WriteLine(text);
}
else
{
if (text.Length > 1023) if (text.Length > 1023)
text = text.Substring(0, 1023); text = text.Substring(0, 1023);
@ -751,6 +755,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); IWorldComm wComm = m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text); wComm.DeliverMessage(ChatTypeEnum.Say, channelID, m_host.Name, m_host.UUID, text);
} }
}
public void llShout(int channelID, string text) public void llShout(int channelID, string text)
{ {
@ -6316,10 +6321,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero); UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_localID, m_itemID, UUID.Zero);
IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
if (xmlRpcRouter != null) if (xmlRpcRouter != null)
xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID, m_itemID, "http://"+System.Environment.MachineName+":"+xmlrpcMod.Port.ToString()+"/"); xmlRpcRouter.RegisterNewReceiver(m_ScriptEngine.ScriptModule, channelID, m_host.UUID,
object[] resobj = new object[] { new LSL_Integer(1), new LSL_String(channelID.ToString()), new LSL_String(UUID.Zero.ToString()), new LSL_String(String.Empty), new LSL_Integer(0), new LSL_String(String.Empty) }; m_itemID, String.Format("http://{0}:{1}/", System.Environment.MachineName,
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams( xmlrpcMod.Port.ToString()));
"remote_data", resobj, object[] resobj = new object[]
{
new LSL_Integer(1),
new LSL_String(channelID.ToString()),
new LSL_String(UUID.Zero.ToString()),
new LSL_String(String.Empty),
new LSL_Integer(0),
new LSL_String(String.Empty)
};
m_ScriptEngine.PostScriptEvent(m_itemID, new EventParams("remote_data", resobj,
new DetectParams[0])); new DetectParams[0]));
} }
ConditionalScriptSleep(1000); ConditionalScriptSleep(1000);
@ -6352,7 +6366,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_String llMD5String(string src, int nonce) public LSL_String llMD5String(string src, int nonce)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return Util.Md5Hash(src + ":" + nonce.ToString()); return Util.Md5Hash(String.Format("{0}:{1}", src, nonce.ToString()));
} }
public LSL_String llSHA1String(string src) public LSL_String llSHA1String(string src)
@ -6729,12 +6743,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// try to let this work as in SL... // try to let this work as in SL...
if (part.ParentID == 0) if (part.ParentID == 0)
{ {
// special case: If we are root, rotate complete SOG to new rotation // special case: If we are root, rotate
// complete SOG to new rotation
SetRot(part, Rot2Quaternion(q)); SetRot(part, Rot2Quaternion(q));
} }
else else
{ {
// we are a child. The rotation values will be set to the one of root modified by rot, as in SL. Don't ask. // we are a child. The rotation values
// will be set to the one of root modified
// by rot, as in SL. Don't ask.
SceneObjectGroup group = part.ParentGroup; SceneObjectGroup group = part.ParentGroup;
if (group != null) // a bit paranoid, maybe if (group != null) // a bit paranoid, maybe
{ {
@ -6840,7 +6857,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 0); SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 0);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_TUBE: case (int)ScriptBaseClass.PRIM_TYPE_TUBE:
@ -6859,7 +6877,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 1); SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 1);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_RING: case (int)ScriptBaseClass.PRIM_TYPE_RING:
@ -6878,7 +6897,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
radiusoffset = (float)rules.GetLSLFloatItem(idx++); radiusoffset = (float)rules.GetLSLFloatItem(idx++);
skew = (float)rules.GetLSLFloatItem(idx++); skew = (float)rules.GetLSLFloatItem(idx++);
part.Shape.PathCurve = (byte)Extrusion.Curve1; part.Shape.PathCurve = (byte)Extrusion.Curve1;
SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b, revolutions, radiusoffset, skew, 3); SetPrimitiveShapeParams(part, face, v, hollow, twist, holesize, topshear, profilecut, taper_b,
revolutions, radiusoffset, skew, 3);
break; break;
case (int)ScriptBaseClass.PRIM_TYPE_SCULPT: case (int)ScriptBaseClass.PRIM_TYPE_SCULPT:
@ -7125,7 +7145,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetRootPosition() public LSL_Vector llGetRootPosition()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y, m_host.ParentGroup.AbsolutePosition.Z); return new LSL_Vector(m_host.ParentGroup.AbsolutePosition.X, m_host.ParentGroup.AbsolutePosition.Y,
m_host.ParentGroup.AbsolutePosition.Z);
} }
/// <summary> /// <summary>