Donation Box

Expired

default {
    money(key giver, integer amount) {
        string donor = llKey2Name(giver);
        llInstantMessage(giver, "Thank you, "+donor+", for your donation of "+(string)amount+"L$ !");
        llInstantMessage(llGetOwner(),donor + " has donated " + (string)amount + "L$ to you.");
    } 
}

 

Tip Ball

Expired

// 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;

default
{
// when you start this script
state_entry()
{
// make sure you have permissions! please say "yes" to the dialog that pops up!
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT );

// make sure the communist tip ball is communist. feel free to do whatever you want in this bit without fear!
llSetText("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 

 

Donation Box

Expired

integer totaldonated;

default
{
    on_rez( integer sparam )
    {
        llResetScript();
    }

    state_entry()
    {
        llSetText("Donation Box\nL$0 Donated so far",<1 ,1,1>,1);
    }

    money(key id, integer amount)
    {
        totaldonated = totaldonated + amount;
        llSetText("Donation Box\nL$" + (string)totaldonated + " Donated so far",<1 ,1,1>,1);
        llInstantMessage(id,"Thank you for the donation!");
    }
}

 

Charity Donation Box Script

Expired

All money paid into Donation Box is paid to a specific avatar set in script. 

Change the avatar key at top of script

 

 

// Charity Donation Box Script - by Alicia Stella
// ------------------------------------------------

/////////// SETTINGS ////////////////////
key thereceiver = "00000000-0000-0000-0000-000000000000"; //key of avatar to receive all funds
string thanks = "Thank you for the donation!";
string floattext = "Donation Box";

///////// BEGIN SCRIPT //////////////////
integer totaldonated;

default
{
    on_rez( integer sparam )
    {
        llResetScript();
    }

    state_entry()
    {
        llSetText("Waiting for Owner\nto Grant Pay Perms",<1 ,1,1>,1);
        llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
    }

    touch_start(integer total_number)
    {
        if ( llDetectedKey(0) == llGetOwner() )
        {
            llRequestPermissions(llGetOwner(),PERMISSION_DEBIT);
        }
    }


    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_DEBIT)
            state ready;
    }
}

state ready
{
    on_rez( integer sparam )
    {
        llResetScript();
    }

    state_entry()
    {
        llSetPayPrice(PAY_DEFAULT, [25, 50, 100, 500]);
        llSetText(floattext + "\nL$0 Donated so far",<1 ,1,1>,1);
    }

    money(key id, integer amount)
    {
        totaldonated = totaldonated + amount;
        llSetText(floattext + "\nL$" + (string)totaldonated + " Donated so far",<1 ,1,1>,1);
        llGiveMoney(thereceiver, amount);
        llInstantMessage(id, thanks);
    }
}