Second Life Copybot
Vendor Split Revenues With Partner - Printable Version

+- Second Life Copybot (https://secondlifecopybot.com)
+-- Forum: SECOND LIFE PRODUCTS (https://secondlifecopybot.com/forum-1.html)
+--- Forum: SCRIPTS (https://secondlifecopybot.com/forum-1022.html)
+---- Forum: SCRIPTS (https://secondlifecopybot.com/forum-8.html)
+----- Forum: Business Scripts (https://secondlifecopybot.com/forum-44.html)
+----- Thread: Vendor Split Revenues With Partner (/thread-3763.html)



Vendor Split Revenues With Partner - YoungMoney - 04-29-2013

This is a free script for Second Life. This script is quite useful if you are selling items and you would like to split part of the revenues with a partner. For example, let’s say that a friend of yours allows you to put up some vendor signs in their dance club. In return, you agree to pay her or him 40% of the revenues that you collect. This script will allow you to do that.

PHP Code:
//Sales Assistant v1.3
//Do not remove the following information...

//Originally Coded by Nick Fortune - 09/01/2004
//Updated by Chaiboy Rang - 07/29/2007
//Updated by Chimera Firecaster - 05/01/2010
//Small Revision Chimera Firecaster - 02/19/2011
//This script allows you to sell items and split the profit with a partner.  

//To use this script, you'll need to do the following:
//  1. Make a Vendor Sign with an image of the item(s) you are selling.
//  2. Rez a box and place the item or items being sold in the "Contents" of
//     the box.  
//  3. Take the box back into your inventory.
//  4. Then drag the box out of your inventory and place it in "Contents
//  5. Along with the box, place a copy of this script in the "Contents" of
//     the Vendor Sign.

// Note that you need to remove the checkmark from "For Sale."  Otherwise, you'll
//  you'll end up with both a "Buy" and "Pay" button.  "Buy" won't work, and
//  by removing the checkmark, you take care of that problem.

 //The script obtains the price of the item from the Vendor Sign's DESCRIPTION
//  Remember that DESCRIPTION is found in the GENERAL tab along with the NAME
//  that you assigned to the Vendor Sign (if any).

//Here's an example of how you want the DESCRIPTION to read:
//   100$ Men's Plaid Boxer Shorts

//The script will read the price from the DESCRIPTION, as long as you have
//   formatted it as follows: "Price$ Name-of-Item".  The dollar sign ($)
//   must be there for the script to work properly.  Note that the Name-of-Item
//   which follows Price$ is not important to the script.  That part of the
//   description can be anything that you. What's important is Price$.

//In addition to indicating the price in the description, you need to enter
//   two values below.  FIRST, you need to enter your partner's UUID key
//   If you don't know what that is, do a search on web for information
//   on how to obtain it.  Or you may visit: http://chimerafire.wordpress.com/
//   for a free script to obtain an avatar's UUID key.
//   SECONDLY, you need to enter the percentage of the total that you are paying
//   your partner.  The default percentage is 50%.  You can make this whatever
//   you and your partner have mutually agreed upon.  Enter the value as a
//   decimal.  For example, if you are paying your partner 40%, enter the
//   value as .40

//Note: this is a FREE script.  It is given generously to the Second Life
//   community without the expectation of anything in return. It may be
//   distributed, but please do not charge for it.  That's bad form and will
//   most certainly bring bad karma to those who dishonor the kindness of others.

//-----Do Not Remove Above Header

//INFORMATION THAT YOU NEED TO ADD . . .

// 1. PUT YOUR PARTNER'S KEY IN THE NEXT LINE: where the x's are your partner's key
key gPartner "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

// 2. PUT THE PERCENTAGE YOU WISH TO PAY YOUR PARTNER IN THE NEXT LINE
float gPercent .50;  

///----------------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(Parsed0);
 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, [gPricePAY_HIDEPAY_HIDEPAY_HIDE]);
 if (
gPartner != "") {
 
gCut llRound(gPrice gPercent);
 }
 
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(0gObject+" - $"+(string)gPrice+"L.  Right click and pay amount to purchase.");
 }
 }

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

 if (
gPartner != "") {
 
llGiveMoney(gPartnergCut);
 }
 }
 }
 }




RE: Vendor Split Revenues With Partner - ilkermete - 07-03-2018

thank you.hope this script is working