I run a private park on one of my islands with a theatre, games and the works. There is a tip jar out that collects 10L donations from group members that choose to leave one and records a list of the donators , and every few weeks is use the following script to draw the name of one of the donators out of the hat and that person gets to pick the next game/item/etc that we add to the island from a list. If there is enough money left we click and pick again and so on.
My problem is the tenants are very good people and have started making a game of donating and I am afraid after one of thier parties the list im using may run out of script memory and some of the data could get lost. I know you can split up this sort of thing into multiple lists but i cant figure out how to do it and still have it pick at random from the whole list when it comes time to get the name.
any help on this would be greatly appreciated
THanks!
this is the list portion of my script theres a bunch of other junk like email notifications when people tip and stuff i didn't paiste in here for the sake of anti clutter
CODE
integer price = 10;
list contributors = [];
integer CL;
integer count;
key winner;
default
{
state_entry()
{
//Request permissions to debit owner's account.
llSetPayPrice(PAY_HIDE, [price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
run_time_permissions(integer perms)
{
if(perms & PERMISSION_DEBIT)
}
else
{//Permissions was denied.
state idol;
}
}
touch_start(integer num_detected)
{
CL = llGetListLength(contributors);
count = llRound(llFrand(CL));
winner = (key)llList2String(contributors,count);
llSay(0,"The winner is" + (string)winner + ".");
contributors = llDeleteSubList(contributors,count,count);
}
money(key tipper, integer amount)
{
if(amount == price)
{ //if amount is paid thank the person and add to list
llInstantMessage(tipper, "Thank you for your Donation!");
contributors = contributors + [llKey2Name(tipper)];
}
}