Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Universal Change Event?

Bartiloux Desmoulins
Think Kink? Think Bart!
Join date: 27 Sep 2005
Posts: 121
04-11-2007 22:25
I have two linked pose balls I am trying to sync using snippets of code I've found here in the forum. After placing tons of llSays in the code to debug it, I am finding that when an av sits on either pose ball the CHANGED event is being triggered in BOTH pose balls / scripts. As you might imagine this is causing some "unexpected" results.

Have you ever heard of this happening? Is it to be expected, since prims are linked? What can I do to get around this?

Any help you might provide would be GREATLY appreciated.

Bartiloux Desmoulins
Anti Antonelli
Deranged Toymaker
Join date: 25 Apr 2006
Posts: 1,091
04-11-2007 22:54
Yep, that's correct and it does add some pain to synced poseballs.

I'm sure there are several ways to handle it, but here's what I do for my couple's poseballs, in very rough pseudocode:

CODE

integer avatarSittingOnMe = FALSE;

changed etc

if llAvatarOnSitTarget != NULL_KEY
{
avatarSittingOnMe = TRUE
llMessageLinked(the_other_ball, "Is there someone sitting on you?", etc)
}

link_message()
if (the other ball asked me the same question)
{
tell it if I have someone sitting on me
}

if (got a reply, there is someone on the other ball too)
{
do animating stuff
}


Hope that helps a little anyway :)
Bartiloux Desmoulins
Think Kink? Think Bart!
Join date: 27 Sep 2005
Posts: 121
04-12-2007 05:59
So, should the starting and stopping of the animation only take place in the "link message" section... since the CHANGED event always seems to call the "link message" section? This is one tricky script!!
Pericat Aquitaine
Registered User
Join date: 26 Feb 2006
Posts: 24
04-12-2007 12:14
you might try using llGetNumberOfPrims() in the changed event to see how many avatars are linked.
_____________________
I like ducks. They're just so... ducky.
Tiarnalalon Sismondi
Registered User
Join date: 1 Jun 2006
Posts: 402
04-12-2007 12:34
What was posted previously should be fairly close to what you need.

Basically the Changed event fires whenever there is a change to any part of the linkset. So no matter which prim gets sat on, both scripts are going to hit the changed event.

The way to check is with a Sit Target...each prim will recognize if llAvatarOnSitTarget applies to them because this command checks to see if there's an avatar on the prim's own sit target and will ignore sit targets on other prims even if they're linked.

So if both scripts only fire they're sit actions if llAvatarOnSitTarget() != NULL_KEY, then it should be fine as it will only go off when someone sits on that prim.