Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

question about a couple of tip jars

Simon Metalhead
Rock Star
Join date: 26 May 2003
Posts: 187
07-02-2005 06:50
Hmm alright.. i have a couple of donation/tip jar type scripts... i was wondering if there's a way to modify the code so rather than the money going to the owner, it will go to a designated person instead. Either someone listed in a notecard or editted into the script. The tip jar/donation text will show as the person the money is going to and not me, the owner. I'll post the 2 script codes below, the ones i was thinking of using. Any help would be greatly appreciated, thanks in advance :D

The simple one... donation script but i guess it's the same thing:
CODE

integer totaldonated;
string owner;

default
{
on_rez( integer sparam )
{
llResetScript();
}
state_entry()
{
owner = llKey2Name( llGetOwner() );
llSetText( owner + "'s donation hat.\nDonate if you are so inclined!\n$0 Donated so far",<1,1,1>,1);
}

money(key id, integer amount)
{
totaldonated+=amount;
llSetText( owner + "'s donation hat.\nDonate if you are so inclined!\n$" + (string)amount + " Donated so far",<1,1,1>,1);
llInstantMessage(id,"Thanks for the tip!");
llInstantMessage(llGetOwner(),llKey2Name(id)+" donated $" + (string)amount);
}
}


The split tip/donation one... Haven't tried this one yet but i guess I guess it could be useful:
CODE

key partnerskey = "00000000-0000-0000-0000-000000000000"; //INSERT YOUR PARTNER'S KEY HERE, CAN BE FOUND USING llDetectedKey()
string thankyou = "Thank you for the tip."; //THIS IS THE MESSAGE TO THE PERSON WHO TIPS YOU

default
{
state_entry() //START OF SCRIPT WILL ASK YOU FOR PERMISSION TO DEBIT THIS ALLOWS YOU TO PAY YOUR PARTNER.
{
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT );
}

money(key id, integer amount) //THE MONEY EVENT IS TRIGGERED WHEN SOMEONE PAYS THE OBJECT. YOU WILL FIRST GET THE FULL AMOUNT OF THE TIP THEN YOU WILL PAY HALF OF IT TO YOUR PARTNER
{
llInstantMessage(id, thankyou); //IM THANKYOU TO THE PERSON WHO TIPPED
integer roughlyhalf = amount / 2; //DIVIDED THE AMOUNT THAT WAS PAID BY TWO, IF VALUE HAS A DECIMAL PLACE IT WILL BE DROPPED SO. IE: "2.5" WOULD BE JUST "2"
llGiveMoney(partnerskey,roughlyhalf); //OWNER PAYS PARTNER HALF. IF TIP IS AN ODD AMOUNT YOU WILL GET THE EXTRA L$1
llInstantMessage(partnerskey, llKey2Name(id) + " paid you L$" + (string)roughlyhalf + "."); //IM YOUR PARTNER FOR WHOM THE TIP WAS FROM & THE AMOUNT
}
}
_____________________
Come visit me at Natoma (0,0)
_________________________________
Come check out www.rock66.com and sign up! We have given away lots of L$ in our SL Arcade contests! Keep an eye out for more upcoming contests!
Frans Charming
You only need one Frans
Join date: 28 Jan 2005
Posts: 1,847
07-02-2005 08:53
This should work, just quickly edited the second script. Haven't test it
CODE
key partnerskey = "00000000-0000-0000-0000-000000000000";  //INSERT YOUR PARTNER'S KEY HERE, CAN BE FOUND USING llDetectedKey() 
string thankyou = "Thank you for the tip."; //THIS IS THE MESSAGE TO THE PERSON WHO TIPS YOU

default
{
state_entry() //START OF SCRIPT WILL ASK YOU FOR PERMISSION TO DEBIT THIS ALLOWS YOU TO PAY YOUR PARTNER.
{
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT );
}

money(key id, integer amount) //THE MONEY EVENT IS TRIGGERED WHEN SOMEONE PAYS THE OBJECT. YOU WILL FIRST GET THE FULL AMOUNT OF THE TIP THEN YOU WILL PAY ALL OF IT TO YOUR PARTNER
{
llInstantMessage(id, thankyou); //IM THANKYOU TO THE PERSON WHO TIPPED
llGiveMoney(partnerskey,amount); //OWNER PAYS PARTNER.
llInstantMessage(partnerskey, llKey2Name(id) + " paid you L$" + (string)amount + "."); //IM YOUR PARTNER FOR WHOM THE TIP WAS FROM & THE AMOUNT
}
}