From 79dc1a4f7d4196d14bd51cb0839b9dd8c644cab7 Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Mon, 13 Aug 2007 20:55:07 +0000 Subject: Common script for all objects (Default.lsl). ScriptEngine touch_start event now works, but llSay only outputs to server console. --- .../ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs | 2 +- .../DotNetEngine/Compiler/LSL/LSL2CSConverter.cs | 2 +- .../DotNetEngine/Compiler/LSL/LSL_BaseClass.cs | 15 ++++++++------- .../Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs | 4 ++-- OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs | 7 +++++-- OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs | 1 + OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 8 ++++---- 7 files changed, 22 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs index 2c514fc..6fe111f 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs @@ -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 diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs index 6b0afa9..5c5ac92 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL2CSConverter.cs @@ -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" + "" + "$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; diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs index 5c67ffe..5fa25fb 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/LSL_BaseClass.cs @@ -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; } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs index 296bfa0..8eefac8 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/Server_API/LSL_BuiltIn_Commands_Interface.cs @@ -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); diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index a69e27c..7ad00d1 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs @@ -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 }); } diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs index 8f90483..4a09cf3 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptEngine.cs @@ -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() { diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index c34889a..0c5bfc2 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -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 -- cgit v1.1