Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Move two linked child prims at the same time?

Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
10-25-2007 12:34
I'm building a project where I need to move two linked child prims at the same time, and have them move in a synchronised fashion so they don't seem to be moving out of step with each other. The movement itself is very simple, just a straight line.

I've been using llSetLinkPrimitiveParams and adjusting the prim position. The problem I'm having is the 0.2 second delay means that between moving one child then moving the other child, there's that 0.2 second delay which is obvious enough that it doesn't look right. Ideally I'd have liked to be able to feed two link numbers to llSetLinkPrimitiveParams but that doesn't appear to be possible.

I've considered putting separate scripts in each of the two child prims and then triggering them with a link message, but I'm concerned that this will just trade one timing problem for another -- I've seen the link messages fail now and then, and the only thing that would be worse than the two prims moving out of step with each other would be one of them not moving at all, so I'd like to keep everything within a single script if that's at all possible.

So, I'm hoping someone else may have come across this and come up with a solution? Thanks!

-Atashi
_____________________
Visit Atashi's Art and Oddities Store and the Waikiti Motor Works at beautiful Waikiti.
Phidian Krasner
SL Exotic Pets
Join date: 22 Dec 2006
Posts: 26
10-25-2007 14:18
I think your heading in the right dierection to control them via separate scripts and trigger them with a single LinkdMessage.

I just did this recently to syncronize some stuff on my Storm Cloud security device and the sync was pretty good. I also did this to synchronize a texture change across about 100 prims on another project and that too worked pretty good.

Linked Messages are wonderful for this sorta stuff.

-Phidian
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
10-25-2007 14:57
Can't you use a linked message that triggers a llSetPos; they don't have delay.. unless you're trying to move it really far along the line. Then i'm not quite sure, though you could use WarpPos, though that might be a little too fast.
_____________________
From: someone

Don't worry, Aniam is here!
- Noob
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-25-2007 15:50
A little trick I use a lot of times with no time penalty is either llSetColor/llSetAlpha or llSetLinkColor/llSetLinkAlpha. If you have a face that is not visible in the child prim or you can just make them hollow etc. Send the message to change alpha on only that face in each prim and then use something like this in each one you want to move:


CODE


default
{
changed(integer change)
{

float alpha = llGetAlpha(5);//number of the face here
if(change & CHANGED_COLOR)
{
if(alpha > 0.5)
{
llSetPos(<0.0.0>);//wherever
}
else
llSetPos(<0.0.0>);//wherever else
}

}
}
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
10-26-2007 02:20
You might also be able to use a single call to llSetLinkPrimitiveParams(), with concatenated lists for each child prim ?

[Edit]Ack, no, it won't do, the function only allows one set of prim params.
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
10-26-2007 07:04
Thanks for the suggestions everyone! I tried using llSetPos but it too incurrs a 0.2 second delay.

I will try using a pair of scripts that are triggered in tandem by a link message and see how that works. As long as the link message works, it ought to allow things to happen in sync - or at least close enough that people don't really notice any slight delays or stutters.

-Atashi
_____________________
Visit Atashi's Art and Oddities Store and the Waikiti Motor Works at beautiful Waikiti.
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
10-26-2007 07:36
From: Atashi Toshihiko
I will try using a pair of scripts that are triggered in tandem by a link message and see how that works.

That's what I do in creature animation, it works great. You can also use chat as a good alternative to link message.
_____________________
Either Man can enjoy universal freedom, or Man cannot. If it is possible then everyone can act freely if they don't stop anyone else from doing same. If it is not possible, then conflict will arise anyway so punch those that try to stop you. In conclusion the only strategy that wins in all cases is that of doing what you want against all adversity, as long as you respect that right in others.
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
Timer scripts in library...
10-26-2007 08:24
I wrote a couple of timer scripts that are in the Forums Script Library.

You could adapt them to be pretty precise. Instead of sending a message to each child saying Do X Now...you send a message that says Do X at time YYYY. (YYYY could be only a few milliseconds in the future. The timers are accurate to better than a tenth of a second.

I have a demo I could send you...it is a bunch of boxes that rotate at exactly the same instant even though they do not exchange messages.

/15/24/184642/1.html

/15/4c/180313/1.html
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
message delivery
10-26-2007 09:08
About sending messages...

Delivery is not guaranteed. That is, you can send one and it will never arrive. It is designed that way. Live with it.

One simple band-aid is to send every message two times or more, and design the protocol so that receiving two copies of the same message is OK.

Also, order of arrival is not guaranteed. You can send A followed by B, and they both arrive, but B arrives first. Fun, eh? They don't even need to arrive at different objects in the same order.
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
10-26-2007 09:26
From: Lee Ponzu
About sending messages...Delivery is not guaranteed.

And so many times I've asked myself whether all that check code was worth all the time and effort in the end since nothing is ever guaranteed (not even owning things you purchased - i.e. inventory loss).

Yea - I'm just whining :)
_____________________
http://slurl.com/secondlife/Together
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
10-26-2007 11:02
Try this...
Create two new scripts, each using llSetLinkPrimitiveParams, targeting their respective prims, but place them in the same prim

use one llMessageLinked call targeted at the prim they are in to trigger them both

I've never seen one script in a single prim get a link message and another in the same prim NOT get it... so if it fails, neither child moves

...in fact I don't believe I've ever seen failures except when using LINK_ALL, LINK_ALL_OTHERS, or LINK_ALL_CHILDREN....

anyone feel free to chime in if they have
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Atashi Toshihiko
Frequently Befuddled
Join date: 7 Dec 2006
Posts: 1,423
10-26-2007 12:03
Thanks Void -- that's what I was thinking of doing, in fact. Where I have the one script calling llSetLinkPrimitiveParams twice, I'd replace that with a llMessageLinked call to LINK_THIS then have two more tiny scripts in the same prim, each calling llSetLinkPrimitiveParams once when they hear the right link message from LINK_THIS

Will be trying it out when I can get inworld later today.

-Atashi
_____________________
Visit Atashi's Art and Oddities Store and the Waikiti Motor Works at beautiful Waikiti.