diff options
author | Tedd Hansen | 2007-08-13 20:55:07 +0000 |
---|---|---|
committer | Tedd Hansen | 2007-08-13 20:55:07 +0000 |
commit | 79dc1a4f7d4196d14bd51cb0839b9dd8c644cab7 (patch) | |
tree | e07b695666f9fe6e90a674706ebdc9509dd33065 | |
parent | committed a test version of OpenSimAssetSet.xml in last commit, so fixing that. (diff) | |
download | opensim-SC_OLD-79dc1a4f7d4196d14bd51cb0839b9dd8c644cab7.zip opensim-SC_OLD-79dc1a4f7d4196d14bd51cb0839b9dd8c644cab7.tar.gz opensim-SC_OLD-79dc1a4f7d4196d14bd51cb0839b9dd8c644cab7.tar.bz2 opensim-SC_OLD-79dc1a4f7d4196d14bd51cb0839b9dd8c644cab7.tar.xz |
Common script for all objects (Default.lsl). ScriptEngine touch_start event now works, but llSay only outputs to server console.
Diffstat (limited to '')
11 files changed, 40 insertions, 20 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index 4dd5fe1..cb2671a 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -167,7 +167,11 @@ namespace OpenSim | |||
167 | Scene scene = SetupScene(regionInfo, out udpServer); | 167 | Scene scene = SetupScene(regionInfo, out udpServer); |
168 | 168 | ||
169 | 169 | ||
170 | scene.AddScriptEngine(ScriptEngineLoader.LoadScriptEngine("DotNetEngine")); | 170 | OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine = ScriptEngineLoader.LoadScriptEngine("DotNetEngine"); |
171 | scene.AddScriptEngine(ScriptEngine); | ||
172 | // TODO: TEMP load default script | ||
173 | ScriptEngine.StartScript(Path.Combine("ScriptEngines", "default.lsl"), "TEST"); | ||
174 | |||
171 | 175 | ||
172 | m_localScenes.Add(scene); | 176 | m_localScenes.Add(scene); |
173 | 177 | ||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 4aa3c49..b423e0a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1020,8 +1020,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1020 | public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine) | 1020 | public void AddScriptEngine(OpenSim.Region.Environment.Scenes.Scripting.ScriptEngineInterface ScriptEngine) |
1021 | { | 1021 | { |
1022 | ScriptEngines.Add(ScriptEngine); | 1022 | ScriptEngines.Add(ScriptEngine); |
1023 | ScriptEngine.InitializeEngine(this); | 1023 | ScriptEngine.InitializeEngine(this); } |
1024 | } | ||
1025 | #endregion | 1024 | #endregion |
1026 | 1025 | ||
1027 | public LLUUID ConvertLocalIDToFullID(uint localID) | 1026 | public LLUUID ConvertLocalIDToFullID(uint localID) |
diff --git a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs index 3c3b5a7..5f378a6 100644 --- a/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs +++ b/OpenSim/Region/Environment/Scenes/Scripting/ScriptEngineInterface.cs | |||
@@ -36,5 +36,6 @@ namespace OpenSim.Region.Environment.Scenes.Scripting | |||
36 | { | 36 | { |
37 | void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld); | 37 | void InitializeEngine(OpenSim.Region.Environment.Scenes.Scene Sceneworld); |
38 | void Shutdown(); | 38 | void Shutdown(); |
39 | void StartScript(string ScriptID, string ObjectID); | ||
39 | } | 40 | } |
40 | } | 41 | } |
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 | |||
18 | 18 | ||
19 | 19 | ||
20 | // Output assembly name | 20 | // Output assembly name |
21 | string OutFile = Path.GetFileNameWithoutExtension(LSOFileName) + ".dll"; | 21 | string OutFile = Path.Combine("ScriptEngines", Path.GetFileNameWithoutExtension(LSOFileName) + ".dll"); |
22 | 22 | ||
23 | Common.SendToDebug("Reading source code into memory"); | 23 | Common.SendToDebug("Reading source code into memory"); |
24 | // TODO: Add error handling | 24 | // 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 | |||
162 | // void dataserver(key query_id, string data) { | 162 | // void dataserver(key query_id, string data) { |
163 | //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); | 163 | //cache = Regex.Replace(cache, @"([^a-zA-Z_]\s*)((?!if|switch|for)[a-zA-Z_]+\s*\([^\)]*\)[^{]*{)", "$1" + "<STATE>" + "$2", RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline); |
164 | //Console.WriteLine("Replacing using statename: " + current_statename); | 164 | //Console.WriteLine("Replacing using statename: " + current_statename); |
165 | 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); | 165 | 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); |
166 | } | 166 | } |
167 | 167 | ||
168 | ret += cache; | 168 | 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 | |||
7 | { | 7 | { |
8 | public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface | 8 | public class LSL_BaseClass : LSL_BuiltIn_Commands_Interface |
9 | { | 9 | { |
10 | public UInt32 State = 0; | 10 | public string State = "default"; |
11 | internal OpenSim.Region.Environment.Scenes.Scene World; | 11 | internal OpenSim.Region.Environment.Scenes.Scene World; |
12 | 12 | ||
13 | public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID) | 13 | public void Start(OpenSim.Region.Environment.Scenes.Scene _World, string FullScriptID) |
@@ -46,17 +46,18 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL | |||
46 | public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } | 46 | public Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } |
47 | public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } | 47 | public Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r) { return new Axiom.Math.Vector3(); } |
48 | public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); } | 48 | public Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end) { return new Axiom.Math.Quaternion(); } |
49 | public void llWhisper(UInt16 channelID, string text) | 49 | public void llWhisper(int channelID, string text) |
50 | { | 50 | { |
51 | Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");"); | 51 | //Common.SendToDebug("INTERNAL FUNCTION llWhisper(" + channelID + ", \"" + text + "\");"); |
52 | Common.SendToLog("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); | 52 | Console.WriteLine("llWhisper Channel " + channelID + ", Text: \"" + text + "\""); |
53 | } | 53 | } |
54 | //public void llSay(UInt32 channelID, string text) | 54 | //public void llSay(UInt32 channelID, string text) |
55 | public void llSay(object channelID, object text) | 55 | public void llSay(int channelID, string text) |
56 | { | 56 | { |
57 | //TODO: DO SOMETHING USEFUL HERE | 57 | //TODO: DO SOMETHING USEFUL HERE |
58 | Common.SendToDebug("INTERNAL FUNCTION llSay(" + (UInt32)channelID + ", \"" + (string)text + "\");"); | 58 | //Common.SendToDebug("INTERNAL FUNCTION llSay(" + (UInt32)channelID + ", \"" + (string)text + "\");"); |
59 | Common.SendToLog("llSay Channel " + (UInt32)channelID + ", Text: \"" + (string)text + "\""); | 59 | Console.WriteLine("llSay Channel " + channelID + ", Text: \"" + text + "\""); |
60 | //World.SimChat( | ||
60 | } | 61 | } |
61 | public void llShout(UInt16 channelID, string text) { return; } | 62 | public void llShout(UInt16 channelID, string text) { return; } |
62 | public UInt32 llListen(UInt16 channelID, string name, string ID, string msg) { return 0; } | 63 | 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 | |||
56 | Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r); | 56 | Axiom.Math.Vector3 llRot2Left(Axiom.Math.Quaternion r); |
57 | Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r); | 57 | Axiom.Math.Vector3 llRot2Up(Axiom.Math.Quaternion r); |
58 | Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end); | 58 | Axiom.Math.Quaternion llRotBetween(Axiom.Math.Vector3 start, Axiom.Math.Vector3 end); |
59 | void llWhisper(UInt16 channelID, string text); | 59 | void llWhisper(int channelID, string text); |
60 | //void llSay(UInt32 channelID, string text); | 60 | //void llSay(UInt32 channelID, string text); |
61 | void llSay(object channelID, object text); | 61 | void llSay(int channelID, string text); |
62 | void llShout(UInt16 channelID, string text); | 62 | void llShout(UInt16 channelID, string text); |
63 | UInt32 llListen(UInt16 channelID, string name, string ID, string msg); | 63 | UInt32 llListen(UInt16 channelID, string name, string ID, string msg); |
64 | void llListenControl(UInt32 number, UInt32 active); | 64 | 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 @@ | |||
29 | using System; | 29 | using System; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Text; | 31 | using System.Text; |
32 | using libsecondlife; | ||
33 | using OpenSim.Framework.Interfaces; | ||
32 | 34 | ||
33 | namespace OpenSim.Region.ScriptEngine.DotNetEngine | 35 | namespace OpenSim.Region.ScriptEngine.DotNetEngine |
34 | { | 36 | { |
@@ -49,14 +51,15 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine | |||
49 | // Hook up a test event to our test form | 51 | // Hook up a test event to our test form |
50 | Common.SendToDebug("EventManager Hooking up dummy-event: touch_start"); | 52 | Common.SendToDebug("EventManager Hooking up dummy-event: touch_start"); |
51 | // TODO: REPLACE THIS WITH A REAL TOUCH_START EVENT IN SERVER | 53 | // TODO: REPLACE THIS WITH A REAL TOUCH_START EVENT IN SERVER |
54 | myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start); | ||
52 | //myScriptEngine.World.touch_start += new TempWorldInterfaceEventDelegates.touch_start(touch_start); | 55 | //myScriptEngine.World.touch_start += new TempWorldInterfaceEventDelegates.touch_start(touch_start); |
53 | } | 56 | } |
54 | 57 | ||
55 | public void touch_start(string ObjectID) | 58 | public void touch_start(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
56 | { | 59 | { |
57 | // Add to queue for all scripts in ObjectID object | 60 | // Add to queue for all scripts in ObjectID object |
58 | Common.SendToDebug("EventManager Event: touch_start"); | 61 | Common.SendToDebug("EventManager Event: touch_start"); |
59 | myScriptEngine.myEventQueueManager.AddToObjectQueue(ObjectID, "touch_start", new object[] { (UInt32)0 }); | 62 | myScriptEngine.myEventQueueManager.AddToObjectQueue("TEST", "touch_start", new object[] { (int)0 }); |
60 | } | 63 | } |
61 | 64 | ||
62 | 65 | ||
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 | |||
60 | 60 | ||
61 | // Should we iterate the region for scripts that needs starting? | 61 | // Should we iterate the region for scripts that needs starting? |
62 | // Or can we assume we are loaded before anything else so we can use proper events? | 62 | // Or can we assume we are loaded before anything else so we can use proper events? |
63 | |||
63 | } | 64 | } |
64 | public void Shutdown() | 65 | public void Shutdown() |
65 | { | 66 | { |
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 | |||
197 | //} | 197 | //} |
198 | 198 | ||
199 | 199 | ||
200 | foreach (Type _t in a.GetTypes()) | 200 | //foreach (Type _t in a.GetTypes()) |
201 | { | 201 | //{ |
202 | Console.WriteLine("Type: " + _t.ToString()); | 202 | // Console.WriteLine("Type: " + _t.ToString()); |
203 | } | 203 | //} |
204 | 204 | ||
205 | Type t; | 205 | Type t; |
206 | //try | 206 | //try |
diff --git a/bin/ScriptEngines/Default.lsl b/bin/ScriptEngines/Default.lsl new file mode 100644 index 0000000..13c6803 --- /dev/null +++ b/bin/ScriptEngines/Default.lsl | |||
@@ -0,0 +1,11 @@ | |||
1 | default { | ||
2 | state_entry() | ||
3 | { | ||
4 | llSay(0, "Hello, Avatar!"); | ||
5 | } | ||
6 | |||
7 | touch_start(integer total_number) | ||
8 | { | ||
9 | llSay(0, "Object was touched."); | ||
10 | } | ||
11 | } | ||