* Added new scripting related events, in particular a new event which is triggered by console commands so that the script can subscribe to console messages and operate when they occur.

* Added new example script (work in progress)
* Fixed typo in Scripting engines for C# and JScript.NET
afrisby
Adam Frisby 2007-07-15 22:04:56 +00:00
parent 173c5ee79e
commit f2c449f10e
6 changed files with 59 additions and 3 deletions

View File

@ -422,7 +422,7 @@ namespace OpenSim
{
case "help":
m_log.Error("show users - show info about connected users");
m_log.Error("shutdown - disconnect all clients and shutdown");
m_log.Error("quit - disconnect all clients and shutdown");
break;
case "show":
@ -442,6 +442,12 @@ namespace OpenSim
}
}
break;
case "script":
for (int i = 0; i < m_localWorld.Count; i++)
{
((Scene)m_localWorld[i]).SendCommandToScripts(cmdparams);
}
break;
case "quit":
case "shutdown":

View File

@ -164,6 +164,15 @@ namespace OpenSim.Region.Environment.Scenes
}
#endregion
#region Script Handling Methods
public void SendCommandToScripts(string[] args)
{
m_eventManager.TriggerOnScriptConsole(args);
}
#endregion
/// <summary>
///
/// </summary>

View File

@ -25,6 +25,15 @@ namespace OpenSim.Region.Environment.Scenes
public delegate void OnParcelPrimCountAddDelegate(SceneObject obj);
public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
public delegate void OnScriptConsoleDelegate(string[] args);
public event OnScriptConsoleDelegate OnScriptConsole;
public void TriggerOnScriptConsole(string[] args)
{
if (OnScriptConsole != null)
OnScriptConsole(args);
}
public void TriggerOnFrame()
{
if (OnFrame != null)

View File

@ -48,7 +48,7 @@ namespace OpenSim.Region.Scripting
compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Enviroment.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
compilerParams.ReferencedAssemblies.Add("System.dll");

View File

@ -0,0 +1,32 @@
using OpenSim.Framework.Console;
using OpenSim.Framework;
using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Scenes;
namespace OpenSim.Region.Scripting.Examples
{
public class LSLExportScript : IScript
{
ScriptInfo script;
public string getName()
{
return "LSL Export Script 0.1";
}
public void Initialise(ScriptInfo scriptInfo)
{
script = scriptInfo;
script.events.OnScriptConsole += new EventManager.OnScriptConsoleDelegate(events_OnScriptConsole);
}
void events_OnScriptConsole(string[] args)
{
if (args[0].ToLower() == "lslexport")
{
}
}
}
}

View File

@ -48,7 +48,7 @@ namespace OpenSim.Region.Scripting
compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Enviroment.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.Environment.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
compilerParams.ReferencedAssemblies.Add("System.dll");