Common script for all objects (Default.lsl). ScriptEngine touch_start event now works, but llSay only outputs to server console.
parent
a63fb0147b
commit
79dc1a4f7d
|
@ -167,7 +167,11 @@ namespace OpenSim
|
|||
Scene scene = SetupScene(regionInfo, out udpServer);
|
||||
|
||||
|
||||
scene.AddScriptEngine(ScriptEngineLoader.LoadScriptEngine("DotNetEngine"));
|
||||
OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine("DotNetEngine");
|
||||
scene.AddScriptEngine(ScriptEngine);
|
||||
// TODO: TEMP load default script
|
||||
ScriptEngine.StartScript(Path.Combine("ScriptEngines", "default.lsl"), "TEST");
|
||||
|
||||
|
||||
m_localScenes.Add(scene);
|
||||
|
||||
|
|
|
@ -1020,8 +1020,7 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine)
|
||||
{
|
||||
ScriptEngines.Add(ScriptEngine);
|
||||
ScriptEngine.InitializeEngine(this);
|
||||
}
|
||||
ScriptEngine.InitializeEngine(this); }
|
||||
#endregion
|
||||
|
||||
public LLUUID ConvertLocalIDToFullID(uint localID)
|
||||
|
|
|
@ -36,5 +36,6 @@ namespace OpenSim.Region.Environment.Scenes.Scripting
|
|||
{
|
||||
void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld);
|
||||
void Shutdown();
|
||||
void StartScript(string ScriptID, string ObjectID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
|
||||
|
||||
// Output assembly name
|
||||
string OutFile = Path.GetFileNameWithoutExtension(LSOFileName) + ".dll";
|
||||
string OutFile = Path.Combine("ScriptEngines", Path.GetFileNameWithoutExtension(LSOFileName) + ".dll");
|
||||
|
||||
Common.SendToDebug("Reading source code into memory");
|
||||
// TODO: Add error handling
|
||||
|
|
|
@ -162,7 +162,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
// void dataserver(key query_id, string data) {
|
||||
//cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
|
||||
//Console.WriteLine("Replacing using statename: " + current_statename);
|
||||
cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"$1" + current_statename + "_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
|
||||
cache = Regex.Replace(cache, @"^(\s*)((?!(if|switch|for)[^a-zA-Z0-9_])[a-zA-Z0-9_]*\s*\([^\)]*\)[^;]*\{)", @"public $1" + current_statename + "_event_$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);
|
||||
}
|
||||
|
||||
ret += cache;
|
||||
|
|
|
@ -7,7 +7,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
{
|
||||
public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface
|
||||
{
|
||||
public UInt32 State = 0;
|
||||
public string State = "default";
|
||||
internal OpenSim.Region.Environment.Scenes.Scene World;
|
||||
|
||||
public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID)
|
||||
|
@ -46,17 +46,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
|
|||
public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); }
|
||||
public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); }
|
||||
public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); }
|
||||
public void llWhisper(UInt16 channelID, string text)
|
||||
public void llWhisper(int channelID, string text)
|
||||
{
|
||||
Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");");
|
||||
Common.SendToLog("llWhisper Channel " + channelID + ", Text: \"" + text + "\"");
|
||||
//Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");");
|
||||
Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\"");
|
||||
}
|
||||
//public void llSay(UInt32 channelID, string text)
|
||||
public void llSay(object channelID, object text)
|
||||
public void llSay(int channelID, string text)
|
||||
{
|
||||
//TODO: DO SOMETHING USEFUL HERE
|
||||
Common.SendToDebug("INTERNAL FUNCTION llSay(" + (UInt32)channelID + ", \"" + (string)text + "\");");
|
||||
Common.SendToLog("llSay Channel " + (UInt32)channelID + ", Text: \"" + (string)text + "\"");
|
||||
//Common.SendToDebug("INTERNAL FUNCTION llSay(" + (UInt32)channelID + ", \"" + (string)text + "\");");
|
||||
Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\"");
|
||||
//World.SimChat(
|
||||
}
|
||||
public void llShout(UInt16 channelID, string text) { return; }
|
||||
public UInt32 llListen(UInt16 channelID, string name, string ID, string msg) { return 0; }
|
||||
|
|
|
@ -56,9 +56,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
|
|||
Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r);
|
||||
Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r);
|
||||
Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end);
|
||||
void llWhisper(UInt16 channelID, string text);
|
||||
void llWhisper(int channelID, string text);
|
||||
//void llSay(UInt32 channelID, string text);
|
||||
void llSay(object channelID, object text);
|
||||
void llSay(int channelID, string text);
|
||||
void llShout(UInt16 channelID, string text);
|
||||
UInt32 llListen(UInt16 channelID, string name, string ID, string msg);
|
||||
void llListenControl(UInt32 number, UInt32 active);
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using libsecondlife;
|
||||
using OpenSim.Framework.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
||||
{
|
||||
|
@ -49,14 +51,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
// Hook up a test event to our test form
|
||||
Common.SendToDebug("EventManager Hooking up dummy-event: touch_start");
|
||||
// TODO: REPLACE THIS WITH A REAL TOUCH_START EVENT IN SERVER
|
||||
myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start);
|
||||
//myScriptEngine.World.touch_start += new TempWorldInterfaceEventDelegates.touch_start(touch_start);
|
||||
}
|
||||
|
||||
public void touch_start(string ObjectID)
|
||||
public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)
|
||||
{
|
||||
// Add to queue for all scripts in ObjectID object
|
||||
Common.SendToDebug("EventManager Event: touch_start");
|
||||
myScriptEngine.myEventQueueManager.AddToObjectQueue(ObjectID, "touch_start", new object[] { (UInt32)0 });
|
||||
myScriptEngine.myEventQueueManager.AddToObjectQueue("TEST", "touch_start", new object[] { (int)0 });
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
|
||||
// Should we iterate the region for scripts that needs starting?
|
||||
// Or can we assume we are loaded before anything else so we can use proper events?
|
||||
|
||||
}
|
||||
public void Shutdown()
|
||||
{
|
||||
|
|
|
@ -197,10 +197,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
|
|||
//}
|
||||
|
||||
|
||||
foreach (Type _t in a.GetTypes())
|
||||
{
|
||||
Console.WriteLine("Type: " + _t.ToString());
|
||||
}
|
||||
//foreach (Type _t in a.GetTypes())
|
||||
//{
|
||||
// Console.WriteLine("Type: " + _t.ToString());
|
||||
//}
|
||||
|
||||
Type t;
|
||||
//try
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
default {
|
||||
state_entry()
|
||||
{
|
||||
llSay(0, "Hello, Avatar!");
|
||||
}
|
||||
|
||||
touch_start(integer total_number)
|
||||
{
|
||||
llSay(0, "Object was touched.");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue