Jump to content

GaboNux

Resident
  • Posts

    1
  • Joined

  • Last visited

Everything posted by GaboNux

  1. 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$)"); } }}
×
×
  • Create New...