Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Why can't a script mod a no-mod object?

BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
09-30-2005 09:00
Duh, because it's no-mod. But bear with me.

I have an object that I want to sell and I was planning to sell it no-mod. It contains a script that opens and closes a cut in response to touch, basically a door. The script works fine for me, the creator. But when I sell it with next-owner-no-mod the script can't open the cut (using llSetPrimitiveParams()).

While it makes sense that no-mod means no-mod, I think this is too restrictive. If the object is no-mod then only the creator can have placed a script in it. Therefore the script should be able to do things that the current owner cannot. I don't see how the object creator's interests are served by not letting their scripts modify the object.
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
09-30-2005 09:53
Are you checking if the person touching is the owner? Remember that a script doesn't reset when you give the object to someone else, so if you've done something like:

CODE

...

state_entry()
{
key owner = llGetOwner();
}

...

touch_start(integer num_detected)
{
if (llDetectedKey(0) != owner)

...


The owner variable got set when you last reset the script, so if you give it to someone else, the script is still checking to see if you touched it. A good way around this is to llResetScript() in the on_rez event.

If that's not the problem, then I don't know what's going on :)
Keknehv Psaltery
Hacker
Join date: 11 Apr 2005
Posts: 1,185
09-30-2005 14:45
I believe Ziggy is correct. I have many no-mod objects that change scale and other parameters quite often.
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
09-30-2005 17:30
But I'm not caching the owner key. In fact anyone can touch it. My code looks like this:
CODE
list closedParams;
list openParams;
integer open;

...

state ready
{
link_message(integer sender, integer cmd, string str, key k)
{
// open
if (cmd == 1) {
llSetPrimitiveParams([PRIM_TYPE] + openParams);
open = 1;
// clear textures on newly created faces
llSetTexture("f54a0c32-3cd1-d49a-5b4f-7b792bebc204", 0);
llSetTexture("f54a0c32-3cd1-d49a-5b4f-7b792bebc204", 3);
llSetAlpha(0.9, 0);
llSetAlpha(0.9, 3);
}

// close
if (cmd == 2) {
llSetPrimitiveParams([PRIM_TYPE] + closedParams);
open = 0;
}
}
}
The llSetTexture and llSetAlpha calls are definitely occuring, but the llSetPrimitiveParams doesn't open up the cut unless the owner has mod privilege. Since faces are renumbered when the cut is made (why, oh why?!?!?), this means that the wrong faces get made invisible.

There are other prims in the object that change size and position. That works fine with or without mod privs. But opening a cut doesn't work without mod privs. This leads me to believe that this is really a bug.
BamBam Sachertorte
floral engineer
Join date: 12 Jul 2005
Posts: 228
09-30-2005 23:43
I have some test objects at Obscure (138, 158) that show the issue. If you touch them then you can see the cut change. But if you buy them and rez a copy touching does nothing. The script is simply this
CODE
list closedParams;
list openParams;
integer open;

default
{
state_entry()
{
closedParams = llGetPrimitiveParams([PRIM_TYPE]);
openParams = llListReplaceList(closedParams, [<0.05, 0.95, 0.0>], 2, 2);
open = 0;
}

touch_start(integer count)
{
if (open) {
llSetPrimitiveParams([PRIM_TYPE] + closedParams);
open = 0;
} else {
llSetPrimitiveParams([PRIM_TYPE] + openParams);
open = 1;
}
}

changed(integer change)
{
if ((change & CHANGED_SHAPE) && (llGetNumberOfSides() == 6)) {
llSetTexture("f54a0c32-3cd1-d49a-5b4f-7b792bebc204", 0);
llSetTexture("f54a0c32-3cd1-d49a-5b4f-7b792bebc204", 3);
llSetAlpha(0.9, 0);
llSetAlpha(0.9, 3);
}
}
}