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
Texture TWOBUTTON_TEXTURE_VENDOR  

TWOBUTTON_TEXTURE_VENDOR

TWO-BUTTON TEXTURE VENDOR by Thili Playfair and Karandras Banjo.lsl

Category: Texture
By : Thili Playfair
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for TWOBUTTON_TEXTURE_VENDOR
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. TWOBUTTON_TEXTURE_VENDOR_by_Thili_P_1.lsl
1
2 // TWO-BUTTON TEXTURE VENDOR
3 // Origional script by Thili Playfair
4 // Heavily Modified by Karandas Banjo
5 // Please include these names if you modify or
6 // re-distribute this code ^_^
7
8 // To set up your vendor, you will need at least 3 prims,
9 // the main prim, and two buttons.
10
11 // The two buttons must both be linked to the main prim,
12 // one must be called "next", the other called "prev".
13 // The Buttons do NOT need any script if you name them as shown above.
14
15 // Next, enter the price of the textures in this vendor,
16 // and if you want, time to wait for auto-scrolling.
17
18 // After that, just drop your textures into the main prim,
19 // and press one of the scroll buttons, and you're ready
20 // to go!
21
22 integer price = 50; // The price of any texture in this
23 // vendor.
24 // Added touch-giving for when price is set to L$0
25
26
27 float time = 0; // Enter a value if you want time based
28 // scrolling otherwise set to zero.
29
30 // NO TOUCHY BELOW HERE
31
32 string vendorname;
33 integer total;
34 integer counter;
35 integer change;
36
37 next()
38 {
40 vendorname = llGetObjectName();
41 counter++;
42 if(counter>=total)
43 {
44 counter=0;
45 }
47 if(price > 0)
48 {
49 llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_TEXTURE, counter) + "\n L$" + (string)price + "\n", <1,1,1>, 1);
50 }
51 else
52 {
53 llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_TEXTURE, counter) + "\n Touch to recieve \n", <1,1,1>, 1);
54 }
55 llTriggerSound("Pressed", 1);
56 }
57 prev()
58 {
60 vendorname = llGetObjectName();
61 if(counter > 0)
62 {
63 counter--;
64 }
65 else
66 {
67 counter=total - 1;
68 }
70 if(price > 0)
71 {
72 llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_TEXTURE, counter) + "\n L$" + (string)price + "\n", <1,1,1>, 1);
73 }
74 else
75 {
76 llSetText(vendorname + "\n" + llGetInventoryName(INVENTORY_TEXTURE, counter) + "\n Touch to recieve \n", <1,1,1>, 1);
77 }
78 llTriggerSound("Pressed", 1);
79 }
80
81 default
82 {
84 {
86 next();
87 llSetTimerEvent(time);
88 }
89 touch_start(integer total_number)
90 {
92 {
93 next();
94 }
96 {
97 prev();
98 }
99 else
100 {
101 if(price > 0)
102 {
103 llWhisper(0, "Pay L$" + (string)price + " to buy");
104 }
105 else
106 {
108 }
109 }
110 }
111 timer()
112 {
113 next();
114 }
115 money(key giver, integer amount)
116 {
117 if(amount < price)
118 {
119 llSay(0, "Too little payed, refunding");
120 llGiveMoney(giver, amount);
121 }
122 else if(amount > price)
123 {
124 change = amount - price;
125 llSay(0, "Overpaid. vending item and giving L$" + (string)change + " change");
126 llGiveMoney(giver, change);
128 llInstantMessage(llGetOwner(), llKey2Name(giver) + " bought " + llGetInventoryName(INVENTORY_TEXTURE, counter) + " for L$" + (string)price);
129 }
130 else if(amount == price)
131 {
133 llInstantMessage(llGetOwner(), llKey2Name(giver) + " bought " + llGetInventoryName(INVENTORY_TEXTURE, counter) + " for L$" + (string)price);
134 }
135 }
136 on_rez(integer start_param)
137 {
139 }
140 }// END //

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