aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs89
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs2
3 files changed, 86 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
index b7b040d..7b9b496 100644
--- a/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
+++ b/OpenSim/Region/ScriptEngine/Common/BuiltIn_Commands_BaseClass.cs
@@ -1595,7 +1595,7 @@ namespace OpenSim.Region.ScriptEngine.Common
1595 return m_LSL_Functions.llGetNumberOfPrims(); 1595 return m_LSL_Functions.llGetNumberOfPrims();
1596 } 1596 }
1597 1597
1598 public string llGetNumberOfNotecardLines(string name) 1598 public int llGetNumberOfNotecardLines(string name)
1599 { 1599 {
1600 return m_LSL_Functions.llGetNumberOfNotecardLines(name); 1600 return m_LSL_Functions.llGetNumberOfNotecardLines(name);
1601 } 1601 }
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index e91e73c..4e25ff8 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -3821,8 +3821,75 @@ namespace OpenSim.Region.ScriptEngine.Common
3821 public string llGetNotecardLine(string name, int line) 3821 public string llGetNotecardLine(string name, int line)
3822 { 3822 {
3823 m_host.AddScriptLPS(1); 3823 m_host.AddScriptLPS(1);
3824 NotImplemented("llGetNotecardLine"); 3824
3825 return String.Empty; 3825 // TODO: this script function should actually return
3826 // the requested notecard line via the dataserver event
3827 // once it is implemented - krtaylor
3828
3829 String[] notecardLines = GetNotecardLines(name);
3830 if (!String.IsNullOrEmpty(notecardLines[0]))
3831 {
3832 return notecardLines[line];
3833 }
3834 else
3835 {
3836 return String.Empty;
3837 }
3838 }
3839
3840 private String[] GetNotecardLines(string name)
3841 {
3842 bool found = false;
3843 int notecardIndex = 0;
3844 String[] notecardLines = { "0" };
3845 notecardLines[0] = String.Empty;
3846
3847 foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
3848 {
3849 if ((inv.Value.Name == name) && (inv.Value.InvType == (int)InventoryType.Notecard))
3850 {
3851 // OK, it has the right name and it is a notecard
3852 // so get the asset that contains the notecard raw data
3853 // and convert it into a string
3854 AssetBase notecardAsset = World.AssetCache.GetAsset(inv.Value.AssetID, false);
3855 String dataString = System.Text.Encoding.ASCII.GetString(notecardAsset.Data);
3856
3857 if (!String.IsNullOrEmpty(dataString))
3858 {
3859 // good, we have the notecard data as a string
3860 // now parse the text lines using the Linden Text delimiters
3861 notecardIndex = dataString.IndexOf("}\n");
3862 if (notecardIndex > 0)
3863 {
3864 notecardIndex = notecardIndex + 2; //get past delimiter
3865 notecardIndex = dataString.IndexOf("\n", notecardIndex);
3866 if (notecardIndex > 0)
3867 {
3868 // Finally got to the first line of the notecard
3869 // now find the end of the notecard text delimited by }<LF>
3870 // parse the lines, delimited by <LF>
3871 char[] delimChar = { '\n' };
3872 int notecardEof = dataString.IndexOf("}\n", notecardIndex);
3873 if (notecardEof > 0)
3874 {
3875 int notecardLength = notecardEof - notecardIndex - 1;
3876 notecardIndex = dataString.IndexOf("\n", notecardIndex);
3877 notecardIndex++; // get past delimiter
3878
3879 // create new string to parse that only consists of the actual lines in the asset
3880 Char[] notecardCharArray = dataString.ToCharArray(notecardIndex, notecardLength);
3881 String notecardString = new String(notecardCharArray);
3882
3883 // split the lines of the notecard into separate strings
3884 notecardLines = notecardString.Split(delimChar);
3885 return notecardLines;
3886 }
3887 }
3888 }
3889 }
3890 }
3891 }
3892 return notecardLines;
3826 } 3893 }
3827 3894
3828 public LSL_Types.Vector3 llGetAgentSize(string id) 3895 public LSL_Types.Vector3 llGetAgentSize(string id)
@@ -4769,11 +4836,23 @@ namespace OpenSim.Region.ScriptEngine.Common
4769 return m_host.ParentGroup.PrimCount; 4836 return m_host.ParentGroup.PrimCount;
4770 } 4837 }
4771 4838
4772 public string llGetNumberOfNotecardLines(string name) 4839 public int llGetNumberOfNotecardLines(string name)
4773 { 4840 {
4774 m_host.AddScriptLPS(1); 4841 m_host.AddScriptLPS(1);
4775 NotImplemented("llGetNumberOfNotecardLines"); 4842
4776 return String.Empty; 4843 // TODO: this script function should actually return
4844 // the number of lines via the dataserver event
4845 // once it is implemented - krtaylor
4846
4847 String[] notecardLines = GetNotecardLines(name);
4848 if (!String.IsNullOrEmpty(notecardLines[0]))
4849 {
4850 return notecardLines.Length;
4851 }
4852 else
4853 {
4854 return 0;
4855 }
4777 } 4856 }
4778 4857
4779 public LSL_Types.list llGetBoundingBox(string obj) 4858 public LSL_Types.list llGetBoundingBox(string obj)
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands_Interface.cs
index d824f0c..dae7fa0 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
540 //wiki: integer llGetNumberOfPrims() 540 //wiki: integer llGetNumberOfPrims()
541 LSL_Types.LSLInteger llGetNumberOfPrims(); 541 LSL_Types.LSLInteger llGetNumberOfPrims();
542 //wiki: key llGetNumberOfNotecardLines(string name) 542 //wiki: key llGetNumberOfNotecardLines(string name)
543 string llGetNumberOfNotecardLines(string name); 543 int llGetNumberOfNotecardLines(string name);
544 //wiki: list llGetBoundingBox(key object) 544 //wiki: list llGetBoundingBox(key object)
545 LSL_Types.list llGetBoundingBox(string obj); 545 LSL_Types.list llGetBoundingBox(string obj);
546 //wiki: vector llGetGeometricCenter() 546 //wiki: vector llGetGeometricCenter()