Split Pay Script: Add Notecard Setting

Creating scripts
Post Reply
User avatar
Natalie Oe
Posts: 41
Joined: Mon May 07, 2018 10:15 am
Has thanked: 21 times
Been thanked: 19 times
Contact:

Split Pay Script: Add Notecard Setting

Post by Natalie Oe » Tue Jun 18, 2019 10:13 am

Hi All,

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);
            }
        }
    }
}
Thank you for any help/suggestions!
These users thanked the author Natalie Oe for the post:
Ilan Tochner
User avatar
Constance Peregrine
Posts: 2324
Joined: Sun Dec 23, 2012 11:35 am
Has thanked: 2764 times
Been thanked: 1423 times

Re: Split Pay Script: Add Notecard Setting

Post by Constance Peregrine » Wed Jun 19, 2019 3:06 pm

The market allows for split payments. If that helps any...peace
These users thanked the author Constance Peregrine for the post (total 2):
Ilan TochnerNatalie Oe
Laissez faire et laissez passer, le monde va de lui même!
My little sounds store https://www.kitely.com/market?store=2040306

Ephemeral wanderer...
User avatar
Ilan Tochner
Posts: 4924
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 2652 times
Been thanked: 2674 times
Contact:

Re: Split Pay Script: Add Notecard Setting

Post by Ilan Tochner » Wed Jun 19, 2019 3:51 pm

Hi Natalie,

You can use Kitely Market to automatically split revenue from the sale of particular items. See: https://www.kitely.com/virtual-world-ne ... splitting/
These users thanked the author Ilan Tochner for the post:
Chris Namaste
User avatar
Natalie Oe
Posts: 41
Joined: Mon May 07, 2018 10:15 am
Has thanked: 21 times
Been thanked: 19 times
Contact:

Re: Split Pay Script: Add Notecard Setting

Post by Natalie Oe » Thu Jun 20, 2019 2:32 am

Ilan Tochner wrote:
Wed Jun 19, 2019 3:51 pm
Hi Natalie,

You can use Kitely Market to automatically split revenue from the sale of particular items. See: https://www.kitely.com/virtual-world-ne ... splitting/
Thanks Ilan, it’s for a completely different project so the MP option is not viable.

That being said it’s been resolved and so I no longer need help with it :)
Post Reply