Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Vendor SINGLE_ITEM_ONE_PRIM_VENDOR_by_Wedn  

SINGLE_ITEM_ONE_PRIM_VENDOR_by_Wedn

SINGLE ITEM ONE PRIM VENDOR by Wednesday Grimm.lsl

Category: Vendor
By : Wednesday Grimm
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for SINGLE_ITEM_ONE_PRIM_VENDOR_by_Wedn
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. SINGLE_ITEM_ONE_PRIM_VENDOR_by_Wedn_1.lsl
1
2 // vendor
3 // Wednesday Grimm
4 // June 10, 2003
5 //
6 // Simple vending script, gives correct change.
7
8
9
10 //////////////////////////////////////////////////////////////////////////////////////////
11 // HOW TO USE THIS SCRIPT By Jacqueline Bancroft
12 //
13 //This is a vendor program for a single item. This is how it works:
14 //
15 //You rez a cube and pretty it up.. maybe put a texture of what you're selling on the side.
16 //Put the item that you want to sell into the cube you made.
17 //Put this script inside the cube you made, and then open up the script to edit it.
18 //
19 //Where it says gPrice, put the price of the item you want to sell after the equal sign.
20 //
21 //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".
22 //
23 //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.
24 //
25 //That's about it. Be sure to thank Wednesday if you use this script.
26 //////////////////////////////////////////////////////////////////////////////////////////
27
28
29
30
31
32
33 integer gPrice = 5; // cost of the item
34
35 // name of the item in object's inventory, to vend
36 string itemName = "test_note";
37
38 // two summary lines to describe the object
39 string summary1 = "this is a test note, it tests this script";
40 string summary2 = "it is very interesting. Cost is $5";
41
42 // give the item to a customer
43 dispense(key toWhom)
44 {
45 llGiveInventory(toWhom, itemName);
46 }
47
48 default
49 {
51 {
52 // we need this permission to give change
54 }
55
56 touch_end(integer total_number)
57 {
58 // if someone touches object describe what's for sale
59 llWhisper(0, summary1);
60 llWhisper(0, summary2);
61 }
62
63 money(key id, integer amt)
64 {
65 if(amt >= gPrice)
66 {
67 // customer has given us at least enough money
68 amt -= gPrice;
69 dispense(id);
70 }
71 if(amt > 0) // give back change
72 {
73 llGiveMoney(id, amt);
74 }
75 }
76 }// END //

Back to the Best Free Tools in Second Life and OpenSim.