Second Life Copybot
multi tip jar - Printable Version

+- Second Life Copybot (https://secondlifecopybot.com)
+-- Forum: SECOND LIFE PRODUCTS (https://secondlifecopybot.com/forum-1.html)
+--- Forum: SCRIPTS (https://secondlifecopybot.com/forum-1022.html)
+---- Forum: SCRIPTS (https://secondlifecopybot.com/forum-8.html)
+----- Forum: Business Scripts (https://secondlifecopybot.com/forum-44.html)
+----- Thread: multi tip jar (/thread-612.html)



multi tip jar - steadymobbin - 02-18-2013

Touch to assign
Touch again to unassign

Touching can only be done by members of the same group that was used while placing the object. This group can also be seen in the object -> edit menu.

PHP Code:
key line1;

key keyactive;
string nameactive;

key splitwith;
integer percentage;

default
{
    
on_rez(integer param)
    {
        
llResetScript();
    }
    
    
state_entry()
    {
        
line1 llGetNotecardLine("config",0);
        
llSetText("Tip jar inactive", <1,1,1> ,1.0);
    }

    
dataserver(key queryidstring data)
    {
        if (
queryid == line1)
        {
            list 
templist llParseString2List(data, [" "],[]);
            
splitwith = (keyllList2String(templist,0);
            
percentage = (integer) llList2String(templist,1);
            
llOwnerSay("Profit will be split with: "+llKey2Name(splitwith)+". Person will receive: "+(string) percentage+"%.");
            
            
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
        }  
    }
    
    
run_time_permissions (integer perm)
    {
        if (
perm == PERMISSION_DEBIT)
        {
            
state active;  
        } else
        {
            
llOwnerSay("I need those permissions. Please reset me to try again.");
        }
    }

}

state active
{
    
on_rez(integer param)
    {
        
llResetScript();
    }
    
    
state_entry()
    {
        
llSetText("Tip jar unassigned",<1,1,1>,1.0);  
        
llSetPayPrice(PAY_HIDE, [PAY_HIDEPAY_HIDEPAY_HIDEPAY_HIDE]);
    }  
    
  
    
touch_start(integer nr)
    {
        
key toucher llDetectedKey(0);
        if (!
llSameGroup(toucher))
        {
            return;
        }
    
        if (
toucher == keyactive)
        {
            
keyactive NULL_KEY;
            
nameactive "";
            
llSetText("Tip jar unassigned",<1,1,1>,1.0);
            
llSetPayPrice(PAY_HIDE, [PAY_HIDEPAY_HIDEPAY_HIDEPAY_HIDE]);
        } else
        {
            
keyactive toucher;
            
nameactive llKey2Name(toucher);
            
llSetText(nameactive+"'s tip jar",<1,1,1>, 1.0);
            
llSetPayPrice(PAY_DEFAULT, [PAY_DEFAULTPAY_DEFAULTPAY_DEFAULTPAY_DEFAULT]);
        }

    }
    
    
money(key idinteger amount)
    {
        
integer split llRound((amount percentage) / 100);
        
integer tipreceiver amount split;
        
llGiveMoney(keyactivetipreceiver);
        
llGiveMoney(splitwithsplit);
        
        
llSay(0,"Thank you for your donation.");
    }

you need also to put a notecard in it named "config". Just put the uuid of the owner of the tip (the one who will keep the split profit)

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 10

# first line containts the key of the person to split profit with and the percentage in % seperated with a space . in this example , the % is about 10


RE: multi tip jar - ACGOMES - 06-03-2018

Thanks for the post. Was looking for it