mirror of
https://github.com/opensim/opensim.git
synced 2026-07-18 21:55:37 +08:00
* 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)
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
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!");
|
|
}
|
|
}
|
|
}
|