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 Vendor_System_Script  

Vendor_System_Script

What it does:
// 1. it asks the o...

Category: Vendor
By : Kristy Fanshaw
Created: 2011-01-22 Edited: 2011-01-22
Worlds: Second Life

the Zip file

Download all files for Vendor_System_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Vendor_System_Script_1.lsl
Get file # 2. Vendor_System_Script_2.lsl
Get file # 3. Vendor_System_Script_3.lsl
Get file # 4. Vendor_System_Script_4.lsl
1 ////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2008 by Kristy Fanshaw //
3 // This script is part of Vendor System. //
4 ////////////////////////////////////////////////////////////////////////////////////////////////
5 // Vendor System is free software: you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation, either version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // Vendor System is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License for more details. //
14 // //
15 // To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. //
16 ////////////////////////////////////////////////////////////////////////////////////////////////
17
18 integer gCorrectAmount = 10; // enter the price for fast pay
19 integer my_profit = 50; // how many percent you would like to recieve form the sale
20 string update_box = "update box name"; // describe the name of the "update box" object that should be rezzed
21 string name = "my vendor name"; // Set the vendor name here
22
23 integer totalsold = 0;
24 integer Ch;
25 integer listen_handle;
26 integer buyer_paid;
27 key OWNER;
28 key CREATOR;
29 key ID;
30 key http_request_id;
31 string url;
32 string mail;
33
34 default
35 {
36 changed(integer change)
37 {
38 if(change & CHANGED_OWNER)
39 {
40 llSetObjectDesc("0");
42 }
43 }
44 on_rez(integer start_param)
45 {
47 }
49 {
50 OWNER = llGetOwner();
51 CREATOR = llGetCreator();
52 Ch = ( -1 * (integer)("0x"+llGetSubString((string)CREATOR,-7,-1)) );
53 totalsold = (integer)llGetObjectDesc();
54 llSetObjectName(name);
55 llSetPayPrice(PAY_HIDE, [gCorrectAmount, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
56 llSetText("To start vendor, rezz '" + update_box + "'.", <1.0, 1.0, 1.0>, 1.0);
57 llSensorRepeat(update_box, NULL_KEY , SCRIPTED, 10 , PI, 10);
58 }
59 sensor (integer numberDetected)
60 {
61 state sens;
62 }
63 no_sensor ()
64 {
66 }
67 }
68 state sens1
69 {
71 {
72 state sens;
73 }
74 }
75 state sens
76 {
77 on_rez(integer start_param)
78 {
80 }
82 {
83 llSetText("Updating", <1.0, 1.0, 1.0>, 1.0);
84 llShout(Ch,"update");
85 listen_handle = llListen(Ch,update_box, NULL_KEY, "");
86 llSensorRepeat(update_box, NULL_KEY , SCRIPTED, 10 , PI, 5);
87 }
88 listen( integer channel, string name, key id, string message )
89 {
90 url = message;
91 llOwnerSay("updated");
92 llShout(Ch,"updated");
93 llListenRemove(listen_handle);
94 }
95 sensor (integer numberDetected)
96 {
97 llListenRemove(listen_handle);
98 state sens1;
99 }
100 no_sensor ()
101 {
102 llSetText("Touch to grant debit permission.", <1.0, 1.0, 1.0>, 1.0);
103 }
104 touch_start(integer total_number)
105 {
107 }
109 {
110 if(Permission == PERMISSION_DEBIT)
111 {
112 llOwnerSay("Starting vendor.");
113 llSetText("", <1.0, 1.0, 1.0>, 1.0);
114 state Ready;
115 }
116 else
117 {
118 llOwnerSay( "To share proceeds I must have give money(DEBIT) permissions");
119 llOwnerSay( "Try again");
121 }
122 }
123 }
124 state Ready1
125 {
127 {
128 state Ready;
129 }
130 }
131 state Ready
132 {
133 on_rez(integer start_param)
134 {
136 }
138 {
139 llSensorRepeat(update_box, NULL_KEY , SCRIPTED, 10 , PI,30);
140 }
141 sensor (integer numberDetected)
142 {
143 llSetText("Updating", <1.0, 1.0, 1.0>, 1.0);
144 llShout(Ch,"update");
145 listen_handle = llListen(Ch,update_box, NULL_KEY, "");
146 }
147 listen( integer channel, string name, key id, string message )
148 {
149 url = message;
150 llOwnerSay("updated");
151 llShout(Ch,"updated");
152 llSetText("", <1.0, 1.0, 1.0>, 1.0);
153 llListenRemove(listen_handle);
154 }
155 touch_start(integer total_number)
156 {
157 if(llDetectedOwner(0) == OWNER)
158 {
159 llOwnerSay((string)totalsold +" units have been sold since object rez. ");
160 }
161 else
162 {
163 llInstantMessage(llDetectedKey(0), "Right-click and pay to purchase.");
164 }
165 }
166 money(key id, integer amount)
167 {
168 ID =id;
169 buyer_paid = amount;
170 {
171 if(amount == gCorrectAmount)
172 {
173 llInstantMessage(id, "Thank you " + llKey2Name(id) + " for your purchase.");
174 llInstantMessage(id,"Server initialises your request .....");
175 http_request_id = llHTTPRequest(url, [], "");
176 }
177 else if(amount < gCorrectAmount)
178 {
179 llInstantMessage(llDetectedKey(0),"You didn't pay enough, " + llKey2Name(id) + ". Refunding your payment of L$" + (string)amount + ".");
180 llGiveMoney(id, amount);
181 state Ready1;
182 }
183 else
184 {
185 integer refund = amount - gCorrectAmount;
186 llInstantMessage(llDetectedKey(0),"You paid too much, " + llKey2Name(id) + ". Your change is L$" + (string)refund + ".");
187 llGiveMoney(id, refund);
188 llInstantMessage(id, "Thank you " + llKey2Name(id) + " for your purchase.");
189 llInstantMessage(id,"Server initialises your request .....");
190 http_request_id = llHTTPRequest(url, [], "");
191 }
192 }
193 }
194 http_response(key request_id, integer status, list metadata, string body)
195 {
196 mail =body;
197 {
198 if(request_id == http_request_id)
199 {
200 if(llGetSubString(body, -19, -1) == "@lsl.secondlife.com")
201 {
202 llInstantMessage(ID,"Request initialised.");
203 llInstantMessage(ID,"Sending your requested items .....");
204 llSetText("Purchase in progress...\n\nPlease Wait...", <1.0, 1.0, 1.0>, 1.0);
206 llEmail( body, ID, (string)llGetKey()+"@lsl.secondlife.com" );
208 llGetNextEmail("", "");
209 }
210 else
211 {
212 llGiveMoney(ID, buyer_paid);
213 llInstantMessage(ID, "Vendor is outdated");
214 llInstantMessage(OWNER, "Your Vendor in " + llGetRegionName() + " sim can't deliver items. Please update your Vendor.");
216 }
217 }
218 }
219 }
220 email( string time, string address, string subj, string message, integer num_left )
221 {
222 if(subj == "delivered")
223 {
224 float profit = (my_profit + 0.0) / 100;
225 float calc = buyer_paid + 0.0;
226 float a = calc * profit;
227 float b = buyer_paid - a;
228 llGiveMoney( CREATOR, llFloor((integer)a) );
229 llInstantMessage(ID,"Accept your purchased items");
230 totalsold = totalsold + 1;
231 llSetObjectDesc((string)totalsold);
232 llInstantMessage(OWNER, (string)llKey2Name(ID) + " has paid " + (string)buyer_paid + "L$ in "+ llGetRegionName() + " and you have recived " + (string)llCeil(b) + "L$ from this sale");
233 llInstantMessage(CREATOR, (string)llKey2Name(ID) + " has paid " + (string)buyer_paid + "L$ in "+ llGetRegionName() + " and you have recived " + (string)llFloor(a) + "L$ from this sale");
234 llSetPayPrice(PAY_HIDE,[gCorrectAmount, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
235 llSetText("", <1.0, 1.0, 1.0>, 1.0);
237 state Ready1;
238 }
239 }
240 timer()
241 {
242 llGiveMoney(ID, buyer_paid);
243 llInstantMessage(ID, "Vendor couldn't deliver items ... your money is refunded");
244 llInstantMessage(OWNER, "Your Vendor in " + llGetRegionName() + " sim can't deliver items. Please update your Vendor.");
245 llSetPayPrice(PAY_HIDE,[gCorrectAmount, PAY_HIDE, PAY_HIDE, PAY_HIDE]);
246 llSetText("", <1.0, 1.0, 1.0>, 1.0);
248 state default;
249 }
250 }

Vendor_System_Script

Updater Script for Reseller vendor

Place this script in a box you've created.

What it does:

1. when rezzed next to the vendor, it will try to update the vendors URL string.
2. when vendor gets the URL, the updater dies. It doesn't die until the vendor is updated.

Category: Vendor
By : Kristy Fanshaw
Created: 2011-01-22 Edited: 2011-01-22
Worlds: Second Life

1 ////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2008 by Kristy Fanshaw //
3 // This script is part of Vendor System. //
4 ////////////////////////////////////////////////////////////////////////////////////////////////
5 // Vendor System is free software: you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation, either version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // Vendor System is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License for more details. //
14 // //
15 // To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. //
16 ////////////////////////////////////////////////////////////////////////////////////////////////
17
18 string URL = "http://www.my-web.com/my-secret-webpages/my-sl-stuff/my-vendor-name/"; // Write here the URL of the page where is defined the server email address
19 string update_box = "update box name"; // Write here the name you like, but be sure the name here matches with a name in vendor script
20 integer Ch;
21 integer listen_handle;
22
23 default
24 {
25 state_entry ()
26 {
27 Ch = ( -1 * (integer)("0x"+llGetSubString((string)llGetCreator(),-7,-1)) );
28 listen_handle = llListen(Ch,"", NULL_KEY, "");
29 llSetObjectName(update_box);
30 llSetText("Updating your vendor\n\nPlease Wait ...", <1.0, 1.0, 1.0>, 1.0);
31 }
32 listen( integer channel, string name, key id, string message )
33 {
34 if(message == "update")
35 {
36 llShout(Ch, URL);
37 }
38 else if(message == "updated")
39 {
40 llDie();
41 }
42 }
43 }

Vendor_System_Script

Server Script and Mailer Script for "Server Object"

Place these scripts into a box you've created as a server prim.
Place the object you'd like to sell into this prim - only one object

Server Script:

1. when rezzed, it will tell you it's email address.
2. when this scrpt gets an email from the vendor, it gives the inventory item to buyer and asks mailer script to send a note back to vendor that the delivery is done.
3. when touched by the owner, it says totalsold.

Category: Vendor
By : Kristy Fanshaw
Created: 2011-01-22 Edited: 2011-01-22
Worlds: Second Life

1 ////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2008 by Kristy Fanshaw //
3 // This script is part of Vendor System. //
4 ////////////////////////////////////////////////////////////////////////////////////////////////
5 // Vendor System is free software: you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation, either version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // Vendor System is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License for more details. //
14 // //
15 // To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. //
16 ////////////////////////////////////////////////////////////////////////////////////////////////
17
18 string my_address = "my.email@email.com"; // Write here the email, where you want to recieve the message with new server email address.
19 integer total_mailers = 5; // How many mailer scripts you have in server prim. 5 mailer scripts are Recomended min. because of llEmail function.
20 integer mailer = 1;
21
22 default
23 {
24 changed(integer change)
25 {
26 if(change && CHANGED_OWNER)
27 {
28 llSetObjectDesc("0");
30 }
31 }
32 on_rez(integer start_parameter)
33 {
34 llOwnerSay("new email is: " + (string)llGetKey() + "@lsl.secondlife.com");
35 llEmail(my_address,llGetObjectName() , "my new email is: " + (string)llGetKey() + "@lsl.secondlife.com");
36 llOwnerSay("message with new address is sent to your email");
37 }
39 {
41 llSetText(llGetObjectName(),<1,1,1>,1);
42 totalsold = (integer)llGetObjectDesc();
43 llOwnerSay("new email is: " + (string)llGetKey() + "@lsl.secondlife.com");
44 llEmail(my_address,llGetObjectName() , "my new email is: " + (string)llGetKey() + "@lsl.secondlife.com");
45 llOwnerSay("message with new address is sent to your email");
46 llSetTimerEvent(5.0);
47 }
48 timer()
49 {
50 llGetNextEmail("", "");
51 }
52 email( string time, string address, string subj, string message, integer num_left )
53 {
55 message = llDeleteSubString(message, 0, llSubStringIndex(message, "\n\n") +1);
56 llMessageLinked(LINK_THIS, mailer, message, "");
57 if(mailer <= total_mailers)
58 {
59 mailer = mailer + 1;
60 }
61 if(mailer >= total_mailers + 1)
62 {
63 mailer = 1;
64 }
65 totalsold = totalsold + 1;
66 llSetObjectDesc((string)totalsold);
67 llGetNextEmail("", "");
68 }
69 touch_start(integer total_number)
70 {
72 {
73 llOwnerSay((string)totalsold +" units have been sold since server update. ");
74 }
75 else
76 {
77 llInstantMessage(llDetectedKey(0), "please don't touch");
78 }
79 }
80 }

Vendor_System_Script

Mailer script.

1. Make as many numbers of mailer sciprts you need and place them into server object.
2. Name them with numbers starting from number "1".
3. Don't skip any numbers: if you have 5 mailer scripts in you server object then you their names should be 1, 2, 3, 4 and 5.

Category: Vendor
By : Kristy Fanshaw
Created: 2011-01-22 Edited: 2011-01-22
Worlds: Second Life

1 ////////////////////////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2008 by Kristy Fanshaw //
3 // This script is part of Vendor System. //
4 ////////////////////////////////////////////////////////////////////////////////////////////////
5 // Vendor System is free software: you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation, either version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // Vendor System is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License for more details. //
14 // //
15 // To get a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>. //
16 ////////////////////////////////////////////////////////////////////////////////////////////////
17
18 string mailer_num;
19
20 default
21 {
22 link_message(integer sender_num, integer num, string msg, key id)
23 {
24 mailer_num = llGetScriptName();
25 if(num == (integer)mailer_num)
26 {
27 llEmail(msg,"delivered", (string)num);
28 }
29 }
30 }

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