Jump to content

Help can't figure out how to script to add a pay percentage to partner to my pay script


nynaeveakara

Recommended Posts

I don't want the vendor part.

 

I want this to sent 50% to another person.

 

default
{
state_entry()
{
llSetPayPrice(PAY_DEFAULT, [05,10,20,25]) ;
}

money(key giver, integer amount)
{
llSay(0, "Thank you, " + llKey2Name(giver) + " for your payment!");
if (llKey2Name(llGetOwner()) != "")
{
llInstantMessage(llGetOwner(), llKey2Name(giver) + " just paid L$" + (string)amount);

}
}
}

Link to comment
Share on other sites

You need to use the very last condition in the money event in the example to which Rolig directed you.

 

	money(key giver, integer amount)	{		if (gSplitKey != NULL_KEY)		{			integer Payout = (integer) (amount*gSplitPct);			llGiveMoney(gSplitKey,Payout);		}	}

 

Obviously you'll need to create a global key, gSplitKey and assign its value as your partner's uuid, and also a global float, gSplitPct, with a value of 0.5.  

I think I'd test for if (Payout) before trying to give the money, in case someone gives L$1 and it gets rounded down to 0.

Link to comment
Share on other sites

  • 8 months later...

Study the llSetPayPrice function in the LSL wiki.  What you want to do is set a default donation amount, so UNhide the pay field.  Then you can either hide all buttons or you can leave them and put suggested donation amounts on them.

        llSetPayPrice(0,[PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE]);

will give you a pay field with a default donation of L$0 and no fixed price buttons.

        llSetPayPrice(50,[PAY_HIDE,PAY_HIDE,PAY_HIDE,PAY_HIDE]);

will do the same, but set the default to L$50.  In either of those cases, the user can type in an amount of their own choice instead of accepting the default.

        llSetPayPrice(0,[50,PAY_HIDE,PAY_HIDE,PAY_HIDE]);

will give you a pay field with a default donation of L$0 and a single Quick Pay button with a suggested donation of L$50.

        llSetPayPrice(0,[50,100,250,500]);

will give you a pay field with a default donation of L$0 and four Quick Pay buttons with suggestions of L$50, L$100, L$250, and L$500.  And finally,

        llSetPayPrice(PAY_HIDE,[50, 100, 250, 500]);

will give you no write-in pay field but will give you the four buttons with suggested fixed donation levels.
 You may want to use any of those variations or something entirely different, depending on your donation strategy.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...