Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Sales Assistant (Split Profits with Partner)

Nick Fortune
National Alchemist
Join date: 30 May 2003
Posts: 74
09-05-2004 01:35
CODE

//Sales Assistant v1.1
//by Nick Fortune - 09/01/2004

//This script makes it possible to sell things out of boxes and split the profit with a partner.
//The info about the objects price is read from the object's description.
//You can set the description on the GENERAL TAB just like the Object Name.

//Example Description: 100$ Super Mega Awesome Prim Thinger

//The script reads the price from the description so long as you have it in the format above.
//You must put "price$ info". The dollar sign must be in there for the script to work.
//-----Do Not Remove Header


key gPartner = ""; // ############# PUT YOUR PARTNER'S KEY HERE. #############


///----------------Don't need to change anything below this line-------------------

key gOwner;
integer gPrice;
integer gCut;
integer gPerms = FALSE;
string gObject;


default {
state_entry() {
llWhisper(0, (string)gPartner);
gOwner = llGetOwner();
list Parsed = llParseString2List(llGetObjectDesc(), ["$"], []);
gPrice = llList2Integer(Parsed, 0);
if (!gPrice) {
llInstantMessage(gOwner, "Error: Please set object description to ''price$ info about object''. Touch to reset when ready.");
}
else {
if (gPartner != "") {
gCut = llRound(gPrice / 2);
}
gObject = llGetInventoryName(INVENTORY_OBJECT,0);
llRequestPermissions(gOwner,PERMISSION_DEBIT);
}
}

on_rez(integer passed) {
if(llDetectedKey(0) != llGetOwner()) {
llResetScript();
}
}

run_time_permissions(integer type)
{
if ((type & PERMISSION_DEBIT) != PERMISSION_DEBIT) {
gPerms = FALSE;
llInstantMessage(gOwner, "I require debit permissions to function.");
llRequestPermissions(gOwner,PERMISSION_DEBIT);
}
else {
gPerms = TRUE;
llInstantMessage(gOwner, "I have aquired debit permissions from "+llKey2Name(gOwner)+".");
if ((gPrice) && (gObject != "")) {
if (gPartner != "") {
llInstantMessage(gOwner, "Selling "+gObject+" for "+(string)gPrice+"$L. [Partner receives "+(string)gCut+"$L cut.]");
}
else {
llInstantMessage(gOwner, "Selling "+gObject+" for "+(string)gPrice+"$L. [NO Partner Defined.]");
}
}
else {
llInstantMessage(gOwner, "I have permissions, but your box is missing contents or missing a price.");
llInstantMessage(gOwner, "Fix error and touch to reset when ready.");
}
}
}

touch_start(integer total_number) {
if (llDetectedKey(0) == llGetOwner()) {
llResetScript();
}
else {
llWhisper(0, gObject+" - $"+(string)gPrice+"L. Right click and pay amount to purchase.");
}
}

money(key giver, integer amount) {
if (gPerms == TRUE) {
if (amount < gPrice) {
llSay(0, gObject+" costs L$" + (string) gPrice);
llSay(0, "You paid $L"+(string)amount+", which is not enough!");
llGiveMoney(giver, amount);
}
else {
llSay(0, "Thank you for your purchase!");
llGiveInventory(giver, gObject);
if (amount > gPrice) {
llGiveMoney(giver, amount - gPrice);
}

if (gPartner != "") {
llGiveMoney(gPartner, gCut);
}
}
}
}
}


Original Thread
/15/55/21967/1.html
Millie Thompson
Resident Moderator
Join date: 18 Dec 2002
Posts: 364
09-18-2004 07:09
I would assume that the spot in the script where (string) appears would be the partner's ID key.
_____________________
Millie Thompson
I am a Resident Moderator. I am a volunteer moderator on this forum, NOT a Linden. If you have any issues or concerns with your Second Life experience please go to Second Life Support
Nick Fortune
National Alchemist
Join date: 30 May 2003
Posts: 74
09-18-2004 12:13
key gPartner = ""; // ############# PUT YOUR PARTNER'S KEY HERE. #############


See the "############# PUT YOUR PARTNER'S KEY HERE. #############"?

put your partner's key in that part like so...


key gPartner = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // ############# PUT YOUR PARTNER'S KEY HERE. #############


where the x's are your partner's key
Sakura Schlegal
Registered User
Join date: 26 Oct 2006
Posts: 4
Error?
02-09-2007 22:49
I keep getting the following error ...
Motley Crue T-Shirt: I have aquired debit permissions from LittleMiss Independent.
[22:44] Motley Crue T-Shirt: I have permissions, but your box is missing contents or missing a price.
[22:44] Motley Crue T-Shirt: Fix error and touch to reset when ready.
I went to edit object and the entered the price and description into the description line and the item name...
what am I doing wrong?
ChaiBoy Rang
Registered User
Join date: 9 Mar 2007
Posts: 29
07-27-2007 08:56
The script sells objects. So put any items into a box or bag.
ChaiBoy Rang
Registered User
Join date: 9 Mar 2007
Posts: 29
07-27-2007 09:30
here is an update to the script. I changed the BUY option so it shows just the price. Also changed the error message to clarify what is going on since Object doesn't immediately click in my head as not being an article of clothing or a pair of eyes.

CODE

//Sales Assistant v1.2
//by Nick Fortune - 09/01/2004
//Updated by Chaiboy Rang -07/29/2007
//This script makes it possible to sell things out of boxes and split the profit with a partner.
//The info about the objects price is read from the object's description.
// *** make sure if the item being sold is not an object it is put in one. This is a good time to make a nice bag or box with your logo on it to put items into.
//You can set the description on the GENERAL TAB just like the Object Name.

//Example Description: 100$ Super Mega Awesome Prim Thinger

//The script reads the price from the description so long as you have it in the format above.
//You must put "price$ info". The dollar sign must be in there for the script to work.
//-----Do Not Remove Header


//key gPartner = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"; // ############# PUT YOUR PARTNER'S KEY HERE. #############
//where the x's are your partner's key


key gPartner = ""; // ############# PUT YOUR PARTNER'S KEY HERE. #############


///----------------Don't need to change anything below this line-------------------

key gOwner;
integer gPrice;
integer gCut;
integer gPerms = FALSE;
string gObject;


default {
state_entry() {
llWhisper(0, (string)gPartner);
gOwner = llGetOwner();
list Parsed = llParseString2List(llGetObjectDesc(), ["$"], []);
gPrice = llList2Integer(Parsed, 0);
if (!gPrice) {
llInstantMessage(gOwner, "Error: Please set object description to ''price$ info about object. This only sells a object so please put clothing,r bodyparts or multiple items in a bag or box. ''. Touch to reset when ready.");
}
else {
llSetPayPrice(gPrice, [gPrice, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
if (gPartner != "") {
gCut = llRound(gPrice / 2);
}
gObject = llGetInventoryName(INVENTORY_OBJECT,0);
llRequestPermissions(gOwner,PERMISSION_DEBIT);
}
}

on_rez(integer passed) {
if(llDetectedKey(0) != llGetOwner()) {
llResetScript();
}
}

run_time_permissions(integer type)
{
if ((type & PERMISSION_DEBIT) != PERMISSION_DEBIT) {
gPerms = FALSE;
llInstantMessage(gOwner, "I require debit permissions to function.");
llRequestPermissions(gOwner,PERMISSION_DEBIT);
}
else {
gPerms = TRUE;
llInstantMessage(gOwner, "I have aquired debit permissions from "+llKey2Name(gOwner)+".");
if ((gPrice) && (gObject != "")) {
if (gPartner != "") {
llInstantMessage(gOwner, "Selling "+gObject+" for "+(string)gPrice+"$L. [Partner receives "+(string)gCut+"$L cut.]");
}
else {
llInstantMessage(gOwner, "Selling "+gObject+" for "+(string)gPrice+"$L. [NO Partner Defined.]");
}
}
else {
llInstantMessage(gOwner, "I have permissions, but your box is missing contents or missing a price.");
llInstantMessage(gOwner, "Fix error and touch to reset when ready.");
}
}
}

touch_start(integer total_number) {
if (llDetectedKey(0) == llGetOwner()) {
llResetScript();
}
else {
llWhisper(0, gObject+" - $"+(string)gPrice+"L. Right click and pay amount to purchase.");
}
}

money(key giver, integer amount) {
if (gPerms == TRUE) {
if (amount < gPrice) {
llSay(0, gObject+" costs L$" + (string) gPrice);
llSay(0, "You paid $L"+(string)amount+", which is not enough!");
llGiveMoney(giver, amount);
}
else {
llSay(0, "Thank you for your purchase!");
llGiveInventory(giver, gObject);
if (amount > gPrice) {
llGiveMoney(giver, amount - gPrice);
}

if (gPartner != "") {
llGiveMoney(gPartner, gCut);
}
}
}
}
}
Alaska Metropolitan
Fashion Addict
Join date: 5 Jun 2005
Posts: 259
11-03-2007 12:36
This is something I've been looking for, I'm just curious about two things:

1) How do I find the partner's ID?

2) How can I change the percentage of profit given to the partner?

Any help would be appreciated! Thanks
_____________________
------------------------------------------

http://slurl.com/secondlife/Celerio/16/138// | http://slurl.com/secondlife/Alpha%20Centauri/215/8// | http://slurl.com/secondlife/Scoopwing/244/125/48/ | http://www.slboutique.com/Alaska_Metropolitan/ | http://alaskametro.blogspot.com/
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
11-03-2007 14:28
From: Alaska Metropolitan
This is something I've been looking for, I'm just curious about two things:

1) How do I find the partner's ID?

2) How can I change the percentage of profit given to the partner?

Any help would be appreciated! Thanks


Here is a split proceeds script, free version with full permissions, instructions and a key giver box for obtaining avatar keys. I used it for along time before getting a server based vendor system, it works great.

http://uncensored.slexchange.com/modules.php?name=Marketplace&file=item&ItemID=22672
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo