Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking for simple share payment script

crucial Armitage
Clothing Designer
Join date: 30 Aug 2004
Posts: 838
10-12-2005 22:01
i need a simple script that will share the payment to a prim with another resident when payment is made to the prim.

thanks
crucial
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
10-12-2005 22:21
CODE
float percent = 0.5 // Percentage of amount chared with partner. Represented as a decimal, where 1.0 = 100%
key partner = "53d5c241-af3e-4501-bcb8-87c2dbf9ddbe"; // The key of your partner. (Currently mine. You'll be wanting to change this ^.^ )

default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

on_rez(integer n)
{
llResetScript();
}

run_time_permissions(integer p)
{
if ( p & PERMISSION_DEBIT )
{
state running;
}
else
{
state stopped;
}
}
}

state running
{
state_entry()
{
llWhisper(0, "Ready!");
}

on_rez(integer n)
{
llResetScript();
}

money(key payer, integer amt)
{
llGiveMoney(partner, llRound((float)amt * percent));
}
}

state stopped
{
state_entry()
{
llWhisper(0, "Halted! I require debit perms to work!");
}

on_rez(integer n)
{
llResetScript();
}

touch_start(integer n)
{
if ( llDetectedKey(0) == llGetOwner() ) llResetScript();
}
}


and to get a person's key, use this, or:
CODE
default
{
touch_start(integer n)
{
llSay(0, (string)llDetectedKey(0) );
}
}
And have your victi... I mean, partner touch the prim it's in.
_____________________
Ushuaia Tokugawa
Nobody of Consequence
Join date: 22 Mar 2005
Posts: 268
10-12-2005 22:29
Jillian beat me to it :) but if I may offer one suggestion:

In the money event, you should check for a zero value, or else the object will spam "Invalid parameter in llGiveMoney()" into chat.

CODE

money(key payer, integer amt)
{
integer share = llRound((float)amt * percent);

if (share) llGiveMoney(partner, share);
}


( This would occur if you set the percentage to below 0.50 and payed the object L$1 )
_____________________
crucial Armitage
Clothing Designer
Join date: 30 Aug 2004
Posts: 838
10-12-2005 22:43
thank you both for your help much appreciated :)

edit one question can i have the partner touch the prim and I then take a copy of it and then place that copy out in multiple locations and it still work right.

i know i can do this with the rentos i use witch i share payment with but never used a share payment script in a prim before where i was selling something
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
10-12-2005 23:29
FYI: Either Apotheus Silverman or Cubey Terra posted a full-featured vendor script that does these things.
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
10-13-2005 06:52
From: Huns Valen
FYI: Either Apotheus Silverman or Cubey Terra posted a full-featured vendor script that does these things.
'twas Apotheus, and it can be found here. Is good shtuff!
_____________________