Rolig Loon Posted March 6, 2011 Share Posted March 6, 2011 If you want to divide the income from a sale or from tips between two people, you need a Split Pay Vendor. Here's one way to do it. This one will give everything in its inventory (except this script) to the buyer and will then direct half of the purchase price to the avatar that you identify in the gSplitKey variable at the top of the script. If there are no inventory items, it acts as a donation/tip jar. // Give Inventory List with Split payout -- Rolig Loon -- November 2010 // OWNER: Specify each of the following parameters integer gPrice = 1000; // Price of your item key gSplitKey= NULL_KEY; // UUID of the person to whom you are giving a split float gSplitPct = 0.0; // Percentage of the split (0.0 to 1.0) default { state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); } run_time_permissions(integer perm) { if (perm & PERMISSION_DEBIT) { state purchase; } } changed(integer change) { if(change & CHANGED_INVENTORY) { llResetScript(); } } } state purchase { state_entry() { llSetPayPrice(PAY_HIDE, [gPrice,PAY_HIDE,PAY_HIDE,PAY_HIDE]); llSetClickAction(CLICK_ACTION_PAY); } changed(integer change) { if(change & CHANGED_INVENTORY) { llResetScript(); } } money (key id, integer amount) { if (amount == gPrice) { list inventory; integer num = llGetInventoryNumber(INVENTORY_ALL); string script = llGetScriptName(); integer i = 0; for (; i < num; ++i) { string name = llGetInventoryName(INVENTORY_ALL, i); if(name != script) { if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY) { inventory += name; } else { llSay(0, "Don't have permissions to give you \""+name+"\"."); } } } if (llGetListLength(inventory) >= 1) { llGiveInventoryList(id, llGetObjectName(), inventory); llInstantMessage(id,"Thank you for your purchase. Your new items are now in your inventory in a folder named " +llGetObjectName()); } if (gSplitKey != NULL_KEY) { integer Payout = (integer) (amount*gSplitPct); llGiveMoney(gSplitKey,Payout); } } } }Updated to correct minor coding error. 3 Link to comment Share on other sites More sharing options...
Ciaran Laval Posted March 6, 2011 Share Posted March 6, 2011 I stick a permissions check in mine to make sure people have the right to sell them, lovely script though. Link to comment Share on other sites More sharing options...
Marianne McCann Posted March 9, 2011 Share Posted March 9, 2011 I gave this one a try as it pretty much fits the bill on a project I was working on, Unfortunatey, it returned an error. "Unable to give inventory list: Cannot find destination" Test included trying to sell two items in the box @ L$10, with a 0.1 split. 1 Link to comment Share on other sites More sharing options...
Void Singer Posted March 9, 2011 Share Posted March 9, 2011 llGiveInventoryList(llDetectedKey(0), llGetObjectName(), inventory); should read llGiveInventoryList( id, llGetObjectName(), inventory); 1 Link to comment Share on other sites More sharing options...
Marianne McCann Posted March 9, 2011 Share Posted March 9, 2011 That did the trick - thanks! Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 9, 2011 Author Share Posted March 9, 2011 Yup. My silly mistake. Fixed. :smileysurprised: Link to comment Share on other sites More sharing options...
Jam Mint Posted June 27, 2011 Share Posted June 27, 2011 thanks for this, will most likely use it Link to comment Share on other sites More sharing options...
Matilda Charron Posted July 29, 2012 Share Posted July 29, 2012 I there a script which will split 3 ways? Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted July 29, 2012 Share Posted July 29, 2012 I moddes Rolig's script into a multi-split vendor. You can now specify as many splits as you want using the two lists at the top of the script. I also added a refund, if the wrong amount is payed. It's untested. // Give Inventory List with Split payout -- Rolig Loon -- November 2010//Tweaked into multi split by Dakie Minotaur, July 2012// OWNER: Specify each of the following parametersinteger gPrice = 1000; // Price of your itemlist gSplitKeys= []; // list of UUIDs of the persons to whom you are giving a splitlist gSplitPct = []; // list of percentages of the splits (0.0 to 1.0); each percentsge corresponds to a person at the same position in the list//global variables not to be touchedinteger giSplitOn;default{ state_entry() { //added by DM check the persentages and the list of keys if (llGetListLength(gSplitKeys)) { giSplitOn = 1; if (llGetListLength(gSplitKeys) != llGetListLength(gSplitPct)) { llOwnerSay("The number of receivers of a split and the number of percentages " + "do not correspond. Splitting will be turned of."); giSplitOn = 0; } else { integer i; float splitsSum; for (i = 0; i < llGetListLength(gSplitPct); i++) { splitsSum += llList2Float(gSplitPct, i); } if (splitsSum > 1.0) { llOwnerSay("The total of the splits is greater than 1. Splitting will be turned of."); giSplitOn = 0; } } } if (giSplitOn) { llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); } else { state purchase; } } run_time_permissions(integer perm) { if (perm & PERMISSION_DEBIT) { state purchase; } } changed(integer change) { if(change & CHANGED_INVENTORY) { llResetScript(); } }}state purchase{ state_entry() { llSetPayPrice(PAY_HIDE, [gPrice,PAY_HIDE,PAY_HIDE,PAY_HIDE]); llSetClickAction(CLICK_ACTION_PAY); } changed(integer change) { if(change & CHANGED_INVENTORY) { llResetScript(); } } money (key id, integer amount) { if (amount == gPrice) { list inventory; integer num = llGetInventoryNumber(INVENTORY_ALL); string script = llGetScriptName(); integer i = 0; for (; i < num; ++i) { string name = llGetInventoryName(INVENTORY_ALL, i); if(name != script) { if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY) { inventory += name; } else { llSay(0, "Don't have permissions to give you \""+name+"\"."); } } } if (llGetListLength(inventory) >= 1) { llGiveInventoryList(id, llGetObjectName(), inventory); llInstantMessage(id,"Thank you for your purchase. Your new items are now in your inventory in a folder named " +llGetObjectName()); } if (giSplitOn) { for (i = 0; i < llGetListLength(gSplitKeys); i++) { integer Payout = (integer) (amount*llList2Float(gSplitPct, i)); llGiveMoney(llList2Key(gSplitKeys, i),Payout); } } } else { llGiveMoney(id,amount); llInstantMessage(id,"The amount payed does not equal the price of the merchandise (" + (string)gPrice + " L$)"); } }} 1 Link to comment Share on other sites More sharing options...
Matilda Charron Posted July 29, 2012 Share Posted July 29, 2012 thank you for that script, how do I display the multiple avi keys, I think it is rejecting the hyphen in the key, do I put square bracklets around each key with comma between and is this the same for the break up percentage Link to comment Share on other sites More sharing options...
Darkie Minotaur Posted July 29, 2012 Share Posted July 29, 2012 Keysare teated like strings in that respect - the list would look like ["00000000-0000-0000-0000-000000000000", "11111111-1111-1111-1111-111111111111"] 1 Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 29, 2012 Author Share Posted July 29, 2012 It's just a normal list..... list list_of_keys = [ "first key","second key","third key","and so on"]; 1 Link to comment Share on other sites More sharing options...
Matilda Charron Posted July 30, 2012 Share Posted July 30, 2012 thank you for that, I did figure it out, I do have trouble logging into the site hence the delay, I found the script works for two so far, I have changed the amount and I still get the previous amount showing, I have reset scripts, checked the General Tab was not set, not sure why it does not update to the new price Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 30, 2012 Author Share Posted July 30, 2012 That's odd. I tested it myself just now and Darkie's version works fine. I changed the price three times just to be sure. When you change the price, be sure that you simply change that one number in the line that says integer gPrice = 1000; // Price of your item Don't change anything else, including the punctuation.You don't have to Reset the script. When you click Save, it does that automatically. BTW, it shouldn't make any difference how the click action is set on the General page of your Edit tool. The script resets it to CLICK_ACTION_PAY anyway. 1 Link to comment Share on other sites More sharing options...
Matilda Charron Posted July 30, 2012 Share Posted July 30, 2012 ok I just tried it in one prim and the price changes, I was hoping to be able to use it in furniture but it seems it has to be in the root prim for the price to change, I wanted ease of use for visitor to sit /use menus but to pay the back of the chair which is not the root prim Link to comment Share on other sites More sharing options...
Rolig Loon Posted July 30, 2012 Author Share Posted July 30, 2012 That's true. If you look in the LSL wiki, you'll find the advice that "This function [llSetPayPrice] only works when called from the root prim of an object. Its effect applies to all the prims in the object. Calling it from a child prim has no effect." You really have only that one choice: put the script in the root prim. There are several ways to modify the script to make it accept payment only if you click on the back of the chair. Unfortunately, though, they will each involve forcing the user to touch the chair twice... once to activate the section of the script labeled state running, and a second time to open the PAY window and request payment. Otherwise, because the script is normally in state running when a user finds it, a touch anywhere opens that PAY window. Link to comment Share on other sites More sharing options...
GaboNux Posted August 4, 2012 Share Posted August 4, 2012 Here my modest improvement. // Give Inventory List with Split payout -- Rolig Loon -- November 2010//Tweaked into multi split by Dakie Minotaur, July 2012// Added a sales report to owner via IM with the store, product, amount and buyer's identification. (Put in the object's Desc the store's name or its identificator). by Gabonux Resident - August 2012// OWNER: Specify each of the following parametersinteger gPrice = 1; // Price of your itemlist gSplitKeys= []; // list of UUIDs of the persons to whom you are giving a splitlist gSplitPct = []; // list of percentages of the splits (0.0 to 1.0); each percentsge corresponds to a person at the same position in the list//global variables not to be touchedinteger giSplitOn;string mStore;key owner;default{ state_entry() { // added by Gabonux owner=llGetOwner(); mStore = llGetObjectDesc(); //added by DM check the persentages and the list of keys if (llGetListLength(gSplitKeys)) { giSplitOn = 1; if (llGetListLength(gSplitKeys) != llGetListLength(gSplitPct)) { llOwnerSay("The number of receivers of a split and the number of percentages " + "do not correspond. Splitting will be turned of."); giSplitOn = 0; } else { integer i; float splitsSum; for (i = 0; i < llGetListLength(gSplitPct); i++) { splitsSum += llList2Float(gSplitPct, i); } if (splitsSum > 1.0) { llOwnerSay("The total of the splits is greater than 1. Splitting will be turned of."); giSplitOn = 0; } } } if (giSplitOn) { llRequestPermissions(llGetOwner(),PERMISSION_DEBIT); } else { state purchase; } } run_time_permissions(integer perm) { if (perm & PERMISSION_DEBIT) { state purchase; } } changed(integer change) { if(change & CHANGED_INVENTORY) { llResetScript(); } }}state purchase{ state_entry() { llSetPayPrice(PAY_HIDE, [gPrice,PAY_HIDE,PAY_HIDE,PAY_HIDE]); llSetClickAction(CLICK_ACTION_PAY); } changed(integer change) { if(change & CHANGED_INVENTORY) { llResetScript(); } } money (key id, integer amount) { if (amount == gPrice) { list inventory; integer num = llGetInventoryNumber(INVENTORY_ALL); string script = llGetScriptName(); integer i = 0; for (; i < num; ++i) { string name = llGetInventoryName(INVENTORY_ALL, i); if(name != script) { if(llGetInventoryPermMask(name, MASK_OWNER) & PERM_COPY) { inventory += name; } else { llSay(0, "Don't have permissions to give you \""+name+"\"."); } } } if (llGetListLength(inventory) >= 1) { llGiveInventoryList(id, llGetObjectName(), inventory); llInstantMessage(id, llKey2Name(id) +" Thank you for your purchase. Your new items are now in your inventory in a folder named " +llGetObjectName()); // added by Gabonux llInstantMessage(owner,llKey2Name(id) + " has purchased a " + llGetInventoryName(INVENTORY_OBJECT,0) + " for L$" + (string)gPrice + " in " + mStore); } if (giSplitOn) { for (i = 0; i < llGetListLength(gSplitKeys); i++) { integer Payout = (integer) (amount*llList2Float(gSplitPct, i)); llGiveMoney(llList2Key(gSplitKeys, i),Payout); } } } else { llGiveMoney(id,amount); llInstantMessage(id,"The amount payed does not equal the price of the merchandise (" + (string)gPrice + " L$)"); } }} Link to comment Share on other sites More sharing options...
jbc71 Posted August 26, 2017 Share Posted August 26, 2017 (edited) Hello, This is a great script - how would you configure it so that anyone who pays into an object pays the owner say 10% (tax) of the amount they are paying? Again, thank you for this excellent script and any advice. Regards. John Edited August 26, 2017 by jbc71 Needed to turn on notify me of replies Link to comment Share on other sites More sharing options...
jbc71 Posted August 26, 2017 Share Posted August 26, 2017 Thanks again for any advice Link to comment Share on other sites More sharing options...
Rolig Loon Posted August 26, 2017 Author Share Posted August 26, 2017 6 hours ago, jbc71 said: how would you configure it so that anyone who pays into an object pays the owner say 10% (tax) of the amount they are paying? I don't understand the question. After all, when anyone pays L$ to a vendor, the entire amount goes automatically to the vendor's owner. A split payment vendor simply takes part of that amount and then sends it to someone else. Link to comment Share on other sites More sharing options...
jbc71 Posted August 27, 2017 Share Posted August 27, 2017 Okay, let me try and clarify the question - I am looking for a script that would allow me to collect the tax and not split it with anyone else. Example, object is placed on land, land owner pays into object L$200 I keep 10% - what commands do I use in the script for this please? Thanks again for you time and also reply. Link to comment Share on other sites More sharing options...
Rolig Loon Posted August 27, 2017 Author Share Posted August 27, 2017 (edited) OK, then, let me try to clarify the answer. Whoever owns a vendor always gets the entire amount of L$ that anyone deposits in it. The only way that a second person gets any L$ from it is if there is a script in the vendor (a split vendor script) that turns around and sends a part of the L$ from the vendor's owner to that second person. You could have a vendor that splits the L$ among more than two people, too. It's the same principle: whoever owns the vendor receives 100% of whatever is paid into it, and the script redistributes a portion of that total to the other people. In your case, you have not explained who owns the vendor. The landowner pays L$200 into it, the vendor pays you L$10 of that, and who gets the rest? Presumably whoever owns the vendor, but who is that? Obviously not the landowner. He's just dropping L$ into it. Also obviously not you. You want the vendor to pay you 10%. So... who owns the vendor and gets to keep the other 90%? No matter what your answer is, the solution is still the same: you create a simple split vendor -- or use this one. Give it to whoever is supposed to keep the 90% and ask that person to designate you as the recipient of the 10% split. Edited August 27, 2017 by Rolig Loon Link to comment Share on other sites More sharing options...
jbc71 Posted August 27, 2017 Share Posted August 27, 2017 Hello, the land owner owns the object - the rest of the money is used for payout or reward. thanks. Link to comment Share on other sites More sharing options...
Darrius Gothly Posted August 27, 2017 Share Posted August 27, 2017 Let me see if I have this right. Please correct any mistakes in understanding: Land Owner pays Object some amount of money (example: L$200) Object sends you 10% of the amount paid by Land Owner (example: L$20) Object records that 90% of the amount paid is now available for Payouts and Rewards (example: L$180) At some time in the future the Land Owner can command the Object to send some amount of L$ to a 3rd party recipient. For example as an award or some sort of incentive payout. The purpose isn't important, only that the Land Owner can command the Object to send money to someone else .. but only if that amount is in the "Payouts and Rewards" account. That "Payouts and Rewards" account is nothing more than a balance sheet that remembers how much was "deposited" .. and thus will only allow paying out from the current balance of the "Payouts and Rewards" account. In truth the money is going to come from the Land Owner's L$ balance .. because Objects don't have L$ balances or accounts. When the Land Owner "pays" the Object, the money is withdrawn from their account .. and immediately put right back in. The script in the Object though will immediately send you 10% of that amount and then credit the "Payouts and Rewards" account balance with 90% of the amount paid. It would really be a LOT easier to just have the Land Owner enter an amount via Prompt Box and not actually "Pay" anything. The script could then just send you 10% of whatever amount the Land Owner entered and record 90% of that amount as a credit to the "Payouts and Rewards" account. Link to comment Share on other sites More sharing options...
Rolig Loon Posted August 27, 2017 Author Share Posted August 27, 2017 9 minutes ago, Darrius Gothly said: It would really be a LOT easier to just have the Land Owner enter an amount via Prompt Box and not actually "Pay" anything. The script could then just send you 10% of whatever amount the Land Owner entered and record 90% of that amount as a credit to the "Payouts and Rewards" account. Exactly. You don't need any kind of split payment vendor if that's the case. Just a simple vendor that owned by the "Payouts and Rewards" group. The landlord drops L$200 into it and the vendor sends you L$20. Since a group can't have an account, the remaining L$180 is distributed among group members who have the "ability" to share group assets. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now