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
Permissions Check_Inventory_Permissions  

Check_Inventory_Permissions

Put this in the root prim. It supports the following commands

help - this help message
send - send out copies of self to all prims in object
check - check inventory permissions in object against desired perms
checkall - complete list of all permissionsfor all inventory contents
mod - set or remove mod perm desired
copy - set or remove copy perm desired
trans - set or remove trans perm desired
killall - remove all other check scripts from object (including this one)
highlight - go thro
:

Category: Permissions
By : Ordinal Malaprop
Created: 2012-01-28 Edited: 2012-01-28
Worlds: Second Life

the Zip file

Download all files for Check_Inventory_Permissions
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Check_Inventory_Permissions_1.lsl
1
2 integer CHANNEL = 678;
3 integer LINK_N = -12390133;
4 integer gDesiredPerms = 0;
5
9 list LIST_NAMES = ["None", "Texture", "Sound", "Landmark", "Clothing", "Object", "Notecard",
10 "Script", "Body Part", "Animation", "Gesture"];
11
12 //---------------------------------------------------------------------
13
14 string inventory_type(integer n)
15 {
17 integer type_index = llListFindList(LIST_TYPES, [detected_type]);
18 return llList2String(LIST_NAMES, type_index);
19 }
20
21 string perm_string(integer perms)
22 {
23 list msg = [];
24 if(perms & PERM_MODIFY) msg += ["mod"];
25 if(perms & PERM_COPY) msg += ["copy"];
26 if(perms & PERM_TRANSFER) msg += ["trans"];
27 if(msg == []) return "(no perms)";
28 else return llDumpList2String(msg, "/");
29 }
30
31 list_perms(integer all)
32 {
33 integer f = 0;
34 string report = "";
35 integer perms = 0;
36 do {
40 ) & 57344;
41 if(all || ((perms != gDesiredPerms)) && llGetInventoryName(INVENTORY_ALL, f) != llGetScriptName()) {
42 report += (
44 + " (" + inventory_type(f) + "): "
45 + perm_string(perms)
46 );
47 }
49 if(report == "") {
50 if(all) report += "\nNo inventory objects in this prim";
51 else report += "\nAll inventory objects OK in this prim";
52 }
53 report = "Inventory permission report for " + prim_name(llGetLinkNumber()) + report;
54 llOwnerSay(report);
55 if(llGetLinkNumber() <= 1) {
56 if(all) llMessageLinked(LINK_ALL_CHILDREN, LINK_N, "checkall", NULL_KEY);
58 }
59 }
60
61 propagate()
62 {
63 // Sends out a copy of itself to every prim in the object
65 if(f <= 1) {
66 llOwnerSay("There's only one prim in this object");
67 return;
68 }
69 llOwnerSay("Propagating this script throughout object...");
70 // Link numbers begin with 1
71 do {
72 if(f != llGetLinkNumber()) {
74 llOwnerSay("Given to " + prim_name(f));
75 }
76 } while(--f > 0);
77 llOwnerSay("Done. You will now have to recompile all of the check scripts in this object before they "
78 + "can be used - either take the object into inventory, re-rez and select 'Set all scripts to running in "
79 + "selection' from Tools menu, or manually re-save each script.");
80 }
81
82 help()
83 {
84 llOwnerSay("Say commands on channel " + (string)CHANNEL + "\nhelp - this help message\n"
85 + "send - send out copies of self to all prims in object\ncheck - check"
86 + " inventory permissions in object against desired perms\ncheckall - complete list of all permissions"
87 + "for all inventory contents\nmod - set or remove mod perm desired\ncopy - set or remove copy "
88 + "perm desired\ntrans - set or remove trans perm desired\nkillall - remove all other check scripts "
89 + "from object (including this one)\nhighlight - go through all of the prims highlighting each one, to "
90 + "show permission (will spoil manual alpha adjustments!)");
91 llOwnerSay("Current desired permissions - " + perm_string(gDesiredPerms));
92 }
93
94 kill_all_scripts()
95 {
96 // Send out die message and remove this script too
97 llOwnerSay("Sending message for other scripts to die...");
98 llMessageLinked(LINK_SET, LINK_N, "die", NULL_KEY);
99 die();
100 }
101
102 string prim_name(integer f)
103 {
104 return "prim #" + (string)f + " (" + llGetLinkName(f) + ")";
105 }
106
107 die()
108 {
109 llOwnerSay(llGetScriptName() + " in " + prim_name(llGetLinkNumber()) + " - removing myself, goodbye!");
111 }
112
113 process_command(string msg)
114 {
115 msg = llToLower(msg);
116 if(msg == "help") help();
117 else if(msg == "send") propagate();
118 else if(msg == "killall") kill_all_scripts();
119 else if(msg == "check") list_perms(0);
120 else if(msg == "checkall") list_perms(1);
121 else if(msg == "mod") {
122 toggle_flag(PERM_MODIFY);
123 if(llGetLinkNumber() <= 1) llMessageLinked(LINK_SET, LINK_N, "perms" + (string)gDesiredPerms, NULL_KEY);
124 }
125 else if(msg == "copy") {
126 toggle_flag(PERM_COPY);
127 if(llGetLinkNumber() <= 1) llMessageLinked(LINK_SET, LINK_N, "perms" + (string)gDesiredPerms, NULL_KEY);
128 }
129 else if(msg == "trans") {
130 toggle_flag(PERM_TRANSFER);
131 if(llGetLinkNumber() <= 1) llMessageLinked(LINK_SET, LINK_N, "perms" + (string)gDesiredPerms, NULL_KEY);
132 }
133 else if(llGetSubString(msg, 0, 4) == "perms") {
134 gDesiredPerms = (integer)llGetSubString(msg, 5, -1);
135 }
136 else if(msg == "die") die();
137 else if(msg == "highlight") highlight_prims();
138 }
139
140 toggle_flag(integer perm)
141 {
142 gDesiredPerms = gDesiredPerms ^ perm;
143 if(llGetLinkNumber() <= 1) llOwnerSay("Desired permissions are now " + perm_string(gDesiredPerms));
144 }
145
146 highlight_prims()
147 {
149 if(f <= 1) {
150 llOwnerSay("There's only one prim in this object, what's the point?");
151 return;
152 }
153 llOwnerSay("Beginning prim highlighting");
155 // Link numbers begin with 1
156 do {
158 llOwnerSay("Highlight " + prim_name(f));
159 llSleep(3.0);
161 } while(--f > 0);
163 llOwnerSay("Done");
164 }
165
166 //---------------------------------------------------------------------
167
168 default
169 {
171 {
172 gDesiredPerms = PERM_COPY;
173 if(llGetLinkNumber() <= 1) {
174 llListen(CHANNEL, "", llGetOwner(), "");
175 help();
176 }
177 else {
178 llOwnerSay(llGetScriptName() + " " + prim_name(llGetLinkNumber()) + " ready");
179 }
180 }
181
183 {
185 }
186
187 listen(integer c, string name, key id, string msg)
188 {
189 process_command(msg);
190 }
191
193 {
194 if(n == LINK_N && llGetLinkNumber() > 1) {
195 process_command(msg);
196 }
197 }
198
199 changed(integer change)
200 {
201 if(change & CHANGED_OWNER) {
202 // delete if sold etc
204 }
205 else if(change & CHANGED_LINK) {
207 }
208 }
209 }

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