Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.
The following script, when placed in an object, will automatically tell you the current permissions of everything inside it, whenever that list changes.
See my Journal entry for part of the logic behind posting this.
list_perms()
{
integer f = 0;
list msg = [];
integer perms = 0;
do {
msg = [];
perms = llGetInventoryPermMask(
llGetInventoryName(INVENTORY_ALL, f),
MASK_NEXT
);
if (perms & PERM_MODIFY) msg += ["mod"];
if (perms & PERM_COPY) msg += ["copy"];
if (perms & PERM_TRANSFER) msg += ["trans"];
if (msg == []) msg = ["(no perms)"];
llOwnerSay(
llGetInventoryName(INVENTORY_ALL, f) + ": "
+ llDumpList2String(msg, ",")
);
} while (++f < llGetInventoryNumber(INVENTORY_ALL));
}
default
{
state_entry()
{
list_perms();
}
changed(integer change)
{
if (change & CHANGED_OWNER) {
// delete if sold etc
llRemoveInventory(llGetScriptName());
}
else if (change & CHANGED_INVENTORY) {
list_perms();
}
}
}
Nice one Ordinal!
Amazing how simple little, usefull ideas like this one still pop up every now and then that no one had thought of doing or posting anywhere.
It would be more useful if it would propagate to all of the prims in the object, now I think about it (having spent a very irritating half hour last night playing "hunt the no-copy script in invisible prims"). Unfortunately, while one can llGiveInventory to subprims, the scripts don't automatically compile and turn on if you do. But I'll see.
OOO OOOO OOO I love that game!!!!!!!!
Not always useful, but if you have perms to do it:
propogate the script with llGiveInventory...
Tools (menu) - recompile scripts in selection
and/or
Tools (menu) - set scripts to running in selection
etc
This rather more complex version will propagate itself...
// Check Inventory Permissions
// Self-propagating
// Ordinal Malaprop
// 2007-11-21
//---------------------------------------------------------------------
integer CHANNEL = 678;
integer LINK_N = -12390133;
integer gDesiredPerms = 0;
list LIST_TYPES = [INVENTORY_NONE, INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_LANDMARK, INVENTORY_CLOTHING, INVENTORY_OBJECT, INVENTORY_NOTECARD, INVENTORY_SCRIPT, INVENTORY_BODYPART, INVENTORY_ANIMATION, INVENTORY_GESTURE];
list LIST_NAMES = ["None", "Texture", "Sound", "Landmark", "Clothing", "Object", "Notecard", "Script", "Body Part", "Animation", "Gesture"];
//---------------------------------------------------------------------
string inventory_type(integer n)
{
integer detected_type = llGetInventoryType(llGetInventoryName(INVENTORY_ALL, n));
integer type_index = llListFindList(LIST_TYPES, [detected_type]);
return llList2String(LIST_NAMES, type_index);
}
string perm_string(integer perms)
{
list msg = [];
if (perms & PERM_MODIFY) msg += ["mod"];
if (perms & PERM_COPY) msg += ["copy"];
if (perms & PERM_TRANSFER) msg += ["trans"];
if (msg == []) return "(no perms)";
else return llDumpList2String(msg, "/");
}
list_perms(integer all)
{
integer f = 0;
string report = "";
integer perms = 0;
do {
perms = llGetInventoryPermMask(
llGetInventoryName(INVENTORY_ALL, f),
MASK_NEXT
) & 57344;
if (all || ((perms != gDesiredPerms)) && llGetInventoryName(INVENTORY_ALL, f) != llGetScriptName()) {
report += (
"n" + llGetInventoryName(INVENTORY_ALL, f)
+ " (" + inventory_type(f) + "): "
+ perm_string(perms)
);
}
} while (++f < llGetInventoryNumber(INVENTORY_ALL));
if (report == "") {
if (all) report += "nNo inventory objects in this prim";
else report += "nAll inventory objects OK in this prim";
}
report = "Inventory permission report for " + prim_name(llGetLinkNumber()) + report;
llOwnerSay(report);
if (llGetLinkNumber() <= 1) {
if (all) llMessageLinked(LINK_ALL_CHILDREN, LINK_N, "checkall", NULL_KEY);
else llMessageLinked(LINK_ALL_CHILDREN, LINK_N, "check", NULL_KEY);
}
}
propagate()
{
// Sends out a copy of itself to every prim in the object
integer f = llGetNumberOfPrims();
if (f <= 1) {
llOwnerSay("There's only one prim in this object");
return;
}
llOwnerSay("Propagating this script throughout object...");
// Link numbers begin with 1
do {
if (f != llGetLinkNumber()) {
llGiveInventory(llGetLinkKey(f), llGetScriptName());
llOwnerSay("Given to " + prim_name(f));
}
} while (--f > 0);
llOwnerSay("Done. You will now have to recompile all of the check scripts in this object before they can be used - either take the object into inventory, re-rez and select 'Set all scripts to running in selection' from Tools menu, or manually re-save each script.");
}
help()
{
llOwnerSay("Say commands on channel " + (string)CHANNEL + "nhelp - this help messagenmenu - operate via menunsend - send out copies of self to all prims in objectncheck - check inventory permissions in object against desired permsncheckfull - complete list of all permissions for all inventory contentsnmod - set or remove mod perm desiredncopy - set or remove copy perm desiredntrans - set or remove trans perm desirednkillall - remove all other check scripts from object (including this one)nhighlight - go through all of the prims highlighting each one, to show permission (will spoil manual alpha adjustments!)");
llOwnerSay("Current desired permissions - " + perm_string(gDesiredPerms));
}
kill_all_scripts()
{
// Send out die message and remove this script too
llOwnerSay("Sending message for other scripts to die...");
llMessageLinked(LINK_SET, LINK_N, "die", NULL_KEY);
die();
}
string prim_name(integer f)
{
return "prim #" + (string)f + " (" + llGetLinkName(f) + ")";
}
die()
{
llOwnerSay(llGetScriptName() + " in " + prim_name(llGetLinkNumber()) + " - removing myself, goodbye!");
llRemoveInventory(llGetScriptName());
}
process_command(string msg)
{
msg = llToLower(msg);
if (msg == "help") help();
else if (msg == "send") propagate();
else if (msg == "killall") kill_all_scripts();
else if (msg == "check") list_perms(0);
else if (msg == "checkall") list_perms(1);
else if (msg == "mod") {
toggle_flag(PERM_MODIFY);
if (llGetLinkNumber() <= 1) llMessageLinked(LINK_SET, LINK_N, "perms" + (string)gDesiredPerms, NULL_KEY);
}
else if (msg == "copy") {
toggle_flag(PERM_COPY);
if (llGetLinkNumber() <= 1) llMessageLinked(LINK_SET, LINK_N, "perms" + (string)gDesiredPerms, NULL_KEY);
}
else if (msg == "trans") {
toggle_flag(PERM_TRANSFER);
if (llGetLinkNumber() <= 1) llMessageLinked(LINK_SET, LINK_N, "perms" + (string)gDesiredPerms, NULL_KEY);
}
else if (llGetSubString(msg, 0, 4) == "perms") {
gDesiredPerms = (integer)llGetSubString(msg, 5, -1);
}
else if (msg == "die") die();
else if (msg == "highlight") highlight_prims();
}
toggle_flag(integer perm)
{
gDesiredPerms = gDesiredPerms ^ perm;
if (llGetLinkNumber() <= 1) llOwnerSay("Desired permissions are now " + perm_string(gDesiredPerms));
}
highlight_prims()
{
integer f = llGetNumberOfPrims();
if (f <= 1) {
llOwnerSay("There's only one prim in this object, what's the point?");
return;
}
llOwnerSay("Beginning prim highlighting");
llSetLinkAlpha(LINK_SET, 0.1, ALL_SIDES);
// Link numbers begin with 1
do {
llSetLinkAlpha(f, 1.0, ALL_SIDES);
llOwnerSay("Highlight " + prim_name(f));
llSleep(3.0);
llSetLinkAlpha(f, 0.1, ALL_SIDES);
} while (--f > 0);
llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
llOwnerSay("Done");
}
//---------------------------------------------------------------------
default
{
state_entry()
{
gDesiredPerms = PERM_COPY;
if (llGetLinkNumber() <= 1) {
llListen(CHANNEL, "", llGetOwner(), "");
help();
}
else {
llOwnerSay(llGetScriptName() + " " + prim_name(llGetLinkNumber()) + " ready");
}
}
on_rez(integer p)
{
llResetScript();
}
listen(integer c, string name, key id, string msg)
{
process_command(msg);
}
link_message(integer s, integer n, string msg, key id)
{
if (n == LINK_N && llGetLinkNumber() > 1) {
process_command(msg);
}
}
changed(integer change)
{
if (change & CHANGED_OWNER) {
// delete if sold etc
llRemoveInventory(llGetScriptName());
}
else if (change & CHANGED_LINK) {
llResetScript();
}
}
}
As long as one (a) puts it into the root prim, (b) uses the "send" command to send out scripts to the subprims, (c) takes the thing back and re-rezzes it and (d) right-clicks and sets all scripts to running, it seems to work quite well. The "killall" command removes all of the scripts via link message command, and one can set a desired permission to check against, or just list all of the permissions everywhere.
Is there a trick to copy/pasting text from this forum so it retains its indentations/formatting?
.. I'm getting one continuous block of text at the moment.
Well, no, there shouldn't be a trick. Just highlighting and pasting into a plain text document seems to work for me. What sort of operating system and programs are you using?
I get the same problem, actually.
I'm using Win XP and Firefox 2.0.0.11. Usually I paste these into Notepad or SciTE-ez, but regardless of which, I get the same result.
It has happened me before on other pages, making a 'porridge' out of it when pasted into Notepad, but working fine in HomeSite5 (yes, I still hang on to that) or SciTE-ez. Alas, not so in this case.
I had the same problem. Its formatted as a unintelligble block in the browser and copies that way as well (Im at work, after a fashion, so Im using IE 7).
However, I discovered that if you view source (under view in IE) after scrolling down it comes out beautifully formated. Pastes directly into LSLEditor 2.30 retaining formating)
Oh very nice by the way, I keep finding the odd things rezzed as full perms when they shoudnt be. Sometimes (mostly) I forget to check perms before giving them away. And I was looking for a way to propagate a killotherscript script through several big linksets and this shows the way nicely
1 to 11 of 11