Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How to remove a list entry...

Johnny Comet
Registered User
Join date: 16 Apr 2007
Posts: 43
08-25-2007 13:14
Hi,

Here is part of a script i'm working on...

{
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
i = llFloor(llFrand(llGetListLength(names)));
llWhisper(0,"The Grand Prize Winner Is... " + llList2String(names,i));
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
i = llFloor(llFrand(llGetListLength(names)));
llWhisper(0,"The Second Prize Winner Is... " + llList2String(names,i) +
"!";);
llWhisper(0,"There were " + (string)count + " participants.";);
names = llDeleteSubList(names, i, i);;
}
}

In between drawing first and second prize i want it to remove the first prize winner from the list so the same person can't get both prizes, tried a few variations but i'm new to lsl and can't seem to get it to successfully remove the entry.. any ideas? (i figure i'm missing something simple!)
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
08-25-2007 13:31
your probably putting too much thought into this

what i would do is upon a new draw, randomize the list and just get the first element

then you can remove it by llDeleteSubList(names,0,0);

oh and you have 2 ;'s after your delete line
Johnny Comet
Registered User
Join date: 16 Apr 2007
Posts: 43
08-25-2007 13:58
From: Osgeld Barmy
your probably putting too much thought into this

what i would do is upon a new draw, randomize the list and just get the first element

then you can remove it by llDeleteSubList(names,0,0);

oh and you have 2 ;'s after your delete line


Cool, thanks for that ended up with this code working just as i wanted it too....

{
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
i = llFloor(llFrand(llGetListLength(names)));
llWhisper(0,"The Grand Prize Winner Is... " + llList2String(names,i));
names = llDeleteSubList(names,0,0);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
names = llListRandomize(names,1);
i = llFloor(llFrand(llGetListLength(names)));
llWhisper(0,"The Second Prize Winner Is... " + llList2String(names,i) +
"!";);
llWhisper(0,"There were " + (string)count + " participants.";);
names = llDeleteSubList(names, i, i);
count = 0;
}
}

I noticed the double ; just as i posted, also realized i forgot to reset the entrant counter :)

Thanks again!