aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/OpenSim.Region/Scenes/scripting/Script.cs
blob: 57390bc7b4b7ee37c060012f920e5d63b157c350 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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);
        string getName();
    }

    public class TestScript : IScript
    {
        ScriptInfo script;

        public string getName()
        {
            return "TestScript 0.1";
        }

        public void Initialise(ScriptInfo scriptInfo)
        {
            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!");
        }
    }
}