// One way to do this is a vendor script. Create your vendor prim, drop your sales item into
// its inventory, copy the contents of this post, paste it into a script inside the vendor,
// and change the top lines of this script (item name, price etc.).
// Payments are made with right-click + "Buy".
// The vendor will ask you for permission to take money from you. Don't be afraid, the script
// needs this permission in order to make payments to your account. Have someone with LSL
// knowledge look over this script, if you want to be sure what it does.
// LIMITED EDITION VENDOR SCRIPT BY ALEISTER MONTGOMERY (A.K.A. ISHTARA ROTHSCHILD)
string Company_Name = "Gallery Gallivant" ; //Name of your company, shop or gallery in quotes
string Item_Name = "Something Yellowish with Purple Dots" ; //Name of the sales item in quotes
integer Price = 180 ; //Price in L$
integer Copies = 3 ; //Number of copies to sell
integer Sold = 0 ; //Don't change this, increments automatically
startup() //Asks for permission to handle payments, sets the price
{
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
llSetPayPrice(PAY_HIDE, [Price, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
set_title();
}
set_title() //Sets the vendor name and the floating text
{
integer temp = Sold + 1;
integer left = Copies - Sold;
string title = "'"+Item_Name+"'"; //Item name is set in quotes
llSetObjectName(title+", copy no. "+(string)temp+" of "+(string)Copies);
//Vendor name changed to 'Title', copy no. X of X
llSetText(title+", limited to "+(string)Copies+" copies, "+(string)left+" left",
<1,1,1>,1);
//Floating text changed to 'Title', limited to X copies, X left
}
default
{
state_entry()
{
startup(); //Execute startup and set_title when the script starts running...
}
on_rez(integer param)
{
startup(); //...and also when the vendor is picked up and rezzed again.
}
money(key id, integer amount) //If a payment is made...
{
if (amount == Price)
//amount != price can't happen, since there's only a payment button and no input field.
//Just an unneeded precaution.
{
++Sold; //Increment no. of sold copies by 1
llWhisper(0,Company_Name+" thanks you for your purchase!
Please stand by while the item is delivered, and please click 'Accept'."

;
llGiveInventory(id, Item_Name); //Hand out the ware
llWhisper(0,"You purchased copy no. "+(string)Sold+" of a limited edition of
only "+(string)Copies+" copies. The item can be found in your Objects folder."

;
if (Sold == Copies) state sold_out;
//Stop vendor from working when all copies have been sold.
else set_title(); //Change the floating text to display the no. of copies left
}
}
}
state sold_out
{
state_entry()
{
string title = "'"+Item_Name+"'"; //Item name is set in quotes
llSetPayPrice(PAY_HIDE, [PAY_HIDE, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
//Disable further payments
llSetObjectName(title+" - sold out!"

;
llSetText(title+" - sold out! We are sorry for the inconvenience.",<1,1,1>,1);
//Change object name and floating text to notify the customers
llInstantMessage(llGetOwner(), "All "+(string)Copies+" copies of the item "+
title+" have been sold. The vendor has been disabled."

;
//Notify the vendor owner
}
}