* Brand spankin' new scripting engine.

* Use "script load somefile.cs" for C# scripting. Will commit additional languages shortly. Scripts should implement the IScript interfaces to work correctly.
* Someone port this over to NameSpaceChanges (built in Sugilite since sugilite is working)
Sugilite
Adam Frisby 2007-06-28 08:09:05 +00:00
parent 223550b7e4
commit 0c1a6c85cc
17 changed files with 193 additions and 523 deletions

View File

@ -190,24 +190,13 @@
<Compile Include="Scenes\ScenePresence.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Scenes\scripting\IScriptContext.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Scenes\scripting\IScriptEntity.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Scenes\scripting\IScriptHandler.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Scenes\scripting\Script.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Scenes\scripting\ScriptFactory.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Scenes\scripting\Scripts\FollowRandomAvatar.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Scenes\scripting\CSharpScriptEngine.cs" />
<Compile Include="Scenes\scripting\Script.cs" />
<Compile Include="Scenes\scripting\ScriptInfo.cs" />
<Compile Include="Scenes\scripting\ScriptManager.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Scenes\scripting\CSharpScripts\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
<PropertyGroup>

View File

@ -31,11 +31,10 @@ using System.Text;
using Axiom.MathLib;
using OpenSim.Physics.Manager;
using libsecondlife;
using OpenSim.Region.Scripting;
namespace OpenSim.Region.Scenes
{
public abstract class Entity : IScriptReadonlyEntity
public abstract class Entity
{
public libsecondlife.LLUUID uuid;
public Quaternion rotation;

View File

@ -39,12 +39,12 @@ using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Inventory;
using OpenSim.Framework;
using OpenSim.Region.Scripting;
using OpenSim.Terrain;
using OpenGrid.Framework.Communications;
using OpenSim.Caches;
using OpenSim.Region;
using OpenSim.Servers;
using OpenSim.Scripting;
namespace OpenSim.Region.Scenes
{
@ -60,8 +60,6 @@ namespace OpenSim.Region.Scenes
private Random Rand = new Random();
private uint _primCount = 702000;
private int storageCount;
private Dictionary<LLUUID, ScriptHandler> m_scriptHandlers;
private Dictionary<string, ScriptFactory> m_scripts;
private Mutex updateLock;
protected AuthenticateSessionsBase authenticateHandler;
@ -74,6 +72,7 @@ namespace OpenSim.Region.Scenes
public ParcelManager parcelManager;
public EstateManager estateManager;
public EventManager eventManager;
public ScriptManager scriptManager;
#region Properties
/// <summary>
@ -117,12 +116,9 @@ namespace OpenSim.Region.Scenes
parcelManager = new ParcelManager(this, this.m_regInfo);
estateManager = new EstateManager(this, this.m_regInfo);
scriptManager = new ScriptManager(this);
eventManager = new EventManager();
m_scriptHandlers = new Dictionary<LLUUID, ScriptHandler>();
m_scripts = new Dictionary<string, ScriptFactory>();
OpenSim.Framework.Console.MainLog.Instance.Verbose( "World.cs - creating new entitities instance");
Entities = new Dictionary<libsecondlife.LLUUID, Entity>();
Avatars = new Dictionary<LLUUID, ScenePresence>();
@ -195,19 +191,9 @@ namespace OpenSim.Region.Scenes
Entities[UUID].update();
}
// New
// General purpose event manager
eventManager.TriggerOnFrame();
// TODO: Obsolete - Phase out
foreach (ScriptHandler scriptHandler in m_scriptHandlers.Values)
{
scriptHandler.OnFrame();
}
foreach (IScriptEngine scripteng in this.scriptEngines.Values)
{
scripteng.OnFrame();
}
//backup world data
this.storageCount++;
if (storageCount > 1200) //set to how often you want to backup

View File

@ -37,7 +37,6 @@ using OpenSim.Physics.Manager;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Framework.Inventory;
using OpenSim.Region.Scripting;
using OpenSim.Terrain;
using OpenSim.Caches;

View File

@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Text;
// Compilation stuff
using System.CodeDom;
using System.CodeDom.Compiler;
using Microsoft.CSharp;
namespace OpenSim.Scripting
{
public class CSharpScriptEngine : IScriptCompiler
{
public string fileExt()
{
return ".cs";
}
private Dictionary<string,IScript> LoadDotNetScript(ICodeCompiler compiler, string filename)
{
CompilerParameters compilerParams = new CompilerParameters();
CompilerResults compilerResults;
compilerParams.GenerateExecutable = false;
compilerParams.GenerateInMemory = true;
compilerParams.IncludeDebugInformation = false;
compilerParams.ReferencedAssemblies.Add("OpenSim.Region.dll");
compilerParams.ReferencedAssemblies.Add("OpenSim.Framework.dll");
compilerParams.ReferencedAssemblies.Add("libsecondlife.dll");
compilerParams.ReferencedAssemblies.Add("System.dll");
compilerResults = compiler.CompileAssemblyFromFile(compilerParams, filename);
if (compilerResults.Errors.Count > 0)
{
OpenSim.Framework.Console.MainLog.Instance.Error("Compile errors");
foreach (CompilerError error in compilerResults.Errors)
{
OpenSim.Framework.Console.MainLog.Instance.Error(error.Line.ToString() + ": " + error.ErrorText.ToString());
}
}
else
{
Dictionary<string,IScript> scripts = new Dictionary<string,IScript>();
foreach (Type pluginType in compilerResults.CompiledAssembly.GetExportedTypes())
{
Type testInterface = pluginType.GetInterface("IScript", true);
if (testInterface != null)
{
IScript script = (IScript)compilerResults.CompiledAssembly.CreateInstance(pluginType.ToString());
string scriptName = "C#/" + script.getName();
Console.WriteLine("Script: " + scriptName + " loaded.");
if (!scripts.ContainsKey(scriptName))
{
scripts.Add(scriptName, script);
}
else
{
scripts[scriptName] = script;
}
}
}
return scripts;
}
return null;
}
public Dictionary<string,IScript> compile(string filename)
{
CSharpCodeProvider csharpProvider = new CSharpCodeProvider();
return LoadDotNetScript(csharpProvider.CreateCompiler(), filename);
}
}
}

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
namespace OpenSim.Region.Scripting
{
public interface IScriptContext
{
IScriptEntity Entity { get; }
bool TryGetRandomAvatar(out IScriptReadonlyEntity avatar);
}
}

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
namespace OpenSim.Region.Scripting
{
public interface IScriptReadonlyEntity
{
LLVector3 Pos { get; }
string Name { get; }
}
public interface IScriptEntity
{
LLVector3 Pos { get; set; }
string Name { get; }
}
}

View File

@ -1,126 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
using OpenSim.Physics.Manager;
using OpenSim.Region;
using OpenSim.Region.Scenes;
using Avatar=OpenSim.Region.Scenes.ScenePresence;
using Primitive = OpenSim.Region.Scenes.Primitive;
namespace OpenSim.Region.Scripting
{
public delegate void ScriptEventHandler(IScriptContext context);
public class ScriptHandler : IScriptContext, IScriptEntity, IScriptReadonlyEntity
{
private Scene m_world;
private Script m_script;
private Entity m_entity;
public LLUUID ScriptId
{
get
{
return m_script.ScriptId;
}
}
public void OnFrame()
{
m_script.OnFrame(this);
}
public ScriptHandler(Script script, Entity entity, Scene world)
{
m_script = script;
m_entity = entity;
m_world = world;
}
#region IScriptContext Members
IScriptEntity IScriptContext.Entity
{
get
{
return this;
}
}
bool IScriptContext.TryGetRandomAvatar(out IScriptReadonlyEntity avatar)
{
foreach (Entity entity in m_world.Entities.Values )
{
if( entity is Avatar )
{
avatar = entity;
return true;
}
}
avatar = null;
return false;
}
#endregion
#region IScriptEntity and IScriptReadonlyEntity Members
public string Name
{
get
{
return m_entity.Name;
}
}
public LLVector3 Pos
{
get
{
return m_entity.Pos;
}
set
{
if (m_entity is Primitive)
{
Primitive prim = m_entity as Primitive;
// Of course, we really should have asked the physEngine if this is possible, and if not, returned false.
// prim.UpdatePosition( value );
}
}
}
#endregion
}
}

View File

@ -1,53 +1,44 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
namespace OpenSim.Region.Scripting
using OpenSim.Framework.Console;
using OpenSim.Framework;
using OpenSim.Region;
using OpenSim.Region.Scenes;
namespace OpenSim.Scripting
{
public class Script
public interface IScript
{
private LLUUID m_scriptId;
public virtual LLUUID ScriptId
void Initialise(ScriptInfo scriptInfo);
string getName();
}
public class TestScript : IScript
{
ScriptInfo script;
public string getName()
{
get
{
return m_scriptId;
}
return "TestScript 0.1";
}
public Script( LLUUID scriptId )
public void Initialise(ScriptInfo scriptInfo)
{
m_scriptId = scriptId;
script = scriptInfo;
script.events.OnFrame += new OpenSim.Region.Scenes.EventManager.OnFrameDelegate(events_OnFrame);
script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence);
}
void events_OnNewPresence(ScenePresence presence)
{
script.logger.Verbose("Hello " + presence.firstname.ToString() + "!");
}
void events_OnFrame()
{
//script.logger.Verbose("Hello World!");
}
public ScriptEventHandler OnFrame;
}
}

View File

@ -1,35 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Region.Scripting
{
public delegate Script ScriptFactory();
}

View File

@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OpenSim.Scripting
{
public class ScriptManager
{
List<IScript> scripts = new List<IScript>();
OpenSim.Region.Scenes.Scene scene;
Dictionary<string, IScriptCompiler> compilers = new Dictionary<string, IScriptCompiler>();
private void LoadFromCompiler(Dictionary<string, IScript> compiledscripts)
{
foreach (KeyValuePair<string, IScript> script in compiledscripts)
{
ScriptInfo scriptInfo = new ScriptInfo(scene); // Since each script could potentially corrupt their access with a stray assignment, making a new one for each script.
OpenSim.Framework.Console.MainLog.Instance.Verbose("Loading " + script.Key);
script.Value.Initialise(scriptInfo);
scripts.Add(script.Value);
}
OpenSim.Framework.Console.MainLog.Instance.Verbose("Finished loading " + compiledscripts.Count.ToString() + " script(s)");
}
public ScriptManager(OpenSim.Region.Scenes.Scene world)
{
scene = world;
// Defualt Engines
CSharpScriptEngine csharpCompiler = new CSharpScriptEngine();
compilers.Add(csharpCompiler.fileExt(),csharpCompiler);
}
public void Compile(string filename)
{
foreach (KeyValuePair<string, IScriptCompiler> compiler in compilers)
{
if (filename.EndsWith(compiler.Key))
{
LoadFromCompiler(compiler.Value.compile(filename));
break;
}
}
}
public void RunScriptCmd(string[] args)
{
switch (args[0])
{
case "load":
Compile(args[1]);
break;
default:
OpenSim.Framework.Console.MainLog.Instance.Error("Unknown script command");
break;
}
}
}
interface IScriptCompiler
{
Dictionary<string,IScript> compile(string filename);
string fileExt();
}
}

View File

@ -1,64 +0,0 @@
/*
* Copyright (c) Contributors, http://www.openmetaverse.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSim Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using libsecondlife;
namespace OpenSim.Region.Scripting
{
public class FollowRandomAvatar : Script
{
public FollowRandomAvatar()
: base(LLUUID.Random())
{
OnFrame += MyOnFrame;
}
private void MyOnFrame(IScriptContext context)
{
LLVector3 pos = context.Entity.Pos;
IScriptReadonlyEntity avatar;
if (context.TryGetRandomAvatar(out avatar))
{
LLVector3 avatarPos = avatar.Pos;
float x = pos.X + ((float)avatarPos.X.CompareTo(pos.X)) / 2;
float y = pos.Y + ((float)avatarPos.Y.CompareTo(pos.Y)) / 2;
LLVector3 newPos = new LLVector3(x, y, pos.Z);
context.Entity.Pos = newPos;
}
}
}
}

View File

@ -1,66 +0,0 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{3C3A8BD5-F53C-42D0-8ADE-E2492790788A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenSim.Scripting</RootNamespace>
<AssemblyName>OpenSim.Scripting</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="libsecondlife, Version=0.9.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\bin\libsecondlife.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Script.cs" />
<Compile Include="ScriptAccess.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.Framework.Console</Name>
</ProjectReference>
<ProjectReference Include="..\..\Common\OpenSim.Framework\OpenSim.Framework.csproj">
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\OpenSim.Region\OpenSim.Region.csproj">
<Project>{196916AF-0000-0000-0000-000000000000}</Project>
<Name>OpenSim.Region</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OpenSim.Scripting")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OpenSim.Scripting")]
[assembly: AssemblyCopyright("Copyright © 2007")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("61eae1ad-82aa-4c77-8bc5-b5a8c9522b18")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
using OpenSim.Framework.Console;
using OpenSim.Framework;
using OpenSim.Region;
using OpenSim.Region.Scenes;
namespace OpenSim.Scripting
{
public interface IScript
{
void Initialise(ScriptInfo scriptInfo);
}
public class TestScript : IScript
{
ScriptInfo script;
public void Initialise(ScriptInfo scriptInfo)
{
script = scriptInfo;
script.events.OnFrame += new OpenSim.Region.Scenes.EventManager.OnFrameDelegate(events_OnFrame);
}
void events_OnFrame()
{
script.logger.Verbose("Hello World!");
}
}
}

View File

@ -433,6 +433,13 @@ namespace OpenSim
}
break;
case "script":
for (int i = 0; i < m_localWorld.Count; i++)
{
((Scene)m_localWorld[i]).scriptManager.RunScriptCmd(cmdparams);
}
break;
case "shutdown":
Shutdown();
break;