Ama Omega
Lost Wanderer
Join date: 11 Dec 2002
Posts: 1,770
|
09-19-2003 11:35
This is a simple script for randomly awarding money to event attendies. Everyone who wishes to enter simply clicks the object the script is on. To find a winner the owner of the object says 'Find Winner'. This can be repeated as often as needed to find as many winners as possible. After a name has 'won' it is removed from the pool. This is a simple script. list names; integer i; integer j; integer count; string name;
integer find(string name) { for (i=0;i<count;i++) if (llList2String(names,i) == name) return i; return -1; }
default { state_entry() { llListen(0,"",llGetOwner(),"Find Winner"); count = 0; }
touch_start(integer total_number) { for (j=0;j<total_number;j++) { if (find(llDetectedName(j)) == -1) { name = llDetectedName(j); names += name; llSay(0,name + " has been entered."); count++; } } } listen(integer chan, string name, key id, string mes) { names = llListRandomize(names,1); i = llFloor(llFrand(llGetListLength(names))); llWhisper(0,"And the Winner is " + llList2String(names,i) + "! There were " + (string)count + " participants."); llDeleteSubList(names,i,i); } }
|
Floyd Gilmour
Registered User
Join date: 5 Jul 2006
Posts: 149
|
07-07-2006 15:40
Is there any way to make it only give out a certain percentage of the pot? For example 80% given to winner, 20% to the object owner?
|
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
|
Discussion Thread
07-08-2006 08:44
_____________________
i've got nothing. 
|