Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Simple split profit vendor script

MCM Villiers
Registered User
Join date: 7 Oct 2007
Posts: 39
12-14-2007 08:25
What it does:
- Allows you and one other person to be paid for each item sale
- Sends an IM to your partner about what was sold and by whom

Enjoy!

CODE

//Writen by MCM Villiers
//Based on a script by revochen Mayne

key partnerid = ""; //your partners KEY not name
integer pay = 10; // item price (if left at 10 it would sell for 10 lindens
float comission=50; // % comission your partner will make
//only scripters that know what they are doing with vendors edit below or edit at your own risk!
default
{
state_entry()
{
llSetText("",<1,1,1>,.75);
}
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("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();
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
12-16-2007 23:56
library bump
_____________________
i've got nothing. ;)
Centaine Decatur
Mooncusser
Join date: 24 Oct 2006
Posts: 49
07-22-2008 09:58
key partnerid = ""; //your partners KEY not name


[/php][/QUOTE]





How Do I find my partners "KEY"? Or mine for that matter.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-22-2008 10:45
Put this script in a prim and touch it:

CODE

default
{
touch_start(integer nDetected)
{
integer i;
for (i = 0; i < nDetected; ++i)
{
key id = llDetectedKey(i);
string name = llDetectedName(i);

llSay(0, name+"'s key is "+(string)id);
}
}
}
APinkSwan Beauchamp
Registered User
Join date: 14 Oct 2006
Posts: 30
07-22-2008 14:56
bit of a lengthy way todo it hewee

CODE

default
{
state_entry()
{
}

touch_start(integer t)
{
llSay(0, llDetectedName(0)+"'s Key is "+(string)llDetectedKey(0));
}
}
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
07-22-2008 16:26
From: APinkSwan Beauchamp
bit of a lengthy way todo it hewee

True, but I felt it was clear as well, and could possibly be learned from on top of being functional. :)
Centaine Decatur
Mooncusser
Join date: 24 Oct 2006
Posts: 49
07-23-2008 15:20
Thank you so much for the help!! Worked Brilliantly!