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
Profile Status Profile_Display  

Profile_Display

The script:

Category: Profile Status
By : generaal.joubert
Created: 2013-04-08 Edited: 2013-04-08
Worlds: Second Life

the Zip file

Download all files for Profile_Display
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Profile_Display_1.lsl
1 //************************
2 // GENERAL PARAMETERS
3 //************************
4
5 // listen channel for Owner
6 integer OwnerChannel = 54321;
7
8 // set the maximum number of entries in the 'Exclude List' at any one time
9 integer ExcludeListSize = 30;
10
11 // the number of seconds that a listen remains open before timing-out & automatically closing
12 float DialogTimeout = 20.00;
13
14 // how often in seconds the sensor fires
15 float RepeatTime = 35.00;
16
17 // sensor range in meters. Maximum 96m but in practice 10 to 30m because of particle draw distance
18 float Range = 25.00;
19
20 // sets the number of consecutive times that the scanner is allowed to operate without having located an AV within range
21 // eg: if RepeatTime = 60.0 seconds and TotalNoScansAllowed = 30, then the toy will operate for 1800 seconds (60x30, or 30 minutes) without locating
22 // anyone before it automatically powers down. Set to '0' to disable the auto-off function
23 integer TotalNoScansAllowed = 20;
24
25 // texture palette of UUID's. One will be randomly selected for display when an AV without a profile pic is selected
26 list DefaultTexturePalette = ["8fb9ad84-4183-51df-f566-9b21c3a610fe", "1201c3de-d022-c0a5-56bd-bc49ab971726", "c3eebd9e-ee92-a16f-f906-bc275928df86"];
27
28 // sets whether the DefaultTexturePalette will be used to texture/project when the toy is switched OFF. 'TRUE' to texture/project; 'FALSE' to have no texturing/projection when off
29 integer EmployDefaultTexture = TRUE;
30
31
32 //************************
33 // PARTICLE EMISSION PARAMETERS
34 //************************
35
36 // set to TRUE to display the profile picture as a particle 'holographic' image above the prim
37 integer DisplayBanner = TRUE;
38
39 // width size in meters of the projected image (max 4.00)
40 float Size = 2.50;
41
42 // height above object the centre of projected image will be (theoretical max. 50.0, in practice 2.0 to 10.0))
43 float Height = 2.50;
44
45
46 //************************
47 // PRIM TEXTURE PARAMETERS
48 //************************
49
50 // set to TRUE to texture the prim with the profile picture on ALL_SIDES
51 integer TexturePrim = TRUE;
52
53 // the following 'Prim*' parameters effect the prim only if("EmployDefaultTexture = FALSE") OR ("EmployDefaultTexture = TRUE" and "TexturePrim=FALSE")
54 // if TexturePrim = TRUE then the prim is automatically set to solid blank white no shiny with full bright as this is usually the best surface to display the profile picture
55
56 // texture to use for the prim when toy is OFF
57 key PrimUUIDTexture = "5748decc-f629-461c-9a36-a35a221fe21f";
58
59 // set to TRUE to turn on Full Bright on ALL_SIDES when the toy is OFF
60 integer PrimFullBright = FALSE;
61
62 // vector for the prim colour when toy is OFF
63 vector PrimColour = <0.0, 0.0, 0.0>;
64
65 // set the alpha of the prim from 0.0 (clear) to 1.0 (solid) for when toy is OFF
66 float PrimAlpha = 1.00;
67
68 // set the degree of 'shininess' to apply to the prim "0" = None, "1" = Low, "2" = medium, "3" = high
69 integer PrimShine = 3;
70
71
72 //************************
73 // FLOATING TEXT PARAMETERS
74 //************************
75 // set to TRUE for floating text above the prim; FALSE to disable the floating text
76 integer ApplyFloatingText = TRUE;
77
78 // set the text to be displayed
79 string FloatingText = "'Touch' for more information";
80
81 // set the text colour
82 vector FloatingTextColour = <1.0,1.0,0.0>;
83
84 // set the text alpha
85 float FloatingTextAlpha = 0.8;
86
87
88 //************************
89 // ROTATION PARAMETERS
90 //************************
91
92 // if TRUE, applies a slow rotation to the prim when the toy is swtiched ON and TexturePrim = TRUE; FALSE to disable rotation
93 integer ApplyRotation = FALSE;
94
95
96 //************************
97 // SHOUTOUT PARAMETERS
98 //************************
99
100 // set to 'TRUE' to give a 'ShoutOut' to the AV once they have been selected; 'FALSE' for no 'ShoutOut'
101 integer ShoutOut = TRUE;
102
103 // text to 'ShoutOut' when an AV's profile is projected. Text will be preceeded by their name, eg: "<AV Name>'s face is up in lights!"
104 string ShoutOutText = "'s face is up in lights!";
105
106
107
108
109 //************************
110 // ** DO NOT CHANGE BELOW THIS LINE **
111 //************************
112
113
114
115
116 integer Power = FALSE;
117 integer ListenChannel;
118 integer OwnerListenChannel;
119 integer NoSensorCounter = 0;
120 key AVKey = "";
121 key DetectedUser = "";
122 key ObjectOwner = "";
123 key LastTexture = "";
124 string OwnerName = "";
125 string ObjectName = "Profile Projector";
126 string Author = "Debbie Trilling";
127 string Supplier = "The Particle Crucible";
128 string Version = " v5.4.5";
129 string OwnerListenText = "OpenListen";
130 string SelfExcludedSuffix = "**";
131 string PowerText = "On";
132 list ExcludeListing = [];
133
134
135
136 GiveShoutOut()
137 {
138 // any interaction with selected AV (give Inventory items etc) can safely be done from this function
139 // this function will only execute if ShoutOut == TRUE
140
141 //although fondly calling it a 'ShoutOut', it actually makes more sense to keep within the 20m range of llSay
142 llSay(0, llKey2Name(AVKey) + ShoutOutText);
143
144 }
145
146
147 AnnounceWelcome()
148 {
150 "\nThank you for your interest in this " + ObjectName + " "
151 + Version + " created by " + Author + " at " + Supplier + ". \nHelp setting up, configuring and operating the "
152 + ObjectName + " can be gotton at http://wiki.secondlife.com/wiki/Talk:Random_AV_Profile_Projector \nTOUCH the " + ObjectName + " to operate it.");
153 }
154
155
156 InitialiseObject()
157 {
159 StopRotation();
160 ObjectOwner = llGetOwner();
161 OwnerName = llKey2Name(ObjectOwner);
162 llSetObjectName(ObjectName + Version);
163 llSetObjectDesc("Supplied free by " + Author + "'s " + Supplier);
164 CloseAllListens();
165 }
166
167
168 SetFloatingText()
169 {
170 if(ApplyFloatingText)
171 {
172 llSetText(FloatingText, FloatingTextColour, FloatingTextAlpha);
173 }
174 else
175 {
176 llSetText("",<1.0,1.0,1.0>,0.0);
177 }
178 }
179
180
181 ProjectTexture()
182 {
183 // are we going to use a default texture when toy is OFF?
184 if(EmployDefaultTexture)
185 {
186 if(TexturePrim)
187 {
188 // using a default texture
189 ApplyPrimSurface();
190 }
191 else
192 {
193 // not texturing the prim, so apply the prim preferences
194 ApplyPrimPrefs();
195 }
196 ApplyDefaultTexture();
197 }
198 else
199 {
200 // we're not doing anything when the toy is OFF; change the prim to user preferences
202 ApplyPrimPrefs();
203 }
204 }
205
206
207 ApplyPrimSurface()
208 {
209 // putting texture on the prim, let's make sure it is solid white, blank. full bright
211 }
212
213
214 ApplyPrimPrefs()
215 {
217 PRIM_TEXTURE, ALL_SIDES, PrimUUIDTexture, <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 0.000000, PRIM_COLOR, ALL_SIDES, PrimColour, PrimAlpha, PRIM_BUMP_SHINY, ALL_SIDES, PrimShine, 0 ]);
218 }
219
220
221 StartUp()
222 {
223 Power = TRUE;
224 PowerText = "Off";
225 llSensorRepeat("",NULL_KEY,AGENT,Range,PI,RepeatTime);
226 NoSensorCounter = 0;
227 ApplyPrimUpdate();
228 llOwnerSay("\nThe " + ObjectName + " is now switched ON. Please wait...");
229 }
230
231
232 ApplyPrimUpdate()
233 {
234 if(TexturePrim)
235 {
236 ApplyPrimSurface();
237
238 if(ApplyRotation)
239 {
240 llTargetOmega(<0.0,0.0,1.0>, 0.2, PI);
241 }
242 }
243 }
244
245 ApplyDefaultTexture()
246 {
247 ApplySelectedTexture((key)llList2String(DefaultTexturePalette, (integer)llFrand((float)llGetListLength(DefaultTexturePalette))));
248 }
249
250
251 string RemainingExcludeSlots()
252 {
253 string RemainingSlots = (string)(ExcludeListSize - llGetListLength(ExcludeListing)) + " slots are now available.";
254 return RemainingSlots;
255 }
256
257
258 string DeriveName(string messagecapture)
259 {
260 string DerivedName = llGetSubString(llStringTrim(messagecapture,STRING_TRIM),8,llStringLength(llStringTrim(messagecapture,STRING_TRIM)));
261 return DerivedName;
262 }
263
264
265 integer DeriveNamePosition(string messagecapture)
266 {
267 integer DerivedNamePosition = llListFindList(ExcludeListing, (list)llGetSubString(llStringTrim(messagecapture,STRING_TRIM),8,llStringLength(llStringTrim(messagecapture,STRING_TRIM))));
268 return DerivedNamePosition;
269 }
270
271
272 ApplySelectedTexture(key texture)
273 {
274 if(DisplayBanner)
275 {
276 // make the particle banner if required
277 //core code by Moriash Moreau. Adapted to suit by Debbie Trilling
283 PSYS_PART_START_COLOR, <1.0,1.0,1.0>,
284 PSYS_PART_END_COLOR, <1.0,1.0,1.0>,
285 PSYS_PART_START_SCALE, <Size * 1.6 ,Size,0.00>,
286 PSYS_PART_END_SCALE, <Size * 1.6,Size,0.00>,
288 PSYS_SRC_MAX_AGE, 0.00,
289 PSYS_SRC_ACCEL, <0.0,0.0,0.0>,
297 PSYS_SRC_OMEGA, <0.00,0.00,0.00>,
298 PSYS_SRC_TEXTURE, texture]);
299 }
300
301 if(TexturePrim)
302 {
303 llSetTexture(texture, ALL_SIDES);
304 }
305 }
306
307
308 ShutDown()
309 {
310 Power = FALSE;
311 PowerText = "On";
312 CloseAllListens();
314 StopRotation();
315 ProjectTexture();
316 llOwnerSay("\nThe " + ObjectName + " is now switched OFF.");
317 }
318
319
320 StopRotation()
321 {
322 llTargetOmega(<0.0,0.0,0.0>, 0.0, PI);
323 }
324
325
326 CloseAllListens()
327 {
328 CloseUserListen();
329 llListenRemove(OwnerListenChannel);
330 OwnerListenText = "OpenListen";
331 }
332
333
334 CloseUserListen()
335 {
336 llSetTimerEvent(0.0);
337 llListenRemove(ListenChannel);
338 }
339
340
341 default
342 {
343
344 on_rez(integer start_param)
345 {
346 // reset script on rez
348 }
349
350 changed( integer change )
351 {
352 if(change & CHANGED_OWNER )
353 {
354 // reset script on change of owner
356 }
357 }
358
360 {
361 //initialise system
362 InitialiseObject();
363 SetFloatingText();
364 ProjectTexture();
365 AnnounceWelcome();
366 }
367
368 touch_start(integer total_number)
369 {
370 DetectedUser = llDetectedKey(0);
371 list MenuItems = ["LearnMore", "GetScript", "Help"];
372 string MenuText = "MAIN MENU: Please make a selection within " + (string)llFloor(DialogTimeout)
373 + " seconds.\n- LearnMore: Read the forum thread on this product\n- GetScript: Get yourself the latest version of this free script\n- Help: Link to the "
374 + ObjectName + " Help page";
375
376 if(DetectedUser == ObjectOwner)
377 {
378 // touched by Owner
379
380 if(Power)
381 {
382 MenuItems = [PowerText, OwnerListenText] + MenuItems;
383 MenuText = MenuText + "\n- Off: Switch off \n- Open/CloseListen: Opens/Closes Owner listen channel " + (string)OwnerChannel;
384 }
385 else
386 {
387 MenuItems = (list)PowerText + MenuItems;
388 MenuText = MenuText + "\n- On: Switch on";
389 }
390 }
391 else
392 {
393 // touched by someone other than Owner. Send them a message & a dialog box of options
394
395 // if they placed their own name on 'Exclude List', so give opportunity to clear their name, else give opportunity to exclude their name
396 if(llListFindList(ExcludeListing, (list)(llKey2Name(AVKey) + SelfExcludedSuffix)) != -1 )
397 {
398 // they placed themself on the 'Exclude List' so are therefore allowed to clear their name
399 MenuItems = (list)"IncludeMe" + MenuItems;
400 MenuText = MenuText + "\n- IncludeMe: Have the " + ObjectName + " remove your name from the 'Exclude List'";
401 }
402 else
403 {
404 // they have not placed themself on the 'Exclude List', so check whether the Owner has already done it
405 if(llListFindList(ExcludeListing, (list)llKey2Name(AVKey)) == -1 )
406 {
407 // neither they themself nor the Owner has previously excluded them, so give them the opportunity to exclude themselves now
408 MenuItems = (list)"ExcludeMe" + MenuItems;
409 MenuText = MenuText + "\n- ExcludeMe: Have your name added to the " + ObjectName + "'s 'Exclude List'";
410 }
411 }
412 llInstantMessage(DetectedUser, "\nThank you for your interest in the " + ObjectName + " created by " + Author + "\nThe dialog menu offers a number of options.");
413 }
414 // generate the dialog menu
415 integer CommChannel = (-200000 - ((integer)llFrand(12345) * -1));
416 ListenChannel = llListen(CommChannel, "", DetectedUser, "");
417 llDialog(DetectedUser, MenuText, MenuItems, CommChannel);
418 llSetTimerEvent(DialogTimeout);
419 }
420
421
422 sensor(integer total_number)
423 {
424 // save the AV key in case it is needed for a 'ShoutOut'
425 AVKey = llDetectedKey((integer)llFrand(total_number));
426 // core code by Coder Kas. Adapted to suit by Debbie Trilling
427 string URL_RESIDENT = "http://world.secondlife.com/resident/";
428 llHTTPRequest( URL_RESIDENT + (string)AVKey,[HTTP_METHOD,"GET"],"");
429 }
430
431
432 no_sensor()
433 {
434 // counts the number of times that the scanner doesn't find anyone in range. If TotalNoScansAllowed is set to greater than zero, automatically powers down the toy
435 // when the number of no_sensors exceeds TotalNoScansAllowed. However, this functionality is disabled if TotalNoScansAllowed is set to zero.
436 NoSensorCounter++;
437 if((NoSensorCounter > TotalNoScansAllowed) && (TotalNoScansAllowed > 0))
438 {
439 ShutDown();
440 llInstantMessage(ObjectOwner, "\nThe " + ObjectName + " has been automatically switched OFF as no Agents have been detected within the set timeframe.");
441 }
442 else
443 {
444 ApplyDefaultTexture();
445 }
446 }
447
448
449 http_response(key req,integer stat, list met, string body)
450 {
451 // core code by Coder Kas. Adapted to suit by Debbie Trilling
452 integer s1 = 0;
453 integer s2 = 0;
454 integer s1l= 0;
455 integer s2l= -3;
456 s1 = llSubStringIndex(body,"<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
457 s1l = llStringLength("<img alt=\"profile image\" src=\"http://secondlife.com/app/image/");
458 s2 = llSubStringIndex(body,"\" class=\"parcelimg\" />");
459
460 if(s1 == -1)
461 {
462 // selected AV doesn't have a profile picture, so use the default instead
463 ApplyDefaultTexture();
464 }
465 else
466 {
467 //check whether this was the texture used last time
468 if((key)llGetSubString(body,s1+s1l,s2+s2l) == LastTexture)
469 {
470 // same profile pic as last time. so display a random default instead
471 ApplyDefaultTexture();
472 // clear the last texture out
473 LastTexture = "";
474 }
475 else
476 {
477 // are they on the ExcludeListing, with or without a suffix? if so, display a random default texture instead
478 if((llListFindList(ExcludeListing, (list)llKey2Name(AVKey)) != -1 ) || (llListFindList(ExcludeListing, (list)(llKey2Name(AVKey) + SelfExcludedSuffix)) != -1))
479 {
480 // they are on the 'Exclude List'
481 ApplyDefaultTexture();
482 }
483 else
484 {
485 // different profile from last time & not on ExcludeListing, so display it
486 ApplySelectedTexture((key)llGetSubString(body,s1+s1l,s2+s2l));
487 // save the key for comparison purposes next time tho'
488 LastTexture = (key)llGetSubString(body,s1+s1l,s2+s2l);
489
490 // give a 'ShoutOut', if set to do so
491 if(ShoutOut)
492 {
493 GiveShoutOut();
494 }
495 }
496 }
497 }
498 }
499
500
501 listen(integer channel, string name, key id, string message)
502 {
503
504 if(message == "LearnMore")
505 {
506 string URL_FORUMTHREAD = "http://forums.secondlife.com/showthread.php?t=225692";
507 llLoadURL(DetectedUser, "Thank you for choosing to learn more about the " + ObjectName + ".This link will take you to the relevant SL forum thread.", URL_FORUMTHREAD);
508 CloseUserListen();
509 }
510 else if(message == "GetScript")
511 {
512 string URL_WIKIPAGE = "http://wiki.secondlife.com/wiki/User:Debbie_Trilling";
513 llLoadURL(DetectedUser, "Thank you for choosing to look at the script for the " + ObjectName + ".This link will allow you to get your own free copy.", URL_WIKIPAGE);
514 CloseUserListen();
515 }
516 else if(message == "Help")
517 {
518 string URL_HELPPAGE = "http://wiki.secondlife.com/wiki/Talk:Random_AV_Profile_Projector";
519 llLoadURL(DetectedUser, "This link will take you to the " + ObjectName + "'s Help page.", URL_HELPPAGE);
520 CloseUserListen();
521 }
522 else if(message == "ExcludeMe")
523 {
524 // as a suffix to the name, as it is the user adding their own name
525 ExcludeListing = (list)(llKey2Name(DetectedUser) + SelfExcludedSuffix) + llList2List( ExcludeListing, 0, (ExcludeListSize - 2));
526 llInstantMessage(DetectedUser, "You have been added to the " + ObjectName + "'s 'Exclude List'");
527 CloseUserListen();
528 }
529 else if(message == "IncludeMe")
530 {
531 integer ExcludeListPosition = llListFindList(ExcludeListing, (list)(llKey2Name(DetectedUser) + SelfExcludedSuffix));
532 ExcludeListing = llDeleteSubList(ExcludeListing, ExcludeListPosition, ExcludeListPosition);
533 llInstantMessage(DetectedUser, "You have been removed from the " + ObjectName + "'s 'Exclude List'");
534 CloseUserListen();
535 }
536 else if((message == "On") && (id == ObjectOwner))
537 {
538 StartUp();
539 }
540 else if((message == "Off") && (id == ObjectOwner))
541 {
542 ShutDown();
543 }
544 else if((message == "OpenListen") && (id == ObjectOwner))
545 {
546 // open the Owner Only channel
547 OwnerListenChannel = llListen(OwnerChannel, "", ObjectOwner, "");
548 OwnerListenText = "CloseListen";
549 llOwnerSay("Owner Only channel " + (string)OwnerChannel + " is now open for you.\n Options are: 'Exclude <AV_NAME>', 'Include <AV_NAME>', 'ClearAll' and 'List'");
550 }
551 else if((message == "CloseListen") && (id == ObjectOwner))
552 {
553 // close the Owner Only channel
554 llListenRemove(OwnerListenChannel);
555 OwnerListenText = "OpenListen";
556 llOwnerSay("Owner Only channel " + (string)OwnerChannel + " is now closed.");
557 }
558 else if(((llGetSubString(message,0,6) == "Exclude") || (llGetSubString(message,0,6) == "exclude")) && (id == ObjectOwner))
559 {
560 // before adding them to the 'Exclude List', check if already on it
561 // they could be on the list simply as their own name, their name + a suffix, perhaps even both.
562
563 if((DeriveNamePosition(message) != -1 ) || (DeriveNamePosition(message + SelfExcludedSuffix) != -1))
564 {
565 llOwnerSay(DeriveName(message) + " already exists on the " + ObjectName + "'s 'Exclude List'.");
566 }
567 else
568 {
569 // not on the list, so add them (without a suffix, as it is the Owner doing the adding)
570 string NewExcludeName = DeriveName(message);
571 ExcludeListing = (list)NewExcludeName + llList2List( ExcludeListing, 0, (ExcludeListSize - 2));
572 llOwnerSay(NewExcludeName + " has been added to the "
573 + ObjectName + "'s 'Exclude List'. \nThere are now " + RemainingExcludeSlots());
574 }
575 }
576 else if(((llGetSubString(message,0,6) == "Include") || (llGetSubString(message,0,6) == "include")) && (id == ObjectOwner))
577 {
578 // they could be on the list simply as their own name, their name + a suffix, perhaps even both. We need to test for all scenerios
579 // locate their position within in 'Exclude List', if they do exist
580 integer NamePositionTest = DeriveNamePosition(message);
581 integer NamePositionSuffixTest = DeriveNamePosition(message + SelfExcludedSuffix);
582
583 // test to see if either are on the 'Exclude List'.
584 if((NamePositionTest != -1) || (NamePositionSuffixTest != -1))
585 {
586 // well, their name is definately on the 'Exclude list', but is it with or without a suffix? Is it both?
587 // would look neater to do the next tests in an IF-IF/ELSE-ELSE, but we can save a lil memory using two IF statement (albeit with a tiny speed overhead)
588 if(NamePositionTest != -1)
589 {
590 // it's on without a suffix
591 ExcludeListing = llDeleteSubList(ExcludeListing, NamePositionTest, NamePositionTest);
592 }
593
594 if(NamePositionSuffixTest != -1)
595 {
596 //it's on with a suffix
597 ExcludeListing = llDeleteSubList(ExcludeListing, NamePositionSuffixTest, NamePositionSuffixTest);
598 }
599 llOwnerSay(DeriveName(message) + " has been removed from the "
600 + ObjectName + "'s 'Exclude List'. \nThere are now " + RemainingExcludeSlots());
601 }
602 else
603 {
604 llOwnerSay(DeriveName(message) + " could not located on the " + ObjectName + "'s 'Exclude List'.");
605 }
606 }
607 else if(((llGetSubString(message,0,7) == "ClearAll") || (llGetSubString(message,0,7) == "clearall") || (llGetSubString(message,0,8) == "clear all") || (llGetSubString(message,0,8) == "Clear all")) && (id == ObjectOwner))
608 {
609 ExcludeListing = [];
610 llOwnerSay("The 'Exclude List' has been cleared. All " + RemainingExcludeSlots());
611
612 }
613 else if(((llGetSubString(message,0,3) == "List") || (llGetSubString(message,0,3) == "list")) && (id == ObjectOwner))
614 {
615 if(llGetListLength(ExcludeListing) > 0)
616 {
617 llOwnerSay("The following " + (string)llGetListLength(ExcludeListing) + " AV's are listed on the 'Exclude List'. Names ending with '" + SelfExcludedSuffix + "' chose to exclude themselves.\n"
618 + llDumpList2String(ExcludeListing, " | "));
619 }
620 else
621 {
622 llOwnerSay("No AV's are listed on the 'Exclude List'.");
623 }
624 }
625 else
626 {
627 llInstantMessage(DetectedUser, "Unrecognised option or selection made from a timed-out menu.");
628 }
629
630 }
631
632 timer()
633 {
634 CloseUserListen();
635 }
636
637 //default end
638 }

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