- https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); color: rgb(0, 0, 0); font-family: verdana, helvetica, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255); ">
- THIS SCRIPT WILL ASK FOR DEBIT PERMISSIONS. THEY MUST BE GRANTED FOR THE SCRIPT TO FUNCTION. L$ WILL BE TAKEN FROM THE OBJECT OWNERS ACCOUNT.
Sell the contents of an object (if in a link_set (multiple prim object) place in the root) for another creator. They get paid their cut and you get yours. You may provide a collection of inventory including LM's and/or NC's along with the main product. The script will pay the percentage to the creator named; The inventory may be created by multiple agents. If the creator named did not create anything in the inventory the script will ask that you start again.
// V1 // integer price = 5; // Price of inventory. Must be greater than zero. integer percentage = 50; // Percentage to pay creator of inventory. string creator_to_pay = "Fred Gandt"; // Name of creator to pay percentage. Case Sensitive. string folder_name = "Folder of Stuffs"; // The name of the folder as it appears in the buyers inventory. ///////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// DON'T EDIT BELOW THIS POINT UNLESS YOU KNOW WHAT YOU'RE DOING ////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////// key creator_to_pay_key = NULL_KEY; key name_iq = NULL_KEY; key owner = NULL_KEY; list inventory = []; integer search = 0; list creators = []; default { on_rez(integer param) { llResetScript(); } changed(integer change) { if(change & (CHANGED_OWNER | CHANGED_INVENTORY)) llResetScript(); } state_entry() { llSetClickAction(CLICK_ACTION_TOUCH); owner = llGetOwner(); if(percentage > 100) percentage = 100; llOwnerSay("\nClick this object when you have fully loaded the inventory." + "\nYou will be asked to grant permissions." + "\nYou MUST grant them for this script to function."); } touch_start(integer nd) { while(nd) { if(llDetectedKey(--nd) == owner) llRequestPermissions(owner, PERMISSION_DEBIT); } } run_time_permissions(integer perm) { if(perm & PERMISSION_DEBIT) { llSetPayPrice(PAY_HIDE, [price, PAY_HIDE, PAY_HIDE, PAY_HIDE]); llSetClickAction(CLICK_ACTION_PAY); integer in = llGetInventoryNumber(INVENTORY_ALL); key creator_key = NULL_KEY; integer count = 0; string name = ""; do { if((name = llGetInventoryName(INVENTORY_ALL, count)) != llGetScriptName()) { inventory += [name]; if(llListFindList(creators, [(creator_key = llGetInventoryCreator(name))]) == -1) creators += [creator_key]; } } while((++count) < in); if(llGetListLength(inventory)) name_iq = llRequestAgentData(llList2Key(creators, (search = 0)), DATA_NAME); else llOwnerSay("\nThere is nothing to sell.\nYou'll need to add some inventory."); } else { llOwnerSay("\nYou MUST grant permissions for this script to function."); llRequestPermissions(owner, PERMISSION_DEBIT); } } dataserver(key q, string data) { if(q == name_iq) { if(data == creator_to_pay) { creator_to_pay_key = llList2Key(creators, search); creators = []; state shop; } else if((llGetListLength(creators) - 1) > search) name_iq = llRequestAgentData(llList2Key(creators, (++search)), DATA_NAME); else llOwnerSay("\nThe creator to pay does not match any of the creators of the inventory." + "\nPlease adjust the script appropriately."); } } } state shop { on_rez(integer param) { llResetScript(); } changed(integer change) { if(change & (CHANGED_OWNER | CHANGED_INVENTORY)) llResetScript(); } money(key id, integer amount) { if(amount >= price) { if(amount > price) llGiveMoney(id, (amount - price)); integer cut = llFloor((((float)amount) / 100.0) * ((float)percentage)); if(percentage && cut) llGiveMoney(creator_to_pay_key, cut); llGiveInventoryList(id, folder_name, inventory); // Last operation because of its 3 second script delay. } else { llGiveMoney(id, amount); llInstantMessage(id, ("\nYou paid too little.\nThe cost of this item is " + ((string)price) + "L$")); } } }