diff options
author | Adam Frisby | 2007-06-28 08:09:05 +0000 |
---|---|---|
committer | Adam Frisby | 2007-06-28 08:09:05 +0000 |
commit | 0c1a6c85cc678effc882dd5897d3357416807ba9 (patch) | |
tree | 6149f74c6a5a4d75bbeea3711a687dc6dcc66a6f /OpenSim/OpenSim.Region/Scenes/scripting/Script.cs | |
parent | Some very Preliminary work on .net remoting for interregion comms. (diff) | |
download | opensim-SC-0c1a6c85cc678effc882dd5897d3357416807ba9.zip opensim-SC-0c1a6c85cc678effc882dd5897d3357416807ba9.tar.gz opensim-SC-0c1a6c85cc678effc882dd5897d3357416807ba9.tar.bz2 opensim-SC-0c1a6c85cc678effc882dd5897d3357416807ba9.tar.xz |
* 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)
Diffstat (limited to 'OpenSim/OpenSim.Region/Scenes/scripting/Script.cs')
-rw-r--r-- | OpenSim/OpenSim.Region/Scenes/scripting/Script.cs | 71 |
1 files changed, 31 insertions, 40 deletions
diff --git a/OpenSim/OpenSim.Region/Scenes/scripting/Script.cs b/OpenSim/OpenSim.Region/Scenes/scripting/Script.cs index 1d01f3c..57390bc 100644 --- a/OpenSim/OpenSim.Region/Scenes/scripting/Script.cs +++ b/OpenSim/OpenSim.Region/Scenes/scripting/Script.cs | |||
@@ -1,53 +1,44 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://www.openmetaverse.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | using System; | 1 | using System; |
29 | using System.Collections.Generic; | 2 | using System.Collections.Generic; |
30 | using System.Text; | 3 | using System.Text; |
31 | using libsecondlife; | ||
32 | 4 | ||
33 | namespace OpenSim.Region.Scripting | 5 | using OpenSim.Framework.Console; |
6 | using OpenSim.Framework; | ||
7 | using OpenSim.Region; | ||
8 | using OpenSim.Region.Scenes; | ||
9 | |||
10 | namespace OpenSim.Scripting | ||
34 | { | 11 | { |
35 | public class Script | 12 | public interface IScript |
13 | { | ||
14 | void Initialise(ScriptInfo scriptInfo); | ||
15 | string getName(); | ||
16 | } | ||
17 | |||
18 | public class TestScript : IScript | ||
36 | { | 19 | { |
37 | private LLUUID m_scriptId; | 20 | ScriptInfo script; |
38 | public virtual LLUUID ScriptId | 21 | |
22 | public string getName() | ||
23 | { | ||
24 | return "TestScript 0.1"; | ||
25 | } | ||
26 | |||
27 | public void Initialise(ScriptInfo scriptInfo) | ||
28 | { | ||
29 | script = scriptInfo; | ||
30 | script.events.OnFrame += new OpenSim.Region.Scenes.EventManager.OnFrameDelegate(events_OnFrame); | ||
31 | script.events.OnNewPresence += new EventManager.OnNewPresenceDelegate(events_OnNewPresence); | ||
32 | } | ||
33 | |||
34 | void events_OnNewPresence(ScenePresence presence) | ||
39 | { | 35 | { |
40 | get | 36 | script.logger.Verbose("Hello " + presence.firstname.ToString() + "!"); |
41 | { | ||
42 | return m_scriptId; | ||
43 | } | ||
44 | } | 37 | } |
45 | 38 | ||
46 | public Script( LLUUID scriptId ) | 39 | void events_OnFrame() |
47 | { | 40 | { |
48 | m_scriptId = scriptId; | 41 | //script.logger.Verbose("Hello World!"); |
49 | } | 42 | } |
50 | |||
51 | public ScriptEventHandler OnFrame; | ||
52 | } | 43 | } |
53 | } | 44 | } |