Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Strange Touch behavior

Allan Beltran
Registered User
Join date: 2 Dec 2006
Posts: 52
12-12-2006 23:55
This sounds like a bug to me.

I have three prims, we'll call them Rod, Ball, and Socket.

The root prim at rez is always the Ball. Doesn't matter really, but it gives us a starting point.

I made it so that you can touch either the Ball or Socket to make it become the root prim. So, if the Ball is the current root prim, and I want the Socket to be the root, I just touch the Socket and viola! It works both ways.

I perform the swap, by calling llBreakAllLinks() and then re-linking the Ball and Socket via the Rod script with llCreakLink(key,FALSE), the last one becomes the root. I then actually swap the key variables. Also, I am using llPassTouches(FALSE); in the Ball and Socket prims to prevent either from passing the touch event to the other.

CODE
SwapRootPrims()
{
//Break ALL Links
llBreakAllLinks();

//Re-Link old Root_Anchor as Child
llCreateLink(Root_Anchor,FALSE);

//Re-Link old Child_Anchor as Root
llCreateLink(Child_Anchor,FALSE);

//Swap keys
Temp_Anchor = Root_Anchor;
Root_Anchor = Child_Anchor;
Child_Anchor = Temp_Anchor;

//Shows only 2 prims after clicking without the radial
//Clicking the old root to swap again raises the error
//and it is no longer linked to the set
llSetText((string)llGetNumberOfPrims(),<255,255,255>,1.0);
}

The Bug:
When I use the radial, no problems. I can swap between the two objects all day, and it works fine. It's only when I actually touch the Ball or Socket, without using the radial, is when I start having problems.

When I touch the child prim once, say the Ball, it does in fact become the root. However, the old root, in this case the Socket doesn't re-link. And when I click on it, this time with either the radial, or by touching, I get an error...

"0 someone else is grabbing that object"

I only get the error once. However, clicking it again does me no good since it is no longer part of the set.

I would think it was my code if it happened both when using the radial or by touching. But I believe there is an problem somewhere else. I certainly hope it's only my code and that it can be quickly explained away, with a solution of course. :)

EDIT: Oh, and I'm using llMessageLinked() to tell the Rod that it needs to swap the roots.

Thanks.
Ketra Saarinen
Whitelock 'Yena-gal
Join date: 1 Feb 2006
Posts: 676
12-13-2006 07:51
Have you tried posting this in the scripting tips forum? They may have a better grasp of what you are trying to achieve and might be able to reccomend a workaround if neccesary.
_____________________
From: Doctor Who
J: You've been to the Factories?
DW: Once
J: Well they're gone now, destroyed. Main reactor went critical, vaporized the lot.
DW: Like I said: Once. There's a banana grove there now. I like bananas. Bananas are good.


From: Clutch, 10001110101
Robot Lords of Tokyo, smile, Taste Kittens!
Jeremy Bender
anachronistic iconoclast
Join date: 12 Aug 2006
Posts: 99
12-13-2006 08:21
From: Allan Beltran
... "0 someone else is grabbing that object" ...
I get this message quite a bit.

I have been scripting an object lately that also uses linked messages and touch events and I assumed this message is caused by server or client lag because if you wait a second or two and touch the object a second time, the event usually works fine. It's as if the system just hasn't been told yet that the previous touch event is over or something.

i.e.- I don't think it's anything to do with your script, it's a bug induced by the omnipresent high packet loss and lag and (maybe) some screw-up in the last update.

Seems like the Lindens don't know much about their own code base as there are at least three or four completely unexpected bugs in every release in areas that have nothing to do with what they were trying to "fix" in the first place. Any programmer "caught by surprise" that often is not to be trusted IMO. ;)
Allan Beltran
Registered User
Join date: 2 Dec 2006
Posts: 52
12-13-2006 10:47
From: Ketra Saarinen
Have you tried posting this in the scripting tips forum? They may have a better grasp of what you are trying to achieve and might be able to reccomend a workaround if neccesary.

Probably the only other way to do it is to Whisper the event. But I don't want to do it that way. :p But no, I have not. I'll give it a few days to get a solid answer. For now I'll just use the radial to fire the touch event.

Jeremy, that was my first thought as well. But the fact that the old root doesn't re-link is perplexing. Re-linking the event and the touch event are not really related; not directly anyway, IMO. That's why I posted the SwapRoot() function, so you can see that there is nothing else happening during the re-linking process.

The link set is broken and then the Ball and Socket are re-linked in opposite order via the script in the Rod. And if it were a matter of lag and the prims just haven't "caught up", I would think that they eventually would. But they don't. They are just lost from the set.

EDIT: Oh, and nothing else happens after the SwapRoot. The script in the Rod just exits the linkmessage(). It receives a messge with the text "ROOTME", and then executes SwapRoot(). It doesn't even have to worry about which prim sent the message, since it already has the keys, and just swaps them.