Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sploder? Script

Noah Aero
Registered User
Join date: 15 May 2007
Posts: 11
05-15-2007 21:17
Before I start to code my own Sploder from scratch, I was wondering if anyone has ever seen a basic Sploder script posted somewhere, able to take the cash from gamblers and randomly select and pay top winners when enough players have participated.

Thanks so much!
Gordon Wendt
404 - User not found
Join date: 10 May 2006
Posts: 1,024
05-15-2007 21:48
For a lot of it you'll have to code yourself probably but a good starting point is probably this from the this page on the LSL Wiki.

CODE


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.");
names = llDeleteSubList(names,i,i);
}
}

_____________________
Twitter: http://www.twitter.com/GWendt
Plurk: http://www.plurk.com/GordonWendt

GW Designs: XStreetSL

Noah Aero
Registered User
Join date: 15 May 2007
Posts: 11
05-16-2007 09:13
Thanks, that will help me a tad!