Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Lottery Event_Lottery_Script_by  

Event_Lottery_Script_by

Event Lottery Script by Ama Omega.lsl

Category: Lottery
By : Ama Omega
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Event_Lottery_Script_by
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Event_Lottery_Script_by_Ama_Omega_1.lsl
1
2 // Event Lottery Script by Ama Omega
3 //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.
4
5
6 list names;
7 integer i;
8 integer j;
9 integer count;
10 string name;
11
12 integer find(string name)
13 {
14 for (i=0;i<count;i++)
15 if(llList2String(names,i) == name)
16 return i;
17 return -1;
18 }
19
20 default
21 {
23 {
24 llListen(0,"",llGetOwner(),"Find Winner");
25 count = 0;
26 }
27
28 touch_start(integer total_number)
29 {
30 for (j=0;j<total_number;j++)
31 {
32 if(find(llDetectedName(j)) == -1)
33 {
34 name = llDetectedName(j);
35 names += name;
36 llSay(0,name + " has been entered.");
37 count++;
38 }
39 }
40 }
41
42 listen(integer chan, string name, key id, string mes)
43 {
44 names = llListRandomize(names,1);
45 i = llFloor(llFrand(llGetListLength(names)));
46 llWhisper(0,"And the Winner is " + llList2String(names,i) +
47 "! There were " + (string)count + " participants.");
48 llDeleteSubList(names,i,i);
49 }
50 }// END //

Back to the Best Free Tools in Second Life and OpenSim.