Charity Donation Box Script

Date 2010/5/12 2:20:00 | Topic: Money

All money paid into Donation Box is paid to a specific avatar set in script.
Change the avatar key at top of script. This avatar will be sent all money paid. Use AV Key Finder to get key.

Set the script to No Modify before giving it to others so they cannot change key.

To get the basic Donation Box script, go here.

// 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_rezinteger 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_rezinteger sparam )
    {
        
llResetScript();
    }

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

    
money(key idinteger amount)
    {
        
totaldonated totaldonated amount;
        
llSetText(floattext "\nL$" + (string)totaldonated " Donated so far",<1,1,1>,1);
        
llGiveMoney(thereceiveramount);
        
llInstantMessage(idthanks);
    }
}




This script comes from Alicia Stella Design - Best Tip Jars in Second Life
http://www.aliciastella.com

The URL for this script is:
http://www.aliciastella.com/modules/AMS/article.php?storyid=44