Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Income Spliting

Own Westland
Second.Life@msn.com
Join date: 24 Dec 2007
Posts: 49
02-20-2008 01:39
When someone paid an object, how to split a part of the money to the creator or someone else? Can this be realized? Which function or script sample? Thanks.
_____________________
Helpful MSN Group: Second.Life@msn.com
Haplo Voss
Registered User
Join date: 18 Nov 2006
Posts: 137
02-20-2008 02:26
This is a very nice and quick little split-vendor script. I don't remember where I found it, but it was here in the forums a long time ago. Apologies to anyone who might want mention here, but I don't remember who wrote it and there were no comments in it. But for the record, I didn't write this up off the top of my head. Someone else was nice enough to hand it out.

CODE


key partnerid = "keyinfo goes here"; //your partners KEY not name
integer pay = 10; // item price (if left at 10 it would sell for 10 lindens
float comission=30; // % comission your partner will make

default
{
state_entry()
{
llSetText("",<1,1,1>,.75);
}

on_rez(integer num)
{
llResetScript();
}

touch_start(integer num_detected)
{
if(llDetectedKey(0)==llGetOwner())
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_DEBIT)
{
llOwnerSay("Permissions passed...ready to work");
state run;
}
else
{
llOwnerSay("Invalid Permissions...resetting now");
llResetScript();
}
}
}

state run
{
state_entry()
{
llSetPayPrice(PAY_HIDE, [pay, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
string obj = llGetInventoryName(INVENTORY_OBJECT, 0);
if(obj != "")
{
llOwnerSay(obj + " is ready to be sold!");
llSetText("", <1,1,1>, 1);//Pay the vendor to buy " + obj + " for " + (string)pay +"L$", <1,1,1>, 1);
}
else
{
llOwnerSay("/me found no items to sell! Please put some in and touch again!");
llResetScript();
}



}
money(key id, integer amount)
{
if (amount == pay)
{
llInstantMessage(id,"Thank you for your purchase!");
string obj = llGetInventoryName(INVENTORY_OBJECT, 0);
llGiveInventory(id, obj);
float percentage = (float)pay/100*comission;
llGiveMoney(partnerid,(integer)percentage);
llInstantMessage(partnerid,llKey2Name(id)+" bought a " + obj + " ");
}
}
changed(integer change)
{
if(change & CHANGED_INVENTORY)
{
llOwnerSay("Iventory changed....resetting...");
llResetScript();
}
}
}



Give that a go and I think you'll find it a great place to start. I work off of it almost every time I need a new vendor for something.

Take care,
- Hap
Rock Ryder
Registered User
Join date: 6 Oct 2006
Posts: 384
02-20-2008 03:34
and there's another in the Library - /54/1c/229766/1.html

all the principles are there.

Rock