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
Useful Subroutines Scripting_Tips_Put_object_descripti  

Scripting_Tips_Put_object_descripti

Following the llGetObjectDesc code, the script goes through a series of if and else if statements comparing the string to my special selected settings. In this case, ‘debug on’ and ‘debug off’. Finding either of those, the script turns a debug flag on or off. You can get as complex as you want here as long as you don’t go past the 127 character limit. The object description could hold several keywords to be used to set several options within your script.

Category: Useful Subroutines
By : Micheil Merlin
Created: 2010-02-01 Edited: 2010-02-01
Worlds: Second Life

the Zip file

Download all files for Scripting_Tips_Put_object_descripti
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Scripting_Tips_Put_object_descripti_1.lsl
1
2 // Config Demo - Read Object Desc
3 //
4 // Script to demonstrate the use of the object description to supply
5 // parameters.
6 //
7 // The object description is checked to see if it says either 'debug on'
8 // or 'debug off'. Set the gDebug flag accordingly.
9 //
10 // Micheil Merlin/SL - 1/1/2010
11
12
13 integer gDebug = 0; // Debug flag.
14
15 readdesc()
16 {
17 string objdesc; // Object description.
18 // Read the description field for the object.
19 // Translate to lower case and trim blanks from the end.
21 // Look for an object description of 'debug on' in lower case.
22 if(objdesc == "debug on")
23 {
24 gDebug = 1;
25 // Look for an object description of 'debug off' in lower case.
26 } else if(objdesc == "debug off")
27 {
28 gDebug = 0;
29 // Check for an empty object description.
30 // Empty object descriptions could either be blanks or the string
31 // '(no description)'. Earlier, we trimmed blanks from the string
32 // so if it was blanks, it is now a null string.
33 } else if(objdesc == "" || objdesc == "(no description)")
34 {
35 llSay(0, "No object description exists.");
36 // If the object description is not one of our choices or empty, then
37 // say the string.
38 } else
39 {
40 llSay(0, "Object Description of '" + objdesc +
41 "' found. We weren't expecting this.");
42 }
43 llSay(0, "Debug is set to " + (string)gDebug);
44 //
45 // The object description processing is complete. Other code could be
46 // inserted here.
47 //
48 }
49
50 default
51 {
53 {
54 readdesc(); // Process object description.
55 }
56
57 // This event is triggered when the object is rezzed.
58 on_rez(integer num)
59 {
60 llResetScript(); // Reset script when object rezzed.
61 }
62
63 // This event is triggered when the object is touched.
64 touch_start(integer total_number)
65 {
66 readdesc(); // Go check the object description.
67 }
68 }

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