|
Sue Saintlouis
Registered User
Join date: 8 Dec 2006
Posts: 420
|
06-10-2007 13:29
Anyone has a script that, when an object is purchased, part of the purchase price goes to one avatar, and the other part goes to another?
|
|
gonkerplumb Flanagan
Landscape Designer
Join date: 6 Feb 2007
Posts: 20
|
06-10-2007 15:20
Yes! here's the one I use to do this. I am a landscaper and as such use sounds in my creations, so I use this script to enable me to pay my sound guy a % of sales directly. You need to put the UUID of the recipient into the script, but i have a unit I made to find that for you. (IM me inworld if you want a copy sending) This script only works on the PAY function and not the buy option so you dont get the list of contents. If anyone has done this to run on the BUY option I would be interested. Anyway here's the code: //This script makes it possible to sell things out of boxes and split the profit with a partner. //The objects price is read from the object's description. //You can set the description on the GENERAL TAB just like the Object Name.
//Example $500 fountain
//The script reads the price from the description so long as you have it in the format above. //You must put "price$ info". The dollar sign must be in there for the script to work. //-----Do Not Remove Header
key gPartner = ""; // ############# PUT YOUR PARTNER'S KEY HERE. #############
///----------------Don't need to change anything below this line-------------------
key gOwner; integer gPrice; integer gCut; integer gPerms = FALSE; string gObject;
default { state_entry() { llWhisper(0, (string)gPartner); gOwner = llGetOwner(); list Parsed = llParseString2List(llGetObjectDesc(), ["$"], []); gPrice = llList2Integer(Parsed, 0); if (!gPrice) { llInstantMessage(gOwner, "Error: Please set object description to ''price$ info about object''. Touch to reset when ready."); } else { if (gPartner != "") { gCut = llRound(gPrice / 2); } gObject = llGetInventoryName(INVENTORY_OBJECT,0); llRequestPermissions(gOwner,PERMISSION_DEBIT); } }
on_rez(integer passed) { if(llDetectedKey(0) != llGetOwner()) { llResetScript(); } }
run_time_permissions(integer type) { if ((type & PERMISSION_DEBIT) != PERMISSION_DEBIT) { gPerms = FALSE; llInstantMessage(gOwner, "I require debit permissions to function."); llRequestPermissions(gOwner,PERMISSION_DEBIT); } else { gPerms = TRUE; llInstantMessage(gOwner, "I have aquired debit permissions from "+llKey2Name(gOwner)+"."); if ((gPrice) && (gObject != "")) { if (gPartner != "") { llInstantMessage(gOwner, "Selling "+gObject+" for "+(string)gPrice+"$L. [Partner receives "+(string)gCut+"$L cut.]"); } else { llInstantMessage(gOwner, "Selling "+gObject+" for "+(string)gPrice+"$L. [NO Partner Defined.]"); } } else { llInstantMessage(gOwner, "I have permissions, but your box is missing contents or missing a price."); llInstantMessage(gOwner, "Fix error and touch to reset when ready."); } } }
touch_start(integer total_number) { if (llDetectedKey(0) == llGetOwner()) { llResetScript(); } else { llWhisper(0, gObject+" - $"+(string)gPrice+"L. Right click and pay amount to purchase."); } }
money(key giver, integer amount) { if (gPerms == TRUE) { if (amount < gPrice) { llSay(0, gObject+" costs L$" + (string) gPrice); llSay(0, "You paid $L"+(string)amount+", which is not enough!"); llGiveMoney(giver, amount); } else { llSay(0, "Thank you for your purchase!"); llGiveInventory(giver, gObject); if (amount > gPrice) { llGiveMoney(giver, amount - gPrice); }
if (gPartner != "") { llGiveMoney(gPartner, gCut); } } } } } [CODE END]
|
|
Sue Saintlouis
Registered User
Join date: 8 Dec 2006
Posts: 420
|
06-11-2007 01:53
Thank you so much! I am passing it on to my business partner who is more proficient with scripts than I am.
|