I am back again and as previously stated I am happy to compensate if required.
I have the following script which is working however, I'd like to have the price (integer gPrice) be configurable via notecard rather than within the script itself. I spent a few hours trying myself but couldn't get it function.
Code: Select all
// Give Inventory List with Split payout -- Rolig Loon -- November 2010
// OWNER: Specify each of the following parameters
integer gPrice = ; // Price of your item
key gSplitKey= NULL_KEY; // UUID of the person to whom you are giving a split
float gSplitPct = 0.4; // 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);
}
}
}
}