Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Menu Animation

Dragos Zaoh
Registered User
Join date: 11 Dec 2006
Posts: 58
06-28-2007 12:31
Name your animations : animation1, animation2,animation3,animation4,animation5.


CODE

vector offset=<0.2,0,0.1>;
key avatar;
integer is_sitting;

default
{
state_entry()
{
llSitTarget(offset,ZERO_ROTATION);
llListen(789789, "", "", "");
avatar = llGetKey();
is_sitting = 0;
}

touch_start(integer num)
{
llDialog(llDetectedKey(0), "Choose your position:", ["animation1", "animation2", "animation3", "animation4", "animation5"], 789789);
}

listen( integer channel, string name, key id, string message )
{
if( message == "animation1" )
{ if (llAvatarOnSitTarget() != NULL_KEY) {
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
llSetLinkPrimitiveParams(2, [ PRIM_POSITION,<0,0,0.25>, PRIM_ROTATION,<0,-0.02,0,1> ] );

llStartAnimation("animation1");
}}

if( message == "animation2" )
{if (llAvatarOnSitTarget() != NULL_KEY) {
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
llSetLinkPrimitiveParams(2, [ PRIM_POSITION,<0,0,0.5> ,PRIM_ROTATION,<0,-0.03,0,1>] );
llStartAnimation("animation2");
}}
if( message == "animation3" )
{if (llAvatarOnSitTarget() != NULL_KEY) {
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
llSetLinkPrimitiveParams(2, [ PRIM_POSITION,<0.3,0,0.42> ] );
llStartAnimation("animation3");
}}
if( message == "animation4" )
{if (llAvatarOnSitTarget() != NULL_KEY) {

llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
llSetLinkPrimitiveParams(2, [ PRIM_POSITION,<0,0,1.4>,PRIM_ROTATION,<0,0,0,1> ] );
llStartAnimation("animation4"); }}
if( message == "animation5" )
{
if (llAvatarOnSitTarget() != NULL_KEY) {
llRequestPermissions(llAvatarOnSitTarget(), PERMISSION_TRIGGER_ANIMATION);
llSetLinkPrimitiveParams(2, [ PRIM_POSITION,<0,0,0.41> ] );
llStartAnimation("animation5");
}}


}

changed(integer change)
{
if(change & CHANGED_LINK)
{
key avatar = llAvatarOnSitTarget();

if(avatar != NULL_KEY)
{
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
llSetLinkPrimitiveParams(2, [ PRIM_POSITION,<0,0,0.25>, PRIM_ROTATION,<0,-0.02,0,1> ] );

llStartAnimation("animation1");
}
else
{
if((llGetPermissions() & PERMISSION_TRIGGER_ANIMATION) && is_sitting)
{
is_sitting = 0;
llStopAnimation("animation1");
llStopAnimation("animation2");
llStopAnimation("animation3");
llStopAnimation("animation4");
llStopAnimation("animation5");



}
}

}

}

run_time_permissions(integer a)
{
if (a & PERMISSION_TRIGGER_ANIMATION)
{
string null=(string)NULL_KEY;
list a=llGetAnimationList(avatar);
integer b;
for (b;b<llGetListLength(a);b++)
{
if (llList2String(a,b)!= null )
{
if(llList2String(a,b) != "2408fe9e-df1d-1d7d-f4ff-1384fa7b350f")
{
llStopAnimation(llList2String(a,b));
}
}
}

}

}

on_rez(integer start_param)
{
llResetScript();
}

}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
06-29-2007 00:23
/15/28/194031/1.html
_____________________
i've got nothing. ;)
Bizcut Vanbrugh
Registered User
Join date: 23 Jul 2006
Posts: 99
07-10-2007 08:01
i have been trying to use this script and for some reason it keeps turning me upside down and juust moves me around a bit when i try to change poses . am i doing something wrong ?
jefferey Heart
Registered User
Join date: 25 Jan 2006
Posts: 45
This script
07-11-2007 16:14
From: Bizcut Vanbrugh
i have been trying to use this script and for some reason it keeps turning me upside down and juust moves me around a bit when i try to change poses . am i doing something wrong ?


Note the vector rotations in it... You have to adjust those according to the rotation of your PRIM.

It would be nice to have someone MERGE this script with the one that was posted earlier that allows the person sitting to adjust all of the rotations based off a default one that is put in it. Then Each Avie would have to just do a simple ADJUST for Height and Horizontal. Would be VERY USEFUL indeed.
Learjeff Innis
musician & coder
Join date: 27 Nov 2006
Posts: 817
08-06-2007 11:09
There's a better way: the script should simply interrogate the inventory rather than forcing you to name the anims. After all, we like to be able to use anims that are no-mod. And it's nice if the menu choices are clearer (assuming the anims are well named).

I posted a pair of free scripts that don't provide a menu, but allow cycling through any animations using shift-arrow keys. For more info: