Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Vending script

Wednesday Grimm
Ex Libris
Join date: 9 Jan 2003
Posts: 934
06-10-2003 19:51
CODE

// vendor
// Wednesday Grimm
// June 10, 2003
//
// Simple vending script, gives correct change.

integer gPrice = 5; // cost of the item

// name of the item in object's inventory, to vend
string itemName = "test_note";

// two summary lines to describe the object
string summary1 = "this is a test note, it tests this script";
string summary2 = "it is very interesting. Cost is $5";

// give the item to a customer
dispense(key toWhom)
{
llGiveInventory(toWhom, itemName);
}

default
{
state_entry()
{
// we need this permission to give change
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

touch_end(integer total_number)
{
// if someone touches object describe what's for sale
llWhisper(0, summary1);
llWhisper(0, summary2);
}

money(key id, integer amt)
{
if (amt >= gPrice)
{
// customer has given us at least enough money
amt -= gPrice;
dispense(id);
}
if (amt > 0) // give back change
{
llGiveMoney(id, amt);
}
}
}
_____________________
Sarcasm meter:
0 |-----------------------*-| 10
Rating: Awww Jeeze!
Wolfgang Bach
Registered User
Join date: 9 Jan 2003
Posts: 7
Original Thread
04-25-2004 19:16
/54/43/69232/1.html
edit - Moved discussion over to scripting tips.

-------------------------


Thanks Wednesday, I just used this for the first time, and it works perfectly. Now I'm selling my first items, some men's ware.

Wolf
Melanie Morgan
Junior Member
Join date: 24 Apr 2004
Posts: 19
need help??
05-04-2004 21:03
can someone please explain exactly about a selling vendor script sorry, i didnt quite understand,
heard we have to take a picture first?? can you explain how step by step to add items in a vendor and start it up, reset it ??? thanks MELI ....
Dragon Steele
Artist/conservationist
Join date: 3 Jan 2005
Posts: 183
05-04-2005 07:48
Please, could you give me some clarification if you do not mind. Is this a single item vending script or an multi-item vendor? Forgive Me but when it comes to scripting I am quite illiterate.

Thank you

:)
_____________________
Boycot the spam farms and the ads on them. Ban the spamers from your land. Look for the clocktower network for a blacklist to put on you land that is grid wide.
Jacqueline Bancroft
Registered User
Join date: 10 Sep 2004
Posts: 19
05-16-2005 13:37
This is a vendor program for a single item. This is how it works:

You rez a cube and pretty it up.. maybe put a texture of what you're selling on the side.

Put the item that you want to sell into the cube you made.

Put this script inside the cube you made, and then open up the script to edit it.

Where it says gPrice, put the price of the item you want to sell after the equal sign.

Where it says itemName, put the item name of the item that you want to sell after the equal sign. Be very aware that the script is case sensitive, so make sure you spell it correctly. For example, "My Object" is different than "my object".

Where it says summary1 and summary 2, fill in a description of the item what you wish to sell. make sure that you surround the description with quotation marks, or else the script will go wonky. When a potential customer touches (clicks) on your box vendor, your box vendor will whisper summary1 and summary2 to them.

That's about it. Be sure to thank Wednesday if you use this script. :)
Dragon Steele
Artist/conservationist
Join date: 3 Jan 2005
Posts: 183
05-18-2005 20:07
From: Jacqueline Bancroft
This is a vendor program for a single item. This is how it works:

You rez a cube and pretty it up.. maybe put a texture of what you're selling on the side.

Put the item that you want to sell into the cube you made.

Put this script inside the cube you made, and then open up the script to edit it.

Where it says gPrice, put the price of the item you want to sell after the equal sign.

Where it says itemName, put the item name of the item that you want to sell after the equal sign. Be very aware that the script is case sensitive, so make sure you spell it correctly. For example, "My Object" is different than "my object".

Where it says summary1 and summary 2, fill in a description of the item what you wish to sell. make sure that you surround the description with quotation marks, or else the script will go wonky. When a potential customer touches (clicks) on your box vendor, your box vendor will whisper summary1 and summary2 to them.

That's about it. Be sure to thank Wednesday if you use this script. :)


thank you :)
_____________________
Boycot the spam farms and the ads on them. Ban the spamers from your land. Look for the clocktower network for a blacklist to put on you land that is grid wide.
Artemis Maelstrom
Registered User
Join date: 26 Sep 2004
Posts: 6
09-13-2005 20:41
Terrific vendor, I modified it to IM me when an item is bought and IM me with how much i have made in total when an item is purchased.
Ben Stravinsky
Second Life Resident
Join date: 7 Nov 2004
Posts: 149
I'd check this script again
10-30-2005 10:22
I have found that this script has an error in it, and allows people to purchase items for the wrong amount of money.

Simple pay the vendor under the correct amount, and it will tell you that you need to enter more money. Enter the rest to bring your payment up to the correct amount and you will recieve your item. From this point on you can now purchase the item over and over again for 1$.

Ihave jsut sat in world testing this, and either i have an odd bug. Or i'm right ^^

I hope i'm wrong as a lot of people are using this item.
Mantur Tokhes
Registered User
Join date: 16 Jan 2006
Posts: 16
01-16-2006 07:21
ok, does the script make a duplicate of the item that you want to sell or do you have to refill the vendor?
Myoko Takashi
Registered User
Join date: 10 Feb 2006
Posts: 20
03-29-2006 21:46
just curious if anyone has a vending script i can put in my object so that someone can bring up the radial menu and buy a copy of it from there. Im just starting a store and though i have a large vendor i was also hoping to put up some things to touch-buy around the shop. Im also wondering if anyone knows how to make the object name and details etc, show up when you move the cursor over the item. I hope I made sense here and I hope someone can help :) Thank you.
vanettda Lassard
Registered User
Join date: 11 Apr 2006
Posts: 19
Perfect ... but ...
06-05-2007 15:41
This is the perfect solution for my little shop. However is there a way to add a notecard giver to this?
poopmaster Oh
The Best Person On Earth
Join date: 9 Mar 2007
Posts: 917
06-16-2007 18:00
// simple single prim multi person vendor script. pays you then you pay the other person the amount set
key payee = "97b8r7tc-5yd3-4i8a-bdd2-5644d0aa8fb4";


integer price = 55;
string folder = "FolderName";
list items = ["item1","item2"];

default
{
on_rez(integer param)
{
llResetScript();
}

state_entry()
{
llSetText("describe item here", <1,1,1>, 1.0);
llSetPayPrice(55, [55, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

run_time_permissions(integer perm)
{
if(perm & PERMISSION_DEBIT)
{
state online;
}
}
}

state online
{
on_rez(integer param)
{
llResetScript();
}

money(key id, integer amount)
{
if(amount > price)
{
llGiveInventoryList(id, folder, items);
llGiveMoney(payee,20);

llGiveMoney(id, amount - price);
}
if(amount < price)
{
llGiveMoney(id, amount);
}
else
{
llGiveInventoryList(id, folder, items);
llGiveMoney(payee, 20);
}
}

}
_____________________
InSL u find every kind of no-life retard you could possibly imagine as well as a few even Tim Burton couldnt imagine u find 12yr-olds claiming to be 40 men claiming 2 be women, women claiming 2 make sense and every1 claiming 2 have ideas that are actually worth a damn if only someone would just listen to their unique innovative and exceptionally important idea
kasper Bender
Registered User
Join date: 10 Aug 2006
Posts: 2
change the uuid
06-18-2007 07:28
From: poopmaster Oh
// simple single prim multi person vendor script. pays you then you pay the other person the amount set
key payee = "97b8r7tc-5yd3-4i8a-bdd2-5644d0aa8fb4";


integer price = 55;
string folder = "FolderName";
list items = ["item1","item2"];

default
.....

hahah don't forget to change the uuid key or other whise your funds get lost
AngelEyes Lewis
Registered User
Join date: 18 Oct 2005
Posts: 49
12-02-2007 19:36
From: Wednesday Grimm
CODE

// vendor
// Wednesday Grimm
// June 10, 2003
//
// Simple vending script, gives correct change.

integer gPrice = 5; // cost of the item

// name of the item in object's inventory, to vend
string itemName = "test_note";

// two summary lines to describe the object
string summary1 = "this is a test note, it tests this script";
string summary2 = "it is very interesting. Cost is $5";

// give the item to a customer
dispense(key toWhom)
{
llGiveInventory(toWhom, itemName);
}

default
{
state_entry()
{
// we need this permission to give change
llRequestPermissions(llGetOwner(), PERMISSION_DEBIT);
}

touch_end(integer total_number)
{
// if someone touches object describe what's for sale
llWhisper(0, summary1);
llWhisper(0, summary2);
}

money(key id, integer amt)
{
if (amt >= gPrice)
{
// customer has given us at least enough money
amt -= gPrice;
dispense(id);
}
if (amt > 0) // give back change
{
llGiveMoney(id, amt);
}
}
}



Dont mean to ressurect a thread from the past, but if one wanted this type of a script (simple and clean) but wanted one prim to sell two items (Say a skin, and an outfit) how hard would it be to accomplish this?

Basically, i want to have something where i say 'skin = 1L' 'outfit = 2L' and then depending on the amount paid (probably have to do a quick pay option?) it gives out the certain item.

I'm guessing it would be just a case of if/then events, but im terrible with that, is there any other way i could script something like that? Thanks a bunch :D
_____________________
http://slurl.com/secondlife/Jamaica/74/129/30
Eta Carver
Registered User
Join date: 9 Feb 2008
Posts: 6
Issues using this for an affiliate vendor?
04-12-2008 03:43
Am I right in thinking that if you give the vendor to another agent they will have access to the contents of the vendor. If so what would need to be done to create a vendor that can be freely distributed without making the contents generally available unless purchased?