From 48978ba3e015e5ac8f3b7e2700926220f5648f93 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 18 Sep 2008 18:58:39 +0000 Subject: [PATCH] * Apply http://opensimulator.org/mantis/view.php?id=2212 * Update llGetNumberOfNotecardLines() and llGetNotecardLine() to use dataserver on dotnetengine * Thanks M.Igarashi --- .../Common/BuiltIn_Commands_BaseClass.cs | 2 +- .../Common/LSL_BuiltIn_Commands.cs | 35 +++++++++++-------- .../Common/LSL_BuiltIn_Commands_Interface.cs | 2 +- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs index 08693b3710..825ecf2df7 100644 --- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs @@ -1601,7 +1601,7 @@ namespace OpenSim.Region.ScriptEngine.Common return m_LSL_Functions.llGetNumberOfPrims(); } - public int llGetNumberOfNotecardLines(string name) + public string llGetNumberOfNotecardLines(string name) { return m_LSL_Functions.llGetNumberOfNotecardLines(name); } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index a9ecd701ec..2eb50ef5f4 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -8210,22 +8210,26 @@ namespace OpenSim.Region.ScriptEngine.Common { throw new Exception("LSL Runtime Error: " + msg); } - public int llGetNumberOfNotecardLines(string name) + + public string llGetNumberOfNotecardLines(string name) { m_host.AddScriptLPS(1); - // TODO: this script function should actually return - // the number of lines via the dataserver event - // once it is implemented - krtaylor - String[] notecardLines = GetNotecardLines(name); if (!String.IsNullOrEmpty(notecardLines[0])) { - return notecardLines.Length; + UUID rq = UUID.Random(); + + UUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.m_Dataserver.RegisterRequest( + m_localID, m_itemID, rq.ToString()); + + m_ScriptEngine.m_ASYNCLSLCommandManager. + m_Dataserver.DataserverReply(rq.ToString(), notecardLines.Length.ToString()); + return tid.ToString(); } else { - return 0; + return UUID.Zero.ToString(); } // ScriptSleep(100); } @@ -8234,24 +8238,27 @@ namespace OpenSim.Region.ScriptEngine.Common { m_host.AddScriptLPS(1); - // TODO: this script function should actually return - // the requested notecard line via the dataserver event - // once it is implemented - krtaylor - String[] notecardLines = GetNotecardLines(name); - line--; // array starts at 0 + // line index starts at zero if ((!String.IsNullOrEmpty(notecardLines[0])) && (line >= 0) && (line < notecardLines.Length)) { // ScriptSleep(100); - return notecardLines[line]; + UUID rq = UUID.Random(); + + UUID tid = m_ScriptEngine.m_ASYNCLSLCommandManager.m_Dataserver.RegisterRequest( + m_localID, m_itemID, rq.ToString()); + + m_ScriptEngine.m_ASYNCLSLCommandManager. + m_Dataserver.DataserverReply(rq.ToString(), notecardLines[line]); + return tid.ToString(); } else { // ScriptSleep(100); - return String.Empty; + return UUID.Zero.ToString(); } } diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs index 9e3742cedb..d4cf3f5254 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs @@ -540,7 +540,7 @@ namespace OpenSim.Region.ScriptEngine.Common //wiki: integer llGetNumberOfPrims() LSL_Types.LSLInteger llGetNumberOfPrims(); //wiki: key llGetNumberOfNotecardLines(string name) - int llGetNumberOfNotecardLines(string name); + string llGetNumberOfNotecardLines(string name); //wiki: list llGetBoundingBox(key object) LSL_Types.list llGetBoundingBox(string obj); //wiki: vector llGetGeometricCenter()