OpenSimでは、スクリプトをC#で書くことができます。
最初の行に "//C#" と書くと、以降はC#によるスクリプトであると解釈さます。
C#スクリプトの基本書式:
<STATE>_event_<EVENTNAME>
※なお、作られたスクリプトはデバッグ用に "bin\ScriptEngine\" に出力されます。うまくいかないときは、ここに主る力された結果を見てみるとよいかもしれません。
サンプルスクリプト:
//C#
namespace SecondLife
{
public class Script :
OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass
{
public Script() { }
// Your script goes here!
int touch_count = 0;
int tick_count = 0;
int objnum = 1;
public void default_event_state_entry()
{
llSay(0, "Hello, Avatar! Starting timer...");
llSetTimerEvent(10);
}
public void default_event_touch_start(int total_number)
{
touch_count++;
llSay(0, "Object was touched. Touch count: " + touch_count);
}
public void default_event_timer()
{
tick_count++;
llSay(0, "Timer count: " + tick_count);
}
}
}