Many Thanks to Alondria for adding:

The list type and a bunch of support functions to LSL  
Added/ReImplmented: llGetListLength(), llList2Integer(), osList2Double() (note rename), 
    llList2Float(), llList2String(), llList2Key(), llList2Vector(), llList2Rot(), 
    llList2List(), llDeleteSubList(), llGetListEntryType(), llList2CSV(), llCSV2List(), 
    llListInsertList(), llDumpList2String(), 
Borked Still: llListSort(), llListRandomize(), llList2ListStrided(), llListFindList(),
Changed: llHTTPRequest() (Made wrapper of LSL_Types.list->List<string>)
afrisby
Charles Krinke 2007-12-18 02:41:34 +00:00
parent badcbd4bea
commit 6f389ba4cf
5 changed files with 466 additions and 246 deletions

View File

@ -345,41 +345,41 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki: vector llGetCenterOfMass()
LSL_Types.Vector3 llGetCenterOfMass();
//wiki: list llListSort(list src, integer stride, integer ascending)
List<string> llListSort(List<string> src, int stride, int ascending);
LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending);
//integer llGetListLength(list src)
int llGetListLength(List<string> src);
int llGetListLength(LSL_Types.list src);
//wiki: integer llList2Integer(list src, integer index)
int llList2Integer(List<string> src, int index);
int llList2Integer(LSL_Types.list src, int index);
//wiki: double llList2double(list src, integer index)
double llList2double(List<string> src, int index);
double osList2Double(LSL_Types.list src, int index);
//wiki: string llList2String(list src, integer index)
string llList2String(List<string> src, int index);
string llList2String(LSL_Types.list src, int index);
//wiki: key llList2Key(list src, integer index)
string llList2Key(List<string> src, int index);
string llList2Key(LSL_Types.list src, int index);
//wiki: vector llList2Vector(list src, integer index)
LSL_Types.Vector3 llList2Vector(List<string> src, int index);
LSL_Types.Vector3 llList2Vector(LSL_Types.list src, int index);
//wiki rotation llList2Rot(list src, integer index)
LSL_Types.Quaternion llList2Rot(List<string> src, int index);
LSL_Types.Quaternion llList2Rot(LSL_Types.list src, int index);
//wiki: list llList2List(list src, integer start, integer end)
List<string> llList2List(List<string> src, int start, int end);
LSL_Types.list llList2List(LSL_Types.list src, int start, int end);
//wiki: llDeleteSubList(list src, integer start, integer end)
List<string> llDeleteSubList(List<string> src, int start, int end);
LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end);
//wiki: integer llGetListEntryType( list src, integer index )
int llGetListEntryType(List<string> src, int index);
int llGetListEntryType(LSL_Types.list src, int index);
//wiki: string llList2CSV( list src )
string llList2CSV(List<string> src);
string llList2CSV(LSL_Types.list src);
//wiki: list llCSV2List( string src )
List<string> llCSV2List(string src);
LSL_Types.list llCSV2List(string src);
//wiki: list llListRandomize( list src, integer stride )
List<string> llListRandomize(List<string> src, int stride);
LSL_Types.list llListRandomize(LSL_Types.list src, int stride);
//wiki: list llList2ListStrided( list src, integer start, integer end, integer stride )
List<string> llList2ListStrided(List<string> src, int start, int end, int stride);
LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride);
//wiki: vector llGetRegionCorner( )
LSL_Types.Vector3 llGetRegionCorner();
//wiki: list llListInsertList( list dest, list src, integer start )
List<string> llListInsertList(List<string> dest, List<string> src, int start);
LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start);
//wiki: integer llListFindList( list src, list test )
int llListFindList(List<string> src, List<string> test);
int llListFindList(LSL_Types.list src, LSL_Types.list test);
//wiki: string llGetObjectName()
string llGetObjectName();
//wiki: llSetObjectName(string name)
@ -466,11 +466,12 @@ namespace OpenSim.Region.ScriptEngine.Common
void llSetCameraEyeOffset(LSL_Types.Vector3 offset);
//wiki: llSeteCameraAtOffset(vector offset)
void llSetCameraAtOffset(LSL_Types.Vector3 offset);
void llDumpList2String();
//
string llDumpList2String(LSL_Types.list src, string seperator);
//wiki: integer llScriptDanger(vector pos)
void llScriptDanger(LSL_Types.Vector3 pos);
//wiki: llDialog( key avatar, string message, list buttons, integer chat_channel )
void llDialog(string avatar, string message, List<string> buttons, int chat_channel);
void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel);
//wiki: llVolumeDetect(integer detect)
void llVolumeDetect(int detect);
//wiki: llResetOtherScript(string name)
@ -494,7 +495,7 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki: string llMD5String(string src, integer nonce)
string llMD5String(string src, int nonce);
//wiki: llSetPrimitiveParams( list rules )
void llSetPrimitiveParams(List<string> rules);
void llSetPrimitiveParams(LSL_Types.list rules);
//wiki: string llStringToBase64(string str)
string llStringToBase64(string str);
//wiki: string llBase64ToString(string str)
@ -508,7 +509,7 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki: double llLog(double val)
double llLog(double val);
//wiki: list llGetAnimationList( key id )
List<string> llGetAnimationList(string id);
LSL_Types.list llGetAnimationList(string id);
//wiki: llSetParcelMusicURL(string url)
void llSetParcelMusicURL(string url);
//wiki: vector llGetRootPosition()
@ -530,7 +531,7 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki: key llGetNumberOfNotecardLines(string name)
string llGetNumberOfNotecardLines(string name);
//wiki: list llGetBoundingBox( key object )
List<string> llGetBoundingBox(string obj);
LSL_Types.list llGetBoundingBox(string obj);
//wiki: vector llGetGeometricCenter()
LSL_Types.Vector3 llGetGeometricCenter();
void llGetPrimitiveParams();
@ -545,7 +546,7 @@ namespace OpenSim.Region.ScriptEngine.Common
//llSetLocalRot(rotation rot)
void llSetLocalRot(LSL_Types.Quaternion rot);
//wiki: list llParseStringKeepNulls( string src, list separators, list spacers )
List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers);
LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list seperators, LSL_Types.list spacers);
//wiki: llRezAtRoot(string inventory, vector position, vector velocity, rotation rot, integer param)
void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
LSL_Types.Quaternion rot, int param);
@ -572,14 +573,14 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki: llLoadURL(key avatar_id, string message, string url)
void llLoadURL(string avatar_id, string message, string url);
//wiki: llParcelMediaCommandList( list commandList )
void llParcelMediaCommandList(List<string> commandList);
void llParcelMediaCommandList(LSL_Types.list commandList);
void llParcelMediaQuery();
//wiki integer llModPow(integer a, integer b, integer c)
int llModPow(int a, int b, int c);
//wiki: integer llGetInventoryType(string name)
int llGetInventoryType(string name);
//wiki: llSetPayPrice( integer price, list quick_pay_buttons )
void llSetPayPrice(int price, List<string> quick_pay_buttons);
void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons);
//wiki: vector llGetCameraPos()
LSL_Types.Vector3 llGetCameraPos();
//wiki rotation llGetCameraRot()
@ -601,11 +602,11 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki: llRemoveFromLandBanList(key avatar)
void llRemoveFromLandBanList(string avatar);
//wiki: llSetCameraParams( list rules )
void llSetCameraParams(List<string> rules);
void llSetCameraParams(LSL_Types.list rules);
//wiki: llClearCameraParams()
void llClearCameraParams();
//wiki: double llListStatistics( integer operation, list src )
double llListStatistics(int operation, List<string> src);
double llListStatistics(int operation, LSL_Types.list src);
//wiki: integer llGetUnixTime()
int llGetUnixTime();
//wiki: integer llGetParcelFlags(vector pos)
@ -614,7 +615,7 @@ namespace OpenSim.Region.ScriptEngine.Common
int llGetRegionFlags();
//wiki: string llXorBase64StringsCorrect(string str1, string str2)
string llXorBase64StringsCorrect(string str1, string str2);
string llHTTPRequest(string url, List<string> parameters, string body);
string llHTTPRequest(string url, LSL_Types.list parameters, string body);
//wiki: llResetLandBanList()
void llResetLandBanList();
//wiki: llResetLandPassList()
@ -622,13 +623,13 @@ namespace OpenSim.Region.ScriptEngine.Common
//wiki integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide)
int llGetParcelPrimCount(LSL_Types.Vector3 pos, int category, int sim_wide);
//wiki: list llGetParcelPrimOwners( vector pos )
List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos);
LSL_Types.list llGetParcelPrimOwners(LSL_Types.Vector3 pos);
//wiki: integer llGetObjectPrimCount(key object_id)
int llGetObjectPrimCount(string object_id);
//wiki: integer llGetParcelMaxPrims( vector pos, integer sim_wide )
int llGetParcelMaxPrims(LSL_Types.Vector3 pos, int sim_wide);
//wiki list llGetParcelDetails(vector pos, list params)
List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param);
LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param);
//OpenSim functions
string osSetDynamicTextureURL(string dynamicID, string contentType, string url, string extraParams, int timer);

View File

@ -252,5 +252,119 @@ namespace OpenSim.Region.ScriptEngine.Common
return c;
}
}
[Serializable]
public class list
{
private object[] m_data;
public list(params object[] args)
{
m_data = new object[args.Length];
m_data = args;
}
public int Length
{
get { return m_data.Length; }
}
public object[] Data
{
get { return m_data; }
}
public static list operator +(list a, list b)
{
object[] tmp;
tmp = new object[a.Length + b.Length];
a.Data.CopyTo(tmp, 0);
b.Data.CopyTo(tmp, a.Length);
return new list(tmp);
}
public list GetSublist(int start, int end)
{
Console.WriteLine("GetSublist(" + start.ToString() + "," + end.ToString() + ")");
object[] ret;
// Take care of neg start or end's
if (start < 0)
{
start = m_data.Length + start;
}
if (end < 0)
{
end = m_data.Length + end;
}
// Case start < end
if (start <= end)
{
if (start >= m_data.Length)
{
return new list();
}
if (end >= m_data.Length)
{
end = m_data.Length - 1;
}
ret = new object[end - start + 1];
Array.Copy(m_data, start, ret, 0, end - start + 1);
return new list(ret);
}
else
{
if (start >= m_data.Length)
{
return this.GetSublist(0, end);
}
if (end >= m_data.Length)
{
return new list();
}
// end < start
//ret = new object[m_data.Length - Math.Abs(end - start + 1)];
//Array.Copy(m_data, 0, ret, m_data.Length - start, end + 1);
//Array.Copy(m_data, start, ret, 0, m_data.Length - start);
return this.GetSublist(0, end) + this.GetSublist(start, this.Data.Length - 1);
//return new list(ret);
}
}
public string ToPrettyString()
{
string output;
if (m_data.Length == 0)
{
return "[]";
}
output = "[";
foreach (object o in m_data)
{
if (o.GetType().ToString() == "System.String")
{
output = output + "\"" + o + "\", ";
}
else
{
output = output + o.ToString() + ", ";
}
}
output = output.Substring(0, output.Length - 2);
output = output + "]";
return output;
}
public override string ToString()
{
string output;
output = "";
if (m_data.Length == 0)
{
return "";
}
foreach (object o in m_data)
{
output = output + o.ToString();
}
return output;
}
}
}
}

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
dataTypes.Add("key", "string");
dataTypes.Add("vector", "LSL_Types.Vector3");
dataTypes.Add("rotation", "LSL_Types.Quaternion");
dataTypes.Add("list", "List<string>");
dataTypes.Add("list", "LSL_Types.list");
dataTypes.Add("null", "null");
}
@ -259,7 +259,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
// Replace List []'s
Script =
Regex.Replace(Script, @"\[([^\]]*)\]", @"List.Parse($1)",
Regex.Replace(Script, @"\[([^\]]*)\]", @"new LSL_Types.list($1)",
RegexOptions.Compiled | RegexOptions.Multiline | RegexOptions.Singleline);

View File

@ -1061,12 +1061,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llGetCenterOfMass();
}
public List<string> llListSort(List<string> src, int stride, int ascending)
public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending)
{
return m_LSL_Functions.llListSort(src, stride, ascending);
}
public int llGetListLength(List<string> src)
public int llGetListLength(LSL_Types.list src)
{
return m_LSL_Functions.llGetListLength(src);
}
@ -1074,67 +1074,67 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
//
// DO NOT MODIFY HERE: MODIFY IN LSL_BuiltIn_Commands.cs
//
public int llList2Integer(List<string> src, int index)
public int llList2Integer(LSL_Types.list src, int index)
{
return m_LSL_Functions.llList2Integer(src, index);
}
public double llList2double(List<string> src, int index)
public double osList2Double(LSL_Types.list src, int index)
{
return m_LSL_Functions.llList2double(src, index);
return m_LSL_Functions.osList2Double(src, index);
}
public string llList2String(List<string> src, int index)
public string llList2String(LSL_Types.list src, int index)
{
return m_LSL_Functions.llList2String(src, index);
}
public string llList2Key(List<string> src, int index)
public string llList2Key(LSL_Types.list src, int index)
{
return m_LSL_Functions.llList2Key(src, index);
}
public vector llList2Vector(List<string> src, int index)
public vector llList2Vector(LSL_Types.list src, int index)
{
return m_LSL_Functions.llList2Vector(src, index);
}
public rotation llList2Rot(List<string> src, int index)
public rotation llList2Rot(LSL_Types.list src, int index)
{
return m_LSL_Functions.llList2Rot(src, index);
}
public List<string> llList2List(List<string> src, int start, int end)
public LSL_Types.list llList2List(LSL_Types.list src, int start, int end)
{
return m_LSL_Functions.llList2List(src, start, end);
}
public List<string> llDeleteSubList(List<string> src, int start, int end)
public LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end)
{
return m_LSL_Functions.llDeleteSubList(src, start, end);
}
public int llGetListEntryType(List<string> src, int index)
public int llGetListEntryType(LSL_Types.list src, int index)
{
return m_LSL_Functions.llGetListEntryType(src, index);
}
public string llList2CSV(List<string> src)
public string llList2CSV(LSL_Types.list src)
{
return m_LSL_Functions.llList2CSV(src);
}
public List<string> llCSV2List(string src)
public LSL_Types.list llCSV2List(string src)
{
return m_LSL_Functions.llCSV2List(src);
}
public List<string> llListRandomize(List<string> src, int stride)
public LSL_Types.list llListRandomize(LSL_Types.list src, int stride)
{
return m_LSL_Functions.llListRandomize(src, stride);
}
public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
public LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride)
{
return m_LSL_Functions.llList2ListStrided(src, start, end, stride);
}
@ -1144,12 +1144,12 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llGetRegionCorner();
}
public List<string> llListInsertList(List<string> dest, List<string> src, int start)
public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start)
{
return m_LSL_Functions.llListInsertList(dest, src, start);
}
public int llListFindList(List<string> src, List<string> test)
public int llListFindList(LSL_Types.list src, LSL_Types.list test)
{
return m_LSL_Functions.llListFindList(src, test);
}
@ -1375,9 +1375,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
m_LSL_Functions.llSetCameraAtOffset(offset);
}
public void llDumpList2String()
public string llDumpList2String(LSL_Types.list src, string seperator)
{
m_LSL_Functions.llDumpList2String();
return m_LSL_Functions.llDumpList2String(src, seperator);
}
public void llScriptDanger(vector pos)
@ -1385,7 +1385,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
m_LSL_Functions.llScriptDanger(pos);
}
public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel)
{
m_LSL_Functions.llDialog(avatar, message, buttons, chat_channel);
}
@ -1448,7 +1448,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llMD5String(src, nonce);
}
public void llSetPrimitiveParams(List<string> rules)
public void llSetPrimitiveParams(LSL_Types.list rules)
{
m_LSL_Functions.llSetPrimitiveParams(rules);
}
@ -1483,7 +1483,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llLog(val);
}
public List<string> llGetAnimationList(string id)
public LSL_Types.list llGetAnimationList(string id)
{
return m_LSL_Functions.llGetAnimationList(id);
}
@ -1538,7 +1538,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llGetNumberOfNotecardLines(name);
}
public List<string> llGetBoundingBox(string obj)
public LSL_Types.list llGetBoundingBox(string obj)
{
return m_LSL_Functions.llGetBoundingBox(obj);
}
@ -1581,7 +1581,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
m_LSL_Functions.llSetLocalRot(rot);
}
public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
public LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list seperators, LSL_Types.list spacers)
{
return m_LSL_Functions.llParseStringKeepNulls(src, seperators, spacers);
}
@ -1646,7 +1646,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
m_LSL_Functions.llLoadURL(avatar_id, message, url);
}
public void llParcelMediaCommandList(List<string> commandList)
public void llParcelMediaCommandList(LSL_Types.list commandList)
{
m_LSL_Functions.llParcelMediaCommandList(commandList);
}
@ -1669,7 +1669,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llGetInventoryType(name);
}
public void llSetPayPrice(int price, List<string> quick_pay_buttons)
public void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons)
{
m_LSL_Functions.llSetPayPrice(price, quick_pay_buttons);
}
@ -1724,7 +1724,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
m_LSL_Functions.llRemoveFromLandBanList(avatar);
}
public void llSetCameraParams(List<string> rules)
public void llSetCameraParams(LSL_Types.list rules)
{
m_LSL_Functions.llSetCameraParams(rules);
}
@ -1734,7 +1734,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
m_LSL_Functions.llClearCameraParams();
}
public double llListStatistics(int operation, List<string> src)
public double llListStatistics(int operation, LSL_Types.list src)
{
return m_LSL_Functions.llListStatistics(operation, src);
}
@ -1759,7 +1759,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llXorBase64StringsCorrect(str1, str2);
}
public string llHTTPRequest(string url, List<string> parameters, string body)
public string llHTTPRequest(string url, LSL_Types.list parameters, string body)
{
return m_LSL_Functions.llHTTPRequest(url, parameters, body);
}
@ -1779,7 +1779,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llGetParcelPrimCount(pos, category, sim_wide);
}
public List<string> llGetParcelPrimOwners(vector pos)
public LSL_Types.list llGetParcelPrimOwners(vector pos)
{
return m_LSL_Functions.llGetParcelPrimOwners(pos);
}
@ -1797,7 +1797,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
return m_LSL_Functions.llGetParcelMaxPrims(pos, sim_wide);
}
public List<string> llGetParcelDetails(vector pos, List<string> param)
public LSL_Types.list llGetParcelDetails(vector pos, LSL_Types.list param)
{
return m_LSL_Functions.llGetParcelDetails(pos, param);
}

View File

@ -28,6 +28,7 @@
using System;
using System.Collections.Generic;
using System.Collections;
using System.Runtime.Remoting.Lifetime;
using System.Text;
using System.Threading;
@ -102,6 +103,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
//starting out, we use the System.Math library for trig functions. - ckrinke 8-14-07
public double llSin(double f)
{
return (double) Math.Sin(f);
}
@ -1430,205 +1432,299 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return new LSL_Types.Vector3();
}
public List<string> llListSort(List<string> src, int stride, int ascending)
public LSL_Types.list llListSort(LSL_Types.list src, int stride, int ascending)
{
SortedList<string, List<string>> sorted = new SortedList<string, List<string>>();
// SortedList<string, LSL_Types.list> sorted = new SortedList<string, LSL_Types.list>();
// Add chunks to an array
int s = stride;
if (s < 1)
s = 1;
int c = 0;
List<string> chunk = new List<string>();
string chunkString = "";
foreach (string element in src)
{
c++;
if (c > s)
{
sorted.Add(chunkString, chunk);
chunkString = "";
chunk = new List<string>();
c = 0;
}
chunk.Add(element);
chunkString += element.ToString();
}
if (chunk.Count > 0)
sorted.Add(chunkString, chunk);
//int s = stride;
//if (s < 1)
// s = 1;
//int c = 0;
//LSL_Types.list chunk = new LSL_Types.list();
//string chunkString = "";
//foreach (string element in src)
//{
// c++;
// if (c > s)
// {
// sorted.Add(chunkString, chunk);
// chunkString = "";
// chunk = new LSL_Types.list();
// c = 0;
// }
// chunk.Add(element);
// chunkString += element.ToString();
//}
//if (chunk.Count > 0)
// sorted.Add(chunkString, chunk);
List<string> ret = new List<string>();
foreach (List<string> ls in sorted.Values)
{
ret.AddRange(ls);
//LSL_Types.list ret = new LSL_Types.list();
//foreach (LSL_Types.list ls in sorted.Values)
//{
// ret.AddRange(ls);
//}
//if (ascending == LSL_BaseClass.TRUE)
// return ret;
//ret.Reverse();
//return ret;
NotImplemented("llListSort");
return new LSL_Types.list();
}
if (ascending == LSL_BaseClass.TRUE)
return ret;
ret.Reverse();
return ret;
public int llGetListLength(LSL_Types.list src)
{
return src.Length;
}
public int llGetListLength(List<string> src)
public int llList2Integer(LSL_Types.list src, int index)
{
return src.Count;
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length)
{
return 0;
}
return Convert.ToInt32(src.Data[index]);
}
public int llList2Integer(List<string> src, int index)
public double osList2Double(LSL_Types.list src, int index)
{
return Convert.ToInt32(src[index]);
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length)
{
return 0.0;
}
return Convert.ToDouble(src.Data[index]);
}
public double llList2double(List<string> src, int index)
public double llList2Float(LSL_Types.list src, int index)
{
return Convert.ToDouble(src[index]);
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length)
{
return 0.0;
}
return Convert.ToSingle(src.Data[index]);
}
public float llList2Float(List<string> src, int index)
public string llList2String(LSL_Types.list src, int index)
{
return Convert.ToSingle(src[index]);
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length)
{
return "";
}
return src.Data[index].ToString();
}
public string llList2String(List<string> src, int index)
public string llList2Key(LSL_Types.list src, int index)
{
return src[index];
if (index < 0)
{
index = src.Length + index;
}
public string llList2Key(List<string> src, int index)
if (index >= src.Length)
{
return "00000000-0000-0000-0000-000000000000";
}
//return OpenSim.Framework.ToStringHyphenated(src[index]);
return src[index].ToString();
}
public LSL_Types.Vector3 llList2Vector(List<string> src, int index)
LLUUID tmpkey;
if (LLUUID.TryParse(src.Data[index].ToString(), out tmpkey))
{
return
new LSL_Types.Vector3(double.Parse(src[index]), double.Parse(src[index + 1]),
double.Parse(src[index + 2]));
}
public LSL_Types.Quaternion llList2Rot(List<string> src, int index)
{
return
new LSL_Types.Quaternion(double.Parse(src[index]), double.Parse(src[index + 1]),
double.Parse(src[index + 2]), double.Parse(src[index + 3]));
}
public List<string> llList2List(List<string> src, int start, int end)
{
if (end > start)
{
// Simple straight forward chunk
return src.GetRange(start, end - start);
return tmpkey.ToStringHyphenated();
}
else
{
// Some of the end + some of the beginning
// First chunk
List<string> ret = new List<string>();
ret.AddRange(src.GetRange(start, src.Count - start));
ret.AddRange(src.GetRange(0, end));
return ret;
return "00000000-0000-0000-0000-000000000000";
}
}
public List<string> llDeleteSubList(List<string> src, int start, int end)
public LSL_Types.Vector3 llList2Vector(LSL_Types.list src, int index)
{
List<string> ret = new List<string>(src);
ret.RemoveRange(start, end - start);
return ret;
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length)
{
return new LSL_Types.Vector3(0, 0, 0);
}
if (src.Data[index].GetType().ToString() == "OpenSim.Region.ScriptEngine.Common.LSL_Types+Vector3")
{
return (LSL_Types.Vector3)src.Data[index];
}
else
{
return new LSL_Types.Vector3(0,0,0);
}
}
public int llGetListEntryType(List<string> src, int index)
public LSL_Types.Quaternion llList2Rot(LSL_Types.list src, int index)
{
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length)
{
return new LSL_Types.Quaternion(0, 0, 0, 1);
}
if (src.Data[index].GetType().ToString() == "OpenSim.Region.ScriptEngine.Common.LSL_Types+Quaternion")
{
return (LSL_Types.Quaternion)src.Data[index];
}
else
{
return new LSL_Types.Quaternion(0, 0, 0, 1);
}
}
public LSL_Types.list llList2List(LSL_Types.list src, int start, int end)
{
return src.GetSublist(start, end);
}
public LSL_Types.list llDeleteSubList(LSL_Types.list src, int start, int end)
{
//LSL_Types.list ret = new LSL_Types.list(src);
//ret.RemoveRange(start, end - start);
//return ret;
// Just a hunch - needs testing
return src.GetSublist(end, start);
}
public int llGetListEntryType(LSL_Types.list src, int index)
{
if (index < 0)
{
index = src.Length + index;
}
if (index >= src.Length)
{
NotImplemented("llGetListEntryType");
return 0;
}
switch (src.Data[index].GetType().ToString())
{
case "System.Int32":
return 1;
case "System.Double":
return 2;
case "System.String":
LLUUID tuuid;
if (LLUUID.TryParse(src.Data[index].ToString(),out tuuid))
{
return 3;
}
else
{
return 4;
}
case "OpenSim.Region.ScriptEngine.Common.LSL_Types+Vector3":
return 5;
case "OpenSim.Region.ScriptEngine.Common.LSL_Types+Quaternion":
return 6;
case "OpenSim.Region.ScriptEngine.Common.LSL_Types+list":
return 7;
default:
return 0;
}
}
public string llList2CSV(List<string> src)
public string llList2CSV(LSL_Types.list src)
{
string ret = "";
foreach (string s in src)
foreach (object o in src.Data)
{
if (s.Length > 0)
ret += ",";
ret += s;
ret = ret + o.ToString() + ",";
}
ret = ret.Substring(0, ret.Length - 2);
return ret;
}
public List<string> llCSV2List(string src)
public LSL_Types.list llCSV2List(string src)
{
List<string> ret = new List<string>();
foreach (string s in src.Split(",".ToCharArray()))
{
ret.Add(s);
}
return ret;
return new LSL_Types.list(src.Split(",".ToCharArray()));
}
public List<string> llListRandomize(List<string> src, int stride)
public LSL_Types.list llListRandomize(LSL_Types.list src, int stride)
{
int s = stride;
if (s < 1)
s = 1;
//int s = stride;
//if (s < 1)
// s = 1;
// This is a cowardly way of doing it ;)
// TODO: Instead, randomize and check if random is mod stride or if it can not be, then array.removerange
List<List<string>> tmp = new List<List<string>>();
//List<LSL_Types.list> tmp = new List<LSL_Types.list>();
// Add chunks to an array
int c = 0;
List<string> chunk = new List<string>();
foreach (string element in src)
{
c++;
if (c > s)
{
tmp.Add(chunk);
chunk = new List<string>();
c = 0;
}
chunk.Add(element);
}
if (chunk.Count > 0)
tmp.Add(chunk);
//int c = 0;
//LSL_Types.list chunk = new LSL_Types.list();
//foreach (string element in src)
//{
// c++;
// if (c > s)
// {
// tmp.Add(chunk);
// chunk = new LSL_Types.list();
// c = 0;
// }
// chunk.Add(element);
//}
//if (chunk.Count > 0)
// tmp.Add(chunk);
// Decreate (<- what kind of word is that? :D ) array back into a list
int rnd;
List<string> ret = new List<string>();
while (tmp.Count > 0)
{
rnd = Util.RandomClass.Next(tmp.Count);
foreach (string str in tmp[rnd])
{
ret.Add(str);
}
tmp.RemoveAt(rnd);
//int rnd;
//LSL_Types.list ret = new LSL_Types.list();
//while (tmp.Count > 0)
//{
// rnd = Util.RandomClass.Next(tmp.Count);
// foreach (string str in tmp[rnd])
// {
// ret.Add(str);
// }
// tmp.RemoveAt(rnd);
//}
//return ret;
NotImplemented("llListRandomize");
return new LSL_Types.list();
}
return ret;
}
public LSL_Types.list llList2ListStrided(LSL_Types.list src, int start, int end, int stride)
{
LSL_Types.list ret = new LSL_Types.list();
//int s = stride;
//if (s < 1)
// s = 1;
public List<string> llList2ListStrided(List<string> src, int start, int end, int stride)
{
List<string> ret = new List<string>();
int s = stride;
if (s < 1)
s = 1;
int sc = s;
for (int i = start; i < src.Count; i++)
{
sc--;
if (sc == 0)
{
sc = s;
// Addthis
ret.Add(src[i]);
}
if (i == end)
break;
}
//int sc = s;
//for (int i = start; i < src.Count; i++)
//{
// sc--;
// if (sc == 0)
// {
// sc = s;
// // Addthis
// ret.Add(src[i]);
// }
// if (i == end)
// break;
//}
NotImplemented("llList2ListStrided");
return ret;
}
@ -1637,27 +1733,22 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return new LSL_Types.Vector3(World.RegionInfo.RegionLocX*256, World.RegionInfo.RegionLocY*256, 0);
}
public List<string> llListInsertList(List<string> dest, List<string> src, int start)
public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start)
{
List<string> ret = new List<string>(dest);
//foreach (string s in src.Reverse())
for (int ci = src.Count - 1; ci > -1; ci--)
{
ret.Insert(start, src[ci]);
}
return ret;
return dest.GetSublist(0, start - 1) + src + dest.GetSublist(start, -1);
}
public int llListFindList(List<string> src, List<string> test)
public int llListFindList(LSL_Types.list src, LSL_Types.list test)
{
foreach (string s in test)
{
for (int ci = 0; ci < src.Count; ci++)
{
if (s == src[ci])
return ci;
}
}
//foreach (string s in test)
//{
// for (int ci = 0; ci < src.Count; ci++)
// {
// if (s == src[ci])
// return ci;
// }
//}
NotImplemented("llListFindList");
return -1;
}
@ -2018,9 +2109,19 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
NotImplemented("llSetCameraAtOffset");
}
public void llDumpList2String()
public string llDumpList2String(LSL_Types.list src, string seperator)
{
NotImplemented("llDumpList2String");
if (src.Length == 0)
{
return "";
}
string ret = "";
foreach (object o in src.Data)
{
ret = ret + o.ToString() + seperator;
}
ret = ret.Substring(0, ret.Length - seperator.Length);
return ret;
}
public void llScriptDanger(LSL_Types.Vector3 pos)
@ -2028,7 +2129,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
NotImplemented("llScriptDanger");
}
public void llDialog(string avatar, string message, List<string> buttons, int chat_channel)
public void llDialog(string avatar, string message, LSL_Types.list buttons, int chat_channel)
{
NotImplemented("llDialog");
}
@ -2103,7 +2204,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return Util.Md5Hash(src + ":" + nonce.ToString());
}
public void llSetPrimitiveParams(List<string> rules)
public void llSetPrimitiveParams(LSL_Types.list rules)
{
NotImplemented("llSetPrimitiveParams");
}
@ -2162,10 +2263,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return (double) Math.Log(val);
}
public List<string> llGetAnimationList(string id)
public LSL_Types.list llGetAnimationList(string id)
{
NotImplemented("llGetAnimationList");
return new List<string>();
return new LSL_Types.list();
}
public void llSetParcelMusicURL(string url)
@ -2221,10 +2322,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return "";
}
public List<string> llGetBoundingBox(string obj)
public LSL_Types.list llGetBoundingBox(string obj)
{
NotImplemented("llGetBoundingBox");
return new List<string>();
return new LSL_Types.list();
}
public LSL_Types.Vector3 llGetGeometricCenter()
@ -2265,10 +2366,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
NotImplemented("llSetLocalRot");
}
public List<string> llParseStringKeepNulls(string src, List<string> seperators, List<string> spacers)
public LSL_Types.list llParseStringKeepNulls(string src, LSL_Types.list seperators, LSL_Types.list spacers)
{
NotImplemented("llParseStringKeepNulls");
return new List<string>();
return new LSL_Types.list();
}
public void llRezAtRoot(string inventory, LSL_Types.Vector3 position, LSL_Types.Vector3 velocity,
@ -2337,7 +2438,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
url);
}
public void llParcelMediaCommandList(List<string> commandList)
public void llParcelMediaCommandList(LSL_Types.list commandList)
{
NotImplemented("llParcelMediaCommandList");
}
@ -2360,7 +2461,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return 0;
}
public void llSetPayPrice(int price, List<string> quick_pay_buttons)
public void llSetPayPrice(int price, LSL_Types.list quick_pay_buttons)
{
NotImplemented("llSetPayPrice");
}
@ -2431,7 +2532,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
NotImplemented("llRemoveFromLandBanList");
}
public void llSetCameraParams(List<string> rules)
public void llSetCameraParams(LSL_Types.list rules)
{
NotImplemented("llSetCameraParams");
}
@ -2441,7 +2542,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
NotImplemented("llClearCameraParams");
}
public double llListStatistics(int operation, List<string> src)
public double llListStatistics(int operation, LSL_Types.list src)
{
NotImplemented("llListStatistics");
return 0;
@ -2481,13 +2582,17 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return llStringToBase64(ret);
}
public string llHTTPRequest(string url, List<string> parameters, string body)
public string llHTTPRequest(string url, LSL_Types.list parameters, string body)
{
IHttpRequests httpScriptMod =
m_ScriptEngine.World.RequestModuleInterface<IHttpRequests>();
List<string> param = new List<string>();
foreach (object o in parameters.Data)
{
param.Add(o.ToString());
}
LLUUID reqID = httpScriptMod.
StartHttpRequest(m_localID, m_itemID, url, parameters, body);
StartHttpRequest(m_localID, m_itemID, url, param, body);
if( reqID != null )
return reqID.ToString();
@ -2511,10 +2616,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return 0;
}
public List<string> llGetParcelPrimOwners(LSL_Types.Vector3 pos)
public LSL_Types.list llGetParcelPrimOwners(LSL_Types.Vector3 pos)
{
NotImplemented("llGetParcelPrimOwners");
return new List<string>();
return new LSL_Types.list();
}
public int llGetObjectPrimCount(string object_id)
@ -2529,10 +2634,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler
return 0;
}
public List<string> llGetParcelDetails(LSL_Types.Vector3 pos, List<string> param)
public LSL_Types.list llGetParcelDetails(LSL_Types.Vector3 pos, LSL_Types.list param)
{
NotImplemented("llGetParcelDetails");
return new List<string>();
return new LSL_Types.list();
}
//