* 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.NETafrisby
parent
173c5ee79e
commit
f2c449f10e
|
@ -422,7 +422,7 @@ namespace OpenSim
|
||||||
{
|
{
|
||||||
case "help":
|
case "help":
|
||||||
m_log.Error("show users - show info about connected users");
|
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;
|
break;
|
||||||
|
|
||||||
case "show":
|
case "show":
|
||||||
|
@ -442,6 +442,12 @@ namespace OpenSim
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "script":
|
||||||
|
for (int i = 0; i < m_localWorld.Count; i++)
|
||||||
|
{
|
||||||
|
((Scene)m_localWorld[i]).SendCommandToScripts(cmdparams);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case "quit":
|
case "quit":
|
||||||
case "shutdown":
|
case "shutdown":
|
||||||
|
|
|
@ -164,6 +164,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Script Handling Methods
|
||||||
|
|
||||||
|
public void SendCommandToScripts(string[] args)
|
||||||
|
{
|
||||||
|
m_eventManager.TriggerOnScriptConsole(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -25,6 +25,15 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
public delegate void OnParcelPrimCountAddDelegate(SceneObject obj);
|
public delegate void OnParcelPrimCountAddDelegate(SceneObject obj);
|
||||||
public event OnParcelPrimCountAddDelegate OnParcelPrimCountAdd;
|
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()
|
public void TriggerOnFrame()
|
||||||
{
|
{
|
||||||
if (OnFrame != null)
|
if (OnFrame != null)
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace OpenSim.Region.Scripting
|
||||||
compilerParams.GenerateInMemory = true;
|
compilerParams.GenerateInMemory = true;
|
||||||
compilerParams.IncludeDebugInformation = false;
|
compilerParams.IncludeDebugInformation = false;
|
||||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
|
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("OpenSim.Framework.dll");
|
||||||
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
|
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
|
||||||
compilerParams.ReferencedAssemblies.Add("System.dll");
|
compilerParams.ReferencedAssemblies.Add("System.dll");
|
||||||
|
|
|
@ -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")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -48,7 +48,7 @@ namespace OpenSim.Region.Scripting
|
||||||
compilerParams.GenerateInMemory = true;
|
compilerParams.GenerateInMemory = true;
|
||||||
compilerParams.IncludeDebugInformation = false;
|
compilerParams.IncludeDebugInformation = false;
|
||||||
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
|
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("OpenSim.Framework.dll");
|
||||||
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
|
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
|
||||||
compilerParams.ReferencedAssemblies.Add("System.dll");
|
compilerParams.ReferencedAssemblies.Add("System.dll");
|
||||||
|
|
Loading…
Reference in New Issue