Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Synched Poseballs?

Imago Aeon
Animation Designer
Join date: 23 Oct 2007
Posts: 65
04-10-2008 14:46
Hi, pretty new to the forums. *laughs* But I've found lots of great tips here. But I've been at my wits end messing with this code that I found in my seemingly endless inventory. But I need poseballs that are linked that animate (just one animation I don't really need a sequence of them). But this code is insane.

[code for the female poseball]

//First value is the waiting animation, second and else is for motion. The order is respected!
//Example: list animation = ["wait", "motion1", "motion2", "motionN"];
list ANIMS = ["animW", "animA", "animB", "animC"];

string BUTTON = "Play"; // text of the pie menu
string TITLE = "fem"; // floating text
float TIMEOUT = 30.0; // time to play each anim listed
vector ROTATION = <0,0,0>; // euler in degrees (like the edit box)
vector OFFSET = <0,0,0.5>; // how far the person sits from the ball. ( <X,Y,Z> )

//do not edit after this line if you are not confortable with programmin languages

string BALL = "FEM"; integer RUN = TRUE; integer MAL; integer FEM; integer INDEX;

show() { RUN = TRUE; llSetText(TITLE, <1.0,1.0,1.0> ,1.0); llSetAlpha(1.0, ALL_SIDES); }

hide() { RUN = FALSE; llSetText("", ZERO_VECTOR, FALSE); llSetAlpha(0.0, ALL_SIDES); }

stopAnims() {
integer i; list anims = llGetAnimationList(llGetPermissionsKey());
for (i=0;i<llGetListLength(anims);++i) llStopAnimation(llList2Key(anims, i));
}

default {
state_entry() {

if (llAvatarOnSitTarget()) { llUnSit(llAvatarOnSitTarget()); }
llSetSitText(BUTTON); if (RUN) show(); else hide(); MAL = FALSE; FEM = FALSE;
}

link_message(integer sender_num, integer num, string str, key id) {
if ((string)id=="BALL";) {
if (str=="MAL";) { MAL=num; } else if (str=="FEM";) { FEM=num; }
if (FEM && MAL) { llMessageLinked(LINK_SET, TRUE, "ANIMS", NULL_KEY); }
else if (FEM || MAL) { llMessageLinked(LINK_SET, FALSE, "ANIMS", NULL_KEY); }
else { llResetScript(); }
}
else if (str=="ANIMS";) {
if (num) { INDEX = 0; llSetTimerEvent(0.01); }
else { llSetTimerEvent(0.0); if (llAvatarOnSitTarget()) { stopAnims(); llStartAnimation(llList2String(ANIMS,0)); } }
}
}

timer() { if (++INDEX==llGetListLength(ANIMS)) { INDEX=TRUE; } llStartAnimation(llList2String(ANIMS,INDEX)); llSetTimerEvent(TIMEOUT); }

changed(integer change) {
if(change & CHANGED_LINK) { key avatar = llAvatarOnSitTarget();
if (avatar!=NULL_KEY) {
if(llGetPermissionsKey() != avatar) { llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); }
hide(); llMessageLinked(LINK_SET, TRUE, BALL, (key)"BALL";);
}
else if ((llGetPermissionsKey()!=NULL_KEY) && (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) {
show(); llMessageLinked(LINK_SET, FALSE, BALL, (key)"BALL";); stopAnims();
} } if (change & CHANGED_INVENTORY) { llResetScript(); } }

run_time_permissions(integer perm) {
key avatar = llAvatarOnSitTarget();
if(perm & PERMISSION_TRIGGER_ANIMATION && llKey2Name(avatar) != "" && avatar == llGetPermissionsKey()) {
stopAnims();
llStartAnimation(llList2String(ANIMS,0));
hide();
} } }

[code for the male poseball]

//First value is the waiting animation, second and else is for motion. The order is respected!
//Example: list animation = ["wait", "motion1", "motion2", "motionN"];
list ANIMS = ["animW", "animA", "animB", "animC"];

string BUTTON = "Play"; // text of the pie menu
string TITLE = "mal"; // floating text
float TIMEOUT = 30.0; // time to play each anim listed
vector ROTATION = <0,0,0>; // euler in degrees (like the edit box)
vector OFFSET = <0,0,0.5>; // how far the person sits from the ball. ( <X,Y,Z> )

//do not edit after this line if you are not confortable with programmin languages

string BALL = "MAL"; integer RUN = TRUE; integer MAL; integer FEM; integer INDEX;

show() { RUN = TRUE; llSetText(TITLE, <1.0,1.0,1.0> ,1.0); llSetAlpha(1.0, ALL_SIDES); }

hide() { RUN = FALSE; llSetText("", ZERO_VECTOR, FALSE); llSetAlpha(0.0, ALL_SIDES); }

stopAnims() {
integer i; list anims = llGetAnimationList(llGetPermissionsKey());
for (i=0;i<llGetListLength(anims);++i) llStopAnimation(llList2Key(anims, i));
}

default {
state_entry() {
llSitTarget(OFFSET, llEuler2Rot(ROTATION * DEG_TO_RAD));
if (llAvatarOnSitTarget()) { llUnSit(llAvatarOnSitTarget()); }
llSetSitText(BUTTON); if (RUN) show(); else hide(); MAL = FALSE; FEM = FALSE;
}

link_message(integer sender_num, integer num, string str, key id) {
if ((string)id=="BALL";) {
if (str=="MAL";) { MAL=num; } else if (str=="FEM";) { FEM=num; }
if (FEM && MAL) { llMessageLinked(LINK_SET, TRUE, "ANIMS", NULL_KEY); }
else if (FEM || MAL) { llMessageLinked(LINK_SET, FALSE, "ANIMS", NULL_KEY); }
else { llResetScript(); }
}
else if (str=="ANIMS";) {
if (num) { INDEX = 0; llSetTimerEvent(0.01); }
else { llSetTimerEvent(0.0); if (llAvatarOnSitTarget()) { stopAnims(); llStartAnimation(llList2String(ANIMS,0)); } }
}
}

timer() { if (++INDEX==llGetListLength(ANIMS)) { INDEX=TRUE; } llStartAnimation(llList2String(ANIMS,INDEX)); llSetTimerEvent(TIMEOUT); }

changed(integer change) {
if(change & CHANGED_LINK) { key avatar = llAvatarOnSitTarget();
if (avatar!=NULL_KEY) {
if(llGetPermissionsKey() != avatar) { llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION); }
hide(); llMessageLinked(LINK_SET, TRUE, BALL, (key)"BALL";);
}
else if ((llGetPermissionsKey()!=NULL_KEY) && (llGetPermissions() & PERMISSION_TRIGGER_ANIMATION)) {
show(); llMessageLinked(LINK_SET, FALSE, BALL, (key)"BALL";); stopAnims();
} } if (change & CHANGED_INVENTORY) { llResetScript(); } }

run_time_permissions(integer perm) {
key avatar = llAvatarOnSitTarget();
if(perm & PERMISSION_TRIGGER_ANIMATION && llKey2Name(avatar) != "" && avatar == llGetPermissionsKey()) {
stopAnims();
llStartAnimation(llList2String(ANIMS,0));
hide();
} } }


It's probably something simple, but this one just goes insane when I try to use it. Any help is appreciated.
Ravanne Sullivan
Pole Dancer Extraordinair
Join date: 10 Dec 2005
Posts: 674
04-10-2008 15:38
Can you define "insane"? Has anyone been killed? Or just maimed?
_____________________
Ravanne's Dance Poles and Animations

Available at my Superstore and Showroom on Insula de Somni
http://slurl.com/secondlife/Insula de Somni/94/194/27/
Imago Aeon
Animation Designer
Join date: 23 Oct 2007
Posts: 65
04-10-2008 15:41
*laughs* When someone sits on the one ball without someone else coming to sit on the other. The avatar who's sitting keeps their head in one place and the entire body spins in a circle over and over until someone else sits down. LOL! It's amusing but not something you want to happen when you're having someone over.
Chaz Longstaff
Registered User
Join date: 11 Oct 2006
Posts: 685
04-14-2008 17:11
did you make any headway on this poseball sychronization?
Imago Aeon
Animation Designer
Join date: 23 Oct 2007
Posts: 65
04-14-2008 17:30
Sort of. It's probably something minor. But the wait pose was the one that was making the body spin. But still having the problem with not releasing the animations. Sometimes they stick and stay like that and have to jump on another ball to fix themselves. It only happens once in a while, but still... Once is enough. LOL!