Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llListReplaceList

Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
09-17-2005 08:48
I've used this command hundreds of times; but now suddenly I can't get it to work. I'm sure it's some simple detail, that my brains is over looking. Yes, I've read the wiki. Any help would be apresheated.
CODE
default
{
state_entry()
{
list test = [0,0,0,0];
llListReplaceList( test, [1], 1, 0 );
llOwnerSay( (string)test );
}
}

I expect the out put to be 'Object: 0100'
but I get 'Object: 0000'
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
09-17-2005 09:11
You can't typecast from a list to a string... At least, you couldn't the last time I checked.


You probably want something like this:
CODE

default
{
state_entry()
{
list test = [0,0,0,0];
llListReplaceList( test, [1], 1, 1 );
llOwnerSay( "["+llDumpList2String( test, ", ")+"]" );
}
}

From the wiki:
"list llListReplaceList(list dest, list src, integer start, integer end)

Returns a list replacing the slice of the list dest from start to end with the list src. start and end are inclusive, so 0, – 1 would replace the entire list and 0, 0 would replace the first list entry."
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
09-17-2005 09:32
*sighs*

You have to remember to store the result.
CODE

default
{
state_entry()
{
list test = [0,0,0,0];
test = llListReplaceList( test, [1], 1, 1 );
llOwnerSay( "["+llList2CSV( test )+"]" );
}
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
09-17-2005 10:10
rofl the funtion won't let you set a value. I figured it out.
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
09-17-2005 10:37
Woops, forgot about that XD
Kurt Zidane
Just Human
Join date: 1 Apr 2004
Posts: 636
09-17-2005 12:46
I needed to change "llListReplaceList( test, [1], 1, 0 );" to "llListReplaceList( test, [1], 1, 1 );" now here's the fun part. it won't work in one script but the other it dose. lol

CODE
list addKey ( list inPut )
{
list outPut = inPut;
integer max = llGetListLength(inPut);

integer counter = -1;
while ( ++counter < max )
{
llListReplaceList( outPut, [0], counter, counter );
}

return putPut;
}