No _vti
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
<Project name="Multidimensional_Array_API" guid="D7F9C284-6C00-1014-B904-200204C60A89">
|
||||
<Object name="Object" guid="D7F9C376-6C00-1014-B904-200204C60A89">
|
||||
<Script name="Multidimensional_Array_API_1.lsl" guid="D7F9EC40-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
<Script name="Multidimensional_Array_API_2.lsl" guid="D7FA04CA-6C00-1014-B904-200204C60A89">
|
||||
</Script>
|
||||
</Object>
|
||||
</Project>
|
||||
@@ -1,35 +0,0 @@
|
||||
// :CATEGORY:Lists
|
||||
// :NAME:Multidimensional_Array_API
|
||||
// :AUTHOR:Christopher Omega
|
||||
// :CREATED:2010-01-10 05:20:56.000
|
||||
// :EDITED:2013-09-18 15:38:57
|
||||
// :ID:533
|
||||
// :NUM:718
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// This script allows you to store data in lists as you would in a C++ or Java multidimensional array. It is a bit more flexible than those language's arrays, since it allows you to dynamically resize each dimension; You don't have to define the size of the array before you use it. If you ever ran into the "Runtime Error: Lists cannot contain lists" message and really needed a list within another, this is what you can use.
|
||||
//
|
||||
// For example, say you had a chessboard with each square a different color. Your script can refer to each color using a two-dimensional array; one number for the row another for the column of the particular color.
|
||||
// :CODE:
|
||||
default {
|
||||
|
||||
state_entry() {
|
||||
|
||||
integer SQUARES_ON_SIDE = 12;
|
||||
|
||||
// Randomly assign colors to each square:
|
||||
|
||||
list colorArray;
|
||||
|
||||
integer row;
|
||||
|
||||
integer col;
|
||||
|
||||
for (row = 0; row < SQUARES_ON_SIDE; ++row) {
|
||||
|
||||
for (col = 0; col < SQUARES_ON_SIDE; ++col) {
|
||||
|
||||
vector color = <llFrand(1), llFrand(1), llFrand(1)>;
|
||||
|
||||
colorArray = setArray(colorArray, [row, col], [color]);
|
||||
@@ -1,118 +0,0 @@
|
||||
// :CATEGORY:Lists
|
||||
// :NAME:Multidimensional_Array_API
|
||||
// :AUTHOR:Christopher Omega
|
||||
// :CREATED:2010-01-10 05:20:56.000
|
||||
// :EDITED:2013-09-18 15:38:57
|
||||
// :ID:533
|
||||
// :NUM:719
|
||||
// :REV:1.0
|
||||
// :WORLD:Second Life
|
||||
// :DESCRIPTION:
|
||||
// Getting an element at index [1, 5, 2, 9], in an array "A" translates to:
|
||||
// Get list at index 1 in A, call this B,
|
||||
// Get list at index 5 in B, call this C,
|
||||
// Get list at index 2 in C, call this D,
|
||||
// Return element at index 9 in D.
|
||||
//
|
||||
// And here are the functions :)
|
||||
// :CODE:
|
||||
// Generates a random string of length len
|
||||
|
||||
// from the characters passed to it.
|
||||
|
||||
string randomSeperator(integer len) {
|
||||
|
||||
integer firstChar = (integer)llFrand(60) + 20; // Range of printable chars = 0x20 to 0x7E
|
||||
|
||||
if (len <= 1)
|
||||
|
||||
return llUnescapeURL("%"+(string)firstChar);
|
||||
|
||||
integer lastChar;
|
||||
|
||||
do { // Last char must not equal first char.
|
||||
|
||||
lastChar = (integer)llFrand(60) + 20;
|
||||
|
||||
} while (lastChar == firstChar);
|
||||
|
||||
string ret = llUnescapeURL("%"+(string)firstChar);
|
||||
|
||||
for (len -= 2; len > 0; --len) {
|
||||
|
||||
integer val;
|
||||
|
||||
do {
|
||||
|
||||
val = (integer)llFrand(60) + 20;
|
||||
|
||||
} while (val == firstChar || val == lastChar);
|
||||
|
||||
ret += llUnescapeURL("%" + (string)val);
|
||||
|
||||
}
|
||||
|
||||
return ret + llUnescapeURL("%"+(string)lastChar);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
integer SEPERATOR_LEN = 3;
|
||||
|
||||
string dumpList2String(list src) {
|
||||
|
||||
// Generate a seperator not present in any of the
|
||||
|
||||
// elements in the list.
|
||||
|
||||
string chars = (string) src; // Squashes all elements together.
|
||||
|
||||
string seperator;
|
||||
|
||||
do {
|
||||
|
||||
seperator = randomSeperator(SEPERATOR_LEN);
|
||||
|
||||
} while (llSubStringIndex(chars, seperator) != -1);
|
||||
|
||||
return seperator + llDumpList2String(src, seperator);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
list parseStringKeepNulls(string src) {
|
||||
|
||||
// The seperator should be the first SEPERATOR_LEN
|
||||
|
||||
// characters in the string.
|
||||
|
||||
return llParseStringKeepNulls(llDeleteSubString(src, 0, SEPERATOR_LEN - 1),
|
||||
|
||||
[llGetSubString(src, 0, SEPERATOR_LEN - 1)], []);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
list setListElement(list dest, list src, integer index) {
|
||||
|
||||
if (src == []) {
|
||||
|
||||
return llListReplaceList(src, [""], index, index);
|
||||
|
||||
} else {
|
||||
|
||||
integer len = llGetListLength(dest);
|
||||
|
||||
for (; len < index; ++len) {
|
||||
|
||||
dest += "";
|
||||
|
||||
}
|
||||
|
||||
return llListReplaceList(dest, src, index, index + llGetListLength(src) - 1);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
vti_encoding:SR|utf8-nl
|
||||
vti_timelastmodified:TR|08 Sep 2013 03:49:03 -0000
|
||||
vti_extenderversion:SR|12.0.0.6211
|
||||
vti_backlinkinfo:VX|
|
||||
vti_author:SR|alien\\fred
|
||||
vti_modifiedby:SR|alien\\fred
|
||||
vti_timecreated:TR|18 Sep 2013 20:38:57 -0000
|
||||
@@ -1,7 +0,0 @@
|
||||
vti_encoding:SR|utf8-nl
|
||||
vti_timelastmodified:TR|08 Sep 2013 03:49:03 -0000
|
||||
vti_extenderversion:SR|12.0.0.6211
|
||||
vti_backlinkinfo:VX|
|
||||
vti_author:SR|alien\\fred
|
||||
vti_modifiedby:SR|alien\\fred
|
||||
vti_timecreated:TR|18 Sep 2013 20:38:57 -0000
|
||||
@@ -1,6 +0,0 @@
|
||||
vti_encoding:SR|utf8-nl
|
||||
vti_timelastmodified:TR|17 Aug 2013 23:32:35 -0000
|
||||
vti_extenderversion:SR|12.0.0.0
|
||||
vti_cacheddtm:TX|17 Aug 2013 23:32:35 -0000
|
||||
vti_filesize:IR|400
|
||||
vti_backlinkinfo:VX|
|
||||
Reference in New Issue
Block a user