Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Communist Tip Ball

Deight Boccara
Join date: 24 Sep 2005
Posts: 10
11-27-2005 14:49
This tip ball, instead of paying the owner a tip, will split the tip up amongst the people in the room and pay them all equally. Since this is a very silly idea that will never be practially used, I'm making this public domain


// By Deight Boccara and in the public domain!
// latest version at http://forums.secondlife.com/showthread.php?t=74060
// don't forget to IM Deight any cool improvements!

// these variables are set by the money event so the sensor event can use them
integer m_amount;
key m_giver;

// when you start this script
// make sure you have permissions! please say "yes" to the dialog that pops up!

// make sure the communist tip ball is communist. feel free to do whatever you want in this bit without fear!
llSetText("Communist Tip Ball!", <1,0,0>, .75); // set the red "Communist Tip Ball" text
llTargetOmega(<0,0,1>,PI/2,1.0); // spin the ball; PI is the speed
llSetPrimitiveParams([PRIM_TEXTURE, 0, "182aed21-dae0-bbf4-d24e-fb342c30adcf", <4,1,0>, <0,0,0>, 3*PI/2]); // Set the texture

// when people pay the tip ball...
money(key giver, integer amount)
// make sure the sensor event can see these variables, and then...
m_amount = amount;
m_giver = giver;

// start the sensor event. 96 here determines how big--in meters--the influence of communism is
llSensor("", NULL_KEY, AGENT, 96, PI);

sensor(integer number)
// find out how much everyone gets equally, then count what's left
integer pay = m_amount / number; // (if splitting 52 dollars between 12 people, everyone gets minimum of $4)
integer overflow = m_amount - (pay * number); // (this leaves 4 dollars to give out)

// acknowledge whoever tipped the ball
llShout(0, "Thanks to " + llKey2Name(m_giver) + ", " + (string)(number) +
" people split L$" + (string)(m_amount) + "!");

// if someone paid enough money to split equally among the crowd...
if (pay > 0)
// first wave of payment--everyone gets what's determined in "pay" above
integer i;
for (i = 0; i < number; i++)
llGiveMoney(llDetectedKey(i), pay);

// second wave--randomly choose people to get $1 until we pay the "overflow" amount
for (i = 0; i < overflow; i++)
llGiveMoney(llDetectedKey((integer)(llFrand(number))), 1);

// if someone didn't pay enough to split equally
// randomly choose people to get $1 until whatever they paid is given out
integer i;
for (i = 0; i < m_amount; i++)
llGiveMoney(llDetectedKey((integer)(llFrand(number))), 1);

// if no one is around. I really highly doubt this will ever need to be called.
llGiveMoney(m_giver, m_amount);
llDialog(m_giver, "Man, noone is here!", [], 42);
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Discussion Thread
11-27-2005 21:21
i've got nothing. ;)
Chilly Charlton
Registered User
Join date: 15 Jun 2004
Posts: 483
This script ROCKS!
12-04-2005 13:26
Thanks Deight ... everyone at Extreme is totally loving your communist Tip Ball!!! It ROCKS!
Susann Yao
Registered User
Join date: 31 Jan 2007
Posts: 0
02-21-2007 09:41

is it silly? it is a nice piece of code and I know at least one Cli using it and it is not only placed where, it is also used, nearly everytime i am where, i get around 3 or 4 times money out of this ball...

I think it is a good idea for making ppl stay where what are active playing and not just camping....so its even better when camping what means stressing the grid and paying ppl for not playing the game....
Even more generous it is what this code is spent to the community