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
Rental rental_bot  

rental_bot

Rentals Help
----------------

...

Category: Rental
By : deaz
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for rental_bot
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. rental_bot_1.lsl
1 // several compil errors andsyntax repairs, re-formatted by Ferd Frederix
2
3 list splitwith;
4 list splitname;
5 string ownername;
6 integer not_registered = TRUE;
7 vector original_location;
8 vector original_scale;
9 integer objects = 25; // objects
10 integer price = 350; // price
11 integer weeks = 1; // weaks
12 vector offset = <0, 0, 2>;
13 integer mature = 0;
14 string rentor;
15 string rentorkey;
16 integer rented = FALSE;
17 string rentperiod;
18 integer numListen;
19 integer randchannel;
20 integer editmode;
21 integer stopper;
22 string daterented;
23 integer rentedweeks;
24 integer timerevent;
25
26 default
27 {
28 on_rez(integer change)
29 {
30 llInstantMessage(llGetOwner(),"for help click item then select help from menu");
31 llSetTexture("rentit", ALL_SIDES);
33 llListen(0,"","","");
34 randchannel = (integer)llFrand(10000000);
35 llListen(randchannel,"","","");
36 editmode = 0;
37 timerevent = 0;
38 rented = FALSE;
39 }
40
41 listen(integer c, string n, key id, string m)
42 {
43 stopper = 0;
44 string objectname;
45 objectname = llGetObjectName();
46 if(m == "Vacent" && c == randchannel && id == llGetOwner() && rented == TRUE)
47 {
48 llSetTexture("rentit", ALL_SIDES);
49 llSetPos(original_location);
50 llSetScale(original_scale);
51 llListenRemove(numListen);
52 numListen = llListen(0, "", "", "" );
53 rentperiod = "";
54 rentor = "";
55 rentorkey = NULL_KEY;
56 rented = FALSE;
57 daterented = "";
58 rentedweeks = 0;
59 timerevent = 0;
61 llSay(0, objectname + " is vacent");
62 }
63 if(m == "Mature" && c == randchannel && id == llGetOwner())
64 {
65 mature = 1;
66 llSay(0,"set to Mature Area");
67 }
68 if(m == "Renter info" && c == randchannel && id == llGetOwner())
69 {
70 integer weeks2;
71 weeks2 = timerevent / 7 / 24 / 60 / 60;
72 integer days;
73 days = timerevent / 24 / 60 / 60 - (weeks2 * 7);
74 integer hours;
75 hours = timerevent / 60 / 60 - (weeks2 * 7 * 24) - (days * 24);
76 integer mins;
77 mins = timerevent / 60 - (weeks2 * 7 * 24 * 60) - (days * 24 * 60) - (hours * 60);
78 integer seconds;
79 seconds = timerevent - (weeks2 * 7 * 24 * 60 * 60) - (days * 24 * 60 * 60) - (hours * 60 * 60) - (mins * 60);
80 llInstantMessage(llGetOwner(),"Rented Date: " + daterented);
81 llInstantMessage(llGetOwner(),"Rented Left: " + (string)weeks2 + " weeks | " + (string)days + " days | " + (string)hours + ":" + (string)mins + ";" +(string)seconds);
82 if(rentedweeks >= 2)
83 {
84 llInstantMessage(llGetOwner(),"Rented amount: " + (string)rentedweeks + " weeks");
85 }
86 if(rentedweeks == 1)
87 {
88 llInstantMessage(llGetOwner(),"Rented amount: " + (string)rentedweeks + " week");
89 }
90 if(rentedweeks <= 0)
91 {
92 llInstantMessage(llGetOwner(),"Rented amount: N/A");
93 }
94 }
95 if(m == "PG" && c == randchannel && id == llGetOwner())
96 {
97 mature = 0;
98 llSay(0,"set to PG Area");
99 }
100 if(m == "Status" && c == randchannel && id == llGetOwner())
101 {
102 string mit;
103 llInstantMessage(llGetOwner(),"Prim's set to " + (string)objects);
104 llInstantMessage(llGetOwner(),"Week's set to " + (string)weeks);
105 llInstantMessage(llGetOwner(),"Offset set to " + (string)offset);
106 if(mature == 1)
107 {
108 mit = "Yes";
109 }
110 else
111 {
112 mit = "No";
113 }
114 llInstantMessage(llGetOwner(),"Regen Mature: " + (string)mit);
115 }
116 if(m == "Edit Mode" && editmode == 0 && stopper == 0 && c == randchannel && id == llGetOwner())
117 {
118 stopper = 1;
119 editmode = 1;
120 llInstantMessage(llGetOwner(),"editmode on");
121 }
122 if(m == "Edit Mode" && editmode == 1 && stopper == 0 && c == randchannel && id == llGetOwner())
123 {
124 stopper = 1;
125 editmode = 0;
126 llInstantMessage(llGetOwner(),"editmode off");
127 }
128
129 if(m == "Help" && c == randchannel && id == llGetOwner())
130 {
131 llGiveInventory(llGetOwner(), "Rentals Help");
132 }
133 if(llGetSubString(m,0,8) == "set weeks" && id==llGetOwner() && editmode == 1)
134 {
135 weeks = (integer)llGetSubString(m,9,llStringLength(m));
136 llSay(0,"weeks set to " + (string)weeks);
137 }
138 if(llGetSubString(m,0,10) == "set renter " && id==llGetOwner() && editmode == 1)
139 {
140 rentor = llGetSubString(m,11,llStringLength(m));
141 llSay(0,"renter set to " + rentor);
142 }
143 if(llGetSubString(m,0,9) == "set split " && id==llGetOwner() && editmode == 1)
144 {
145 key id1 = (key)llGetSubString(m,10,llStringLength(m));
146 splitwith += id1;
147 splitname += llKey2Name(id1);
148 llSay(0,llKey2Name(id1) + "added to split with list");
149 }
150 if(llGetSubString(m,0,12) == "split remove " && id==llGetOwner() && editmode == 1)
151 {
152 string name = llGetSubString(m,13,llStringLength(m));
153 integer finddata = llListFindList(splitname,(list)name);
154 if(finddata == -1)
155 {
156 llSay(0,"sorry " + name + " not found");
157 }else
158 {
159 llDeleteSubList(splitwith,finddata,finddata);
160 llDeleteSubList(splitname,finddata,finddata);
161 llSay(0,name +" removed from shared list");
162 }
163 }
164 if(llGetSubString(m,0,13) == "set rentedfor " && id==llGetOwner() && editmode == 1)
165 {
166 string date = llGetTimestamp();
167 daterented = llGetSubString(date,8,9) + "/" + llGetSubString(date,5,6) + "/" + llGetSubString(date,0,3) + " | Time " + llGetSubString(date,11,15);
168 original_scale = llGetScale();
169 original_location = llGetPos();
170 list renttime = llParseStringKeepNulls(llGetSubString(m,14,llStringLength(m)), [":"], []);
171 integer days = llList2Integer(renttime,0);
172 integer hours = llList2Integer(renttime,1);
173 integer minites = llList2Integer(renttime,2);
174 integer seconds = llList2Integer(renttime,3);
175 integer total;
176 total = (days * 24 * 60 * 60) + (hours * 60 * 60) + (minites * 60) + (seconds);
177 llSetTexture("info", ALL_SIDES);
178 llSetPos(original_location + offset);
179 llSetScale(<0.236,0.236,0.236>);
180 timerevent = total;
182 llWhisper(0,"set to " + (string)days + " days " + (string)hours + " hours " + (string)minites + " mins " + (string)seconds + " seconds");
183 rented = TRUE;
184 }
185 if(llGetSubString(m,0,10) == "set offset " && id==llGetOwner() && editmode == 1)
186 {
187 offset = (vector)llGetSubString(m,11,llStringLength(m));
188 llSay(0,"Offset set to " + (string)offset);
189 }
190 if(llGetSubString(m,0,8) == "set prims" && id==llGetOwner() && editmode == 1)
191 {
192 objects = (integer)llGetSubString(m,9,llStringLength(m));
193 llSay(0,"Prims set to " + (string)objects);
194 }
195 if(llGetSubString(m,0,8) == "set price" && id==llGetOwner() && editmode == 1)
196 {
197 price = (integer)llGetSubString(m,9,llStringLength(m));
198 llSay(0,"Price set to L$" + (string)price);
199 }
200
201 }
203 {
204 editmode = 0;
205 randchannel = (integer)llFrand(10000000);
206 llWhisper(0, "Activating...");
207 ownername = llKey2Name(llGetOwner());
208 llWhisper(0, "Asking for permission from owner " + ownername + ".");
210 original_location = llGetPos();
211 original_scale = llGetScale();
212 llListenRemove(numListen);
213 rentedweeks = 0;
214 numListen = llListen(0, "", "", "" );
215 llListen(randchannel,"","","");
216 timerevent = 0;
217 }
218
220 {
221 if(type == PERMISSION_DEBIT)
222 {
223 ownername = llKey2Name(llGetOwner());
224 llWhisper(0, "This space is now available for rent.");
225 not_registered = FALSE;
226 }
227 }
228
229 timer()
230 {
231 timerevent--;
232 if(! timerevent)
233 {
234 if(rentorkey != (string) NULL_KEY)
235 {
236 llInstantMessage(rentorkey,"Your rental at " + llGetRegionName() + " has expired");
237 }
238 llSay(0,"rental expired");
239 string objectname;
240 objectname = llGetObjectName();
241 llSetTexture("rentit", ALL_SIDES);
242 llSetPos(original_location);
243 llSetScale(original_scale);
244 numListen = llListen(0, "", "", "" );
245 rentperiod = "";
246 rentor = "";
247 rentorkey = NULL_KEY;
248 daterented = "";
249 rentedweeks = 0;
250 rented = FALSE;
251 timerevent = 0;
253 }
254 }
255
256 touch_start(integer total_number)
257 {
259 {
260 string edit;
261 if(editmode == 0)
262 {
263 edit = "off";
264 }
265 if(editmode == 1)
266 {
267 edit = "on";
268 }
269 llDialog(llGetOwner(),"vender editor \n editmode is set to: " + edit,["Mature","PG","Vacent","Edit Mode","Renter info","Help","Status"],randchannel);
270 }
271 else
272 {
273 if(rented == FALSE)
274 {
275 llWhisper(0, "This space is for rent. The price is $" +(string)price+ " per week. Prim limit is "+(string)objects+" prims. Obey prim limits to avoid termination of agreement. Rent is non-refundable.");
276 if(mature == 1)
277 {
278 llWhisper(0, "Usage Restrictions: This spot is for comercial use. Keep within prim limits or face termination of lease.");
279 } else {
280 llWhisper(0, "Usage Restrictions: This spot is for comercial use. Keep within prim limits or face termination of lease. Keep To PG Rules as in PG Sim");
281 }
282 llWhisper(0, "Right click and pay to rent this space. Minimum rental period is "+(string)weeks+" weeks, at $" +(string)(price*weeks)+". If you have any questions, please feel free to IM " + ownername + ". For Help please IM " + ownername + ".");
283 }
284 else
285 {
286 integer weeks2;
287 weeks2 = timerevent / 7 / 24 / 60 / 60;
288 integer days;
289 days = timerevent / 24 / 60 / 60 - (weeks2 * 7);
290 integer hours;
291 hours = timerevent / 60 / 60 - (weeks2 * 7 * 24) - (days * 24);
292 integer mins;
293 mins = timerevent / 60 - (weeks2 * 7 * 24 * 60) - (days * 24 * 60) - (hours * 60);
294 integer seconds;
295
296 seconds = timerevent - (weeks2 * 7 * 24 * 60 * 60) - (days * 24 * 60 * 60) - (hours * 60 * 60) - (mins * 60);
297 llWhisper(0, "This space is occupied by " + rentor + " for " + (string)weeks2 + " weeks | " + (string)days + " days | " + (string)hours + ":" + (string)mins + ";" +(string)seconds);
298 llWhisper(0, "Max prims is " + (string)objects + ". For help please IM " + ownername + ".");
299 }
300 }
301 }
302
303 money(key giver, integer amount)
304 {
305 integer amount2 = amount%price;
306 integer weeks = amount/price;
307 if(amount>=price*weeks && amount2==0 && rented == FALSE)
308 {
309 rentedweeks = amount/price;
310 string date = llGetTimestamp();
311 daterented = llGetSubString(date,8,9) + "/" + llGetSubString(date,5,6) + "/" + llGetSubString(date,0,3) + " | Time " + llGetSubString(date,11,15);
312 original_scale = llGetScale();
313 original_location = llGetPos();
314 timerevent = 604800*weeks;
315 //vector offset = <-2, 0, -1>;
316 llWhisper(0, "Correct amount");
317 rentor = llKey2Name(giver);
318 rented = TRUE;
319 rentperiod = (string)weeks;
320 llWhisper(0, "Prim limit is "+(string)objects+" prims.");
321 llWhisper(0, "Keep prim limits or risk termination of agreement.Rent is non-refundable. IM " + ownername + " with questions.");
322 llWhisper(0, "Thank you for renting this space . Thank You For Purchasing "+(string)weeks+" weeks . Feel Free To Put Your stuff in now");
323 llSetTexture("info", ALL_SIDES);
324 llSetPos(original_location + offset);
325 llSetScale(<0.236,0.236,0.236>);
326 rentorkey = giver;
328 if(splitwith != [])
329 {
330 integer devide = llGetListLength(splitwith) + 1;
331 integer totatogive = amount/devide;
332 integer no;
333 while(no < llGetListLength(splitwith))
334 {
335 key dest = llList2Key(splitwith,no);
336 llGiveMoney(dest,totatogive);
337 llInstantMessage(dest,"you have bee payed L$"+ (string)totatogive +" by " + llGetObjectName());
338 no ++;
339 }
340 }
341 }
342 else if(rented == TRUE)
343 {
344 if(llKey2Name(giver) == rentor && amount>=price*weeks && amount2==0)
345 {
346 timerevent += (604800*weeks);
347 llSay(0, "you have incresed your rental by " + (string)weeks + " weeks");
348 rentedweeks += weeks;
349 if(splitwith != [])
350 {
351 integer devide = llGetListLength(splitwith) + 1;
352 integer totatogive = amount/devide;
353 integer no;
354 while(no < llGetListLength(splitwith))
355 {
356 key dest = llList2Key(splitwith,no);
357 llGiveMoney(dest,totatogive);
358 llInstantMessage(dest,"you have bee payed L$"+ (string)totatogive +" by " + llGetObjectName());
359 no ++;
360 }
361 }
362 }
363 else
364 {
365 llGiveMoney(giver, amount);
366 llSay(0,"sorry please check rental");
367 }
368 }
369 else
370 {
371 llWhisper(0, "Minimum rental period is "+(string)weeks+" weeks, at $" +(string)(price*weeks)+ ". If you have any questions, please feel free to IM" + ownername + ".");
372 llWhisper(0, "Giving money back.");
373 llGiveMoney(giver, amount);
374 }
375 }
376 }

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