Home |
Add a script
|
||
|---|---|---|---|
| Category: | Contributor: | Description | |
| Lottery | Ama Omega | Event Lottery Script by Ama Omega.lsl | |
Event Lottery Script by Ama Omega.lsl
Event Lottery Script by Ama Omega.lsl
Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.
1 // CATEGORY:Lottery 2 // DESCRIPTION:Event Lottery Script by Ama Omega.lsl 3 // ARCHIVED BY:Ferd Frederix 4 5 // Event Lottery Script by Ama Omega 6 //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. 7 8 9 list names; 10 integer i; 11 integer j; 12 integer count; 13 string name; 14 16 { 17 for (i=0;i<count;i++) 18 if (llList2String(names,i) == name) 19 return i; 20 return -1; 21 } 22 23 default 24 { 25 state_entry() 26 { 27 llListen(0,"",llGetOwner(),"Find Winner"); 28 count = 0; 29 } 30 31 touch_start(integer total_number) 32 { 33 for (j=0;j<total_number;j++) 34 { 35 if (find(llDetectedName(j)) == -1) 36 { 37 name = llDetectedName(j); 38 names += name; 39 llSay(0,name + " has been entered."); 40 count++; 41 } 42 } 43 } 44 46 { 47 names = llListRandomize(names,1); 49 llWhisper(0,"And the Winner is " + llList2String(names,i) + 50 "! There were " + (string)count + " participants."); 51 llDeleteSubList(names,i,i); 52 } 53 }// END //