Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Array / List

Demon Lilliehook
Registered User
Join date: 8 May 2007
Posts: 25
06-26-2007 12:24
default
{
state_entry()
{
llSay(0, "Hello, Avatar!";);
}

touch_start(integer total_number)
{
llSay(0, "Touched.";);
list cookie_string = llParseString2List("fsdkjlahf||marcojkgh||dgsjkgh||gslhsjklg", ["||"], []);
llSay(0, (string)cookie_string);
llSay(0, llList2String(cookie_string, 1));

}
}

output
[12:19] MACHINE 0.1: fsdkjlahfmarcojkghdgsjkghgslhsjklg
[12:19] MACHINE 0.1: marcojkgh

llSay(0, llList2String(cookie_string, 1)); wil output
[12:19] MACHINE 0.1: marcojkgh


is there a way, how i can modify the value

for example like array[1] = "boh";



regards,

Demon
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
06-26-2007 12:35
cookie_string = llListReplaceList( cookie_string, [ "boh" ], 1, 1 );
Demon Lilliehook
Registered User
Join date: 8 May 2007
Posts: 25
find
06-26-2007 12:47
let's say, i store the name of avatars in a list.
and i want to search/compare if the avatar list ois already in the list

how do i do that?

for loop and compare each entry in the list?
if found, store the counter of the loop?
integer i == index


thanks for you reply
Pale Spectre
Registered User
Join date: 2 Sep 2005
Posts: 586
06-26-2007 12:52
All of the list functions: http://www.lslwiki.net/lslwiki/wakka.php?wakka=list

The one I think you want: http://www.lslwiki.net/lslwiki/wakka.php?wakka=llListFindList
Demon Lilliehook
Registered User
Join date: 8 May 2007
Posts: 25
thanks a again
06-26-2007 14:38
state_entry() {
list src = ["The", "Quick", "Brown", "Fox", "Jumped", "Over", "The", "Lazy", "Dog"];
list test;

test = ["Brown"]; // What we want to find.
integer foxColorIndex = llListFindList(src, test); // Returns 2.
llOwnerSay((string)foxColorIndex);

llOwnerSay( llList2String(src, foxColorIndex)); // returns Brown.

if i want to change 'Brown' into something else,
how it's done?


regards
RJ Source
Green Sky Labs
Join date: 10 Jan 2007
Posts: 272
06-26-2007 14:51
From: Demon Lilliehook
state_entry() {
list src = ["The", "Quick", "Brown", "Fox", "Jumped", "Over", "The", "Lazy", "Dog"];
list test;

test = ["Brown"]; // What we want to find.
integer foxColorIndex = llListFindList(src, test); // Returns 2.
llOwnerSay((string)foxColorIndex);

llOwnerSay( llList2String(src, foxColorIndex)); // returns Brown.

if i want to change 'Brown' into something else,
how it's done?


regards


src = llListReplaceList(src, ["SomethingElse"], foxColorIndex, foxColorIndex);
Demon Lilliehook
Registered User
Join date: 8 May 2007
Posts: 25
woh
06-26-2007 15:25
thank u guys.

i do watch the lslwiki everyday x times and x windows.

but there are things, i just can't understand.

that why i asked here.
thank u all.


now i tried this
list DeleteSubListStrided(list src, integer start, integer end, integer stride) {
return llDeleteSubList(src, start * stride, (end * stride) + stride - 1);
}

visitors = DeleteSubListStrided(visitors, 0, 0, STRIDELENGTH);


how do i remove a entry from the list.

and what happens to the list.

wil all remaining entries, after the deleted entry, move 1 place forward?


regards
Demon Lilliehook
Registered User
Join date: 8 May 2007
Posts: 25
06-26-2007 22:42
how do i remove an entry in my list?

thank you for viewing my threath.
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
06-26-2007 23:40
if i want to remove 2...
CODE


list bob = [1,2,3,4];

default
{
state_entry()
{
bob = llDeleteSubList(bob, 1, 1);
}
}
CODE


the list now looks like [1,3,4]