Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Library: Single Object Vendor with Email Notice of sales.

BigJohn Jade
Registered User
Join date: 5 Aug 2003
Posts: 93
09-15-2008 01:46
CODE

// By BigJohn Jade

// (UPDATED)

// Elite.Single.Object.Vendor.v2.0.0

// Just easy vendor script to use for passing one object out for sell.

// You can now split the money with a partner from single box vendor.

// You can also send the partner emails on each sale.

// Fast pay button option and sending emails on each sale.

integer price = 800; // $800L

float comission = 50; // The partner gets half of the money

key partnerAvKey = ""; // The partner av key that you want to split the money with. If left "" then all the money goes to you only.

// name of the object you want to sell goes here
string NameOfObject ="Elite Security XRL Access Unit V1.5.1 BOXED";

// your email address that goes to second life database.
string VENDOR_OWNER_EMAIL = "";

// partner email address that goes to second life databse.
string VENDOR_PARTNER_EMAIL = "";

// No need to edit anything after above lines.
integer FindObject(string name)
{
integer c;
for(c=0;c<llGetInventoryNumber(INVENTORY_OBJECT);c++)
if(llGetInventoryName(INVENTORY_OBJECT,c) == (string)name)
return TRUE;
return FALSE;
}

integer SECONDS_PER_MINUTE = 60;
integer SECONDS_PER_HOUR = 3600;
integer SECONDS_PER_DAY = 86400;

string get_time_all(integer ampm, integer PST_offset) {
integer tsec = ((integer)llGetWallclock() + PST_offset) % SECONDS_PER_DAY;
integer hrs = tsec / SECONDS_PER_HOUR;
string am = "";
if ( ampm ) {
am = " AM";
if ( hrs >= 12 && hrs != 24 )
am = " PM";
if ( hrs > 12 )
hrs -= 12;
}
string hours = "0" + (string)hrs;
string minutes = "0" + (string)((tsec % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE);
string seconds = "0" + (string)(tsec % SECONDS_PER_MINUTE);
return llGetSubString(hours, -2, -1) + ":" + llGetSubString(minutes, -2, -1) + ":" +
llGetSubString(seconds, -2, -1) + am;
}
default
{
state_entry()
{
llSetPayPrice(PAY_HIDE, [PAY_HIDE ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

run_time_permissions(integer perm)
{
if(perm & PERMISSION_DEBIT)
state cash;
}
}
state cash
{
state_entry()
{
llSetPayPrice(PAY_HIDE, [price ,PAY_HIDE, PAY_HIDE, PAY_HIDE]);
}


touch_start(integer total_number)
{
integer CheckAccess;
key person = llDetectedKey(CheckAccess);
string name = llDetectedName(CheckAccess);
llInstantMessage(person,"Right click the "+(string)NameOfObject+ " vendor and click the Pay button.");
}

on_rez(integer i)
{
llResetScript();
}

money(key id, integer amount)
{
if (amount == price)
{
integer i;
if (FindObject(NameOfObject) == FALSE)
{
llInstantMessage(id, "Sorry "+(string)llKey2Name(id)+ " , it seems that I am missing the "+(string)NameOfObject+".");
llGiveMoney(id, amount);
return;
}
else
llInstantMessage(id, "Thank you "+(string)llKey2Name(id)+ " for your purchase of the "+(string)NameOfObject+".");
llGiveInventory(id,NameOfObject);
if(partnerAvKey != "")
{
float splitMoney = (float)price/100*comission;
llGiveMoney(partnerAvKey,(integer)splitMoney);
}
if(VENDOR_OWNER_EMAIL != "")
{
llEmail(VENDOR_OWNER_EMAIL, (string)NameOfObject+ " <= The Buyer => " + (string)llKey2Name(id), (string)llKey2Name(id)+ " just pay $"+(string)amount+ "L for a "+(string)NameOfObject+".\n\nPST Time:" + (string)get_time_all(TRUE, 0 * SECONDS_PER_HOUR) + ".\n\nDate:" + (string)llGetDate()+ ".");
}
if(VENDOR_PARTNER_EMAIL != "")
{
llEmail(VENDOR_PARTNER_EMAIL, (string)NameOfObject+ " <= The Buyer => " + (string)llKey2Name(id), (string)llKey2Name(id)+ " just pay $"+(string)amount+ "L for a "+(string)NameOfObject+".\n\nPST Time:" + (string)get_time_all(TRUE, 0 * SECONDS_PER_HOUR) + ".\n\nDate:" + (string)llGetDate()+ ".");
}
}
else
{
llInstantMessage(id,"Sorry "+(string)llKey2Name(id)+ ", that is the wrong amount for this item.");
llGiveMoney(id, amount);
}
}
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Library bump
09-15-2008 05:37
:)
_____________________
i've got nothing. ;)
Hidduh Dawes
Second Life Mentor
Join date: 25 May 2008
Posts: 2
10-13-2008 06:15
Thank you. :-)
_____________________
Ichago Dougall
Registered User
Join date: 12 Aug 2004
Posts: 10
Thanks
10-14-2008 03:47
Thank you for this. Was looking for a way to log sales of some of my one item vendor. Thanks Alot.