Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Dance balls - timing question

Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-06-2005 18:20
Hi folks,

Makin a set of dance balls for my honey and I (we got sick of those standard ones you see out there). I've got the anims already made & uploaded, just need a way to get the anim balls (already made) to wait for both folks to attach before it starts. Right now they both play but not in sync with each other. :(

Help is appreciated!
-Syn :)
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-07-2005 09:48
Nobody?

/me isnt feeling very Zen anymore
Zuzi Martinez
goth dachshund
Join date: 4 Sep 2004
Posts: 1,860
03-07-2005 10:07
maybe link the balls to a central invis prim and have it get link messages from the changed events in each ball and send them link messages telling what to do when the time is right?

*dumps some zen on you*
_____________________
Zuzi Martinez: if Jeska was Canadian would she be from Jeskatchewan? that question keeps me up at nite.
Jeska Linden: That is by far the weirdest question I've ever seen.
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-07-2005 10:42
Link two prims, then add this script to both:

CODE
string anim = "stand"; // Add animation here.
key agent = "";
integer number = 0;

default
{
changed(integer change)
{
if(change & CHANGED_LINK)
{
agent = llAvatarOnSitTarget();
if(agent)
llMessageLinked(LINK_SET,1,"change","");
else
{
llStopAnimation(anim);
llMessageLinked(LINK_SET,-1,"change","");
}
}
}
link_message(integer sender,integer num, string str, key id)
{
if(str == "change") // Just in case
{
number += num;
if(number < 0) num = 0;
else if(number > 1)
llRequestPermissions(agent,PERMISSION_TRIGGER_ANIMATION);
}
}
run_time_permissions(integer perm)
{
if(perm)
{
llStopAnimation("sit");
llStartAnimation(anim);
}
}
}


I just wrote that out-of-world, though, so it might be bugged. :p

Also, note this new change as of 1.6:

From: someone
* Scripts with animation permissions will now time out and lose animation permissions if unable to find the agent for 1 second.
_____________________
---
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-07-2005 16:52
Thanks Jeffrey, getting

Object (0, 0):
Script trying to stop animations but PERMISSION_TRIGGER_ANIMATION permission not set

errors :(

Is this because I have nobody to help me test it at the moment? lol
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-07-2005 16:57
That just means it's attempting to start an animation prematurely. You should get that because llRequestPermissions did not trigger properly for one (or both) agents. It... well, happens at times. :p
_____________________
---
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-07-2005 16:58
So it's because I'm testing this alone? Or not?

And can I stifle that pop up somehow?
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-07-2005 17:06
Ok the wife just showed up, we both just sit on the balls & do nothing lol
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-08-2005 08:33
Also wondering about this section of code:

CODE

if(str == "change") // Just in case
{
number += num;
if(num < 0) num = 0;
else if(num > 1)
llRequestPermissions(agent,PERMISSION_TRIGGER_ANIM ATION);
}


Should it read

CODE

if(str == "change") // Just in case
{
number += num;
if(number < 0) number = 0;
else if(number > 1)
llRequestPermissions(agent,PERMISSION_TRIGGER_ANIM ATION);
}


?
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-08-2005 08:34
CODE
code
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-08-2005 10:39
Whoops! Yes. Sorry about that - like I said, writing it out of the editor, so occasionally I'll make a mistake. :)
_____________________
---
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-08-2005 10:45
Ok, but why are we just sitting on the balls instead of dancing?
Jeffrey Gomez
Cubed™
Join date: 11 Jun 2004
Posts: 3,522
03-08-2005 10:57
"Sitting" the ball will give you a static position for your two avatars, since you're probably doing a dual animation. You can rig this to use "touch_start," I guess (you'd need to use link_messages to see if an avatar was "on the ball" as well), but this would defeat the purpose of having two avatars in an animation anyway... because they could easily move around and be out of synch. :p

You also said "attach" at the start of the post. Attach means sit something or put on an attachment, generally. :D
_____________________
---
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
03-08-2005 13:21
My apologies, i meant sit on them, not attach. Like standard dance balls
Ricky Shaftoe
Owner, "Rickymations"
Join date: 27 May 2005
Posts: 366
09-24-2005 10:11
Well, I can't get this script to work either. The two avi's just sit on their respective balls and don't animate. Should the two scripts be identical, or should they be different? If each script uses the same variable name, does that confuse the other if the scripts are on linked prkims?

I'd rather use linked messages than llListen, so can anyone tell me how to fix this?
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
09-24-2005 12:11
See this thread ;)
_____________________
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.
Ricky Shaftoe
Owner, "Rickymations"
Join date: 27 May 2005
Posts: 366
09-24-2005 12:52
Thanks, I did read that thread, and indeed posted in it earlier. But I've been mindful of warnings to avoid llListen if possible, so I was hoping to use the linked message routines. But what the heck, I'll give the llListen method a try. Thanks. :)

In the meantime, any thoughts on using linked messages as an alternative?
Jesrad Seraph
Nonsense
Join date: 11 Dec 2004
Posts: 1,463
09-24-2005 23:40
Why avoid using listens ? Anyway you can link the objects together and use link messages instead of say and listen, and it'll work the same :)
_____________________
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.
Ricky Shaftoe
Owner, "Rickymations"
Join date: 27 May 2005
Posts: 366
09-25-2005 08:49
Well, I keep reading that a lot of listens have a deleterious effect on server performance. But now I also read that 1.7 will change this, and that listens will merely effect the speed at which scripts run. Or something like that. So listen may be fine. And I've had an easier time getting listen to work than linked messages.

The odd thing with listen, though, is that linking the balls seems to mess it up. They talk to each other fine; but once they're hitched, communication breaks down. Poseball marriages: so fragile! Any idea why linking might interfere with listening?