Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Tip Jar Question

Pudding Parx
Registered User
Join date: 17 Jul 2008
Posts: 5
09-27-2008 09:55
Hi, I'm using the following Tip Jar script, but how or where do I edit it to change it so it pays someone else (another avatar key) and not me because I own the object?

integer pot;
integer amount;
integer total;
key tid;
string ownername;

init()
{
ownername = llKey2Name( llGetOwner());
llSetText( "Pudding Parx",<1,1,1>,1);
llOwnerSay ( "Tip jar for" + " Pudding Parx " + "ready..." );
}

default
{
state_entry()
{
init();
}
on_rez( integer param )
{
init();
}
touch_start( integer num )
{
llInstantMessage( llDetectedKey(0),"Tip Pudding, she deserve's it";);
}
money( key id, integer payment )
{
amount = payment;
tid = id;
llRequestAgentData( id, DATA_NAME );
}
dataserver( key query, string name )
{
llSay( 0, "Thanks " + llGetSubString( name, 0, llSubStringIndex( name, " " )) );
if ( llGetInventoryNumber( INVENTORY_SOUND ) > 0 )
{
llPlaySound( llGetInventoryName( INVENTORY_SOUND, 0 ),1 );
}
if ( llGetInventoryNumber( INVENTORY_TEXTURE ) > 0 )
{
llGiveInventory( tid,llGetInventoryName( INVENTORY_TEXTURE,0 ));
}
total = total + amount;
llSetText( "Tips so far : \n" + (string)total +"L$" , <1,1,1>,1);
}
}
Ravanne Sullivan
Pole Dancer Extraordinair
Join date: 10 Dec 2005
Posts: 674
09-27-2008 10:16
A pay event will always pay you as the owner. If you want all or part of the tip to go to another person you need to put in a llGiveMoney() to send the payment to them.


money( key id, integer payment )
{
amount = payment;
tid = id;

llGiveMoney("UUID of other person", amount);
// Send tip payment to another person, change amount if you do not wish to send it all to them.

llRequestAgentData( id, DATA_NAME );
}
_____________________
Ravanne's Dance Poles and Animations

Available at my Superstore and Showroom on Insula de Somni
http://slurl.com/secondlife/Insula de Somni/94/194/27/
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
Like this.
09-27-2008 13:08
The tipper gives the money to the owner of the tipjar.
In order to forward the money to someone else you have to first grant the tipjar permission to take your money.

I've changed the script to do just that.

From: someone


integer pot;
integer amount;
integer total;
key tid;
key receiver = "79f7d0f4-b17c-4188-90f9-b5621d7e32d1"; // key of avatar to which the money goes.
string ownername;

init()
{
ownername = llKey2Name( llGetOwner());
llSetText( "Pudding Parx",<1,1,1>,1);
llOwnerSay ( "Tip jar for" + " Pudding Parx " + "ready..." );
}

default
{
state_entry()
{
llSetText("TipJar not active. \nTouch to activate.",<.984, .686, .365>,.8);
}

run_time_permissions (integer perm)
{
if (perm == PERMISSION_DEBIT) state run;
else llOwnerSay("I need those permissions. Please touch me to try again.";);
}

touch_start(integer num_detected){
if (llDetectedKey(0) == llGetOwner()) llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
else llSay(0,"Only the owner can activate me.";);
}
}

state run
{
state_entry()
{
init();
}
on_rez( integer param )
{
llResetScript();
}
touch_start( integer num )
{
llInstantMessage( llDetectedKey(0),"Tip Pudding, she deserve's it";);
}
money( key id, integer payment )
{
amount = payment;
llGiveMoney(receiver, amount);
tid = id;
llRequestAgentData( id, DATA_NAME );
}
dataserver( key query, string name )
{
llSay( 0, "Thanks " + llGetSubString( name, 0, llSubStringIndex( name, " " )) );
if ( llGetInventoryNumber( INVENTORY_SOUND ) > 0 )
{
llPlaySound( llGetInventoryName( INVENTORY_SOUND, 0 ),1 );
}
if ( llGetInventoryNumber( INVENTORY_TEXTURE ) > 0 )
{
llGiveInventory( tid,llGetInventoryName( INVENTORY_TEXTURE,0 ));
}
total = total + amount;
llSetText( "Tips so far : \n" + (string)total +"L$" , <1,1,1>,1);
}
}



Use it wisely.