Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Can someone help me...

DebbieAnn Fairplay
Registered User
Join date: 14 Jul 2004
Posts: 35
02-11-2009 19:36
to put the stop animation button on this script... its like a dance ball but I need the stop option... couldnt figure that part out... can someone help me?

FYI, I know NOTHING about scripts... most of this stuff I copied from a totorial. It works great for what I want except it didnt tell me how to stop it so the person can stand up again...

Total Beyond totally BIG thanks to anyone who can help me.




list seat = ["KneeUp","SitUp","sleep"];
string seat_chosen;
key avatar;

default
{
state_entry()
{

}

touch_start(integer total_number)
{
avatar = llDetectedKey(0);
llDialog(avatar,
"choose a seat",
seat,
11);

llListen(11,"",NULL_KEY,"";);
}
listen(integer channel,
string name,
key id,
string message)
{
seat_chosen = message;
llRequestPermissions(avatar,
PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions( integer perm )
{
if(PERMISSION_TRIGGER_ANIMATION & perm)
{
llStartAnimation(seat_chosen);
}
}
}
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
02-11-2009 20:09
This should work, off the top of my head and untested.

CODE
list seat = ["KneeUp","SitUp","sleep", "stop"];  // <--- added stop to menu
string seat_chosen;
key avatar;
integer STOP = FALSE // <--- simple boolean check, used to pass to run_time_permissions
default
{
touch_start(integer total_number)
{
avatar = llDetectedKey(0);
llDialog(avatar, "choose a seat", seat, 11);
llListen(11,"",NULL_KEY,"");
}

listen(integer channel, string name, key id, string message)
{
if(message != "stop")
{
seat_chosen = message;
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
else //message is stop
{
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
STOP = TRUE;
}
}
run_time_permissions( integer perm )
{

if(PERMISSION_TRIGGER_ANIMATION & perm)
{
if(STOP)
{
list anims = llGetAnimationList(avatar);
integer index;
integer animlength = llGetListLength(anims);
for(index = 0; index < animlegth; index++)
{
llStopAnimation(llList2String(anims, index));
}
STOP = FALSE;
}
else
{
llStartAnimation(seat_chosen);
}
}
}
}


What I did was get the animations that are currently playing for that avatar and stopped them all. It's easier then making a list of what anim the avatar chose, then looking it up, and stopping that one anim.
DebbieAnn Fairplay
Registered User
Join date: 14 Jul 2004
Posts: 35
02-11-2009 21:48
thanks but I keep getting error messages
Lazink Maeterlinck
Registered User
Join date: 8 Nov 2005
Posts: 332
02-11-2009 21:52
OK, was a few syntax errors, this will compile

list seat = ["KneeUp","SitUp","sleep", "stop"]; // <--- added stop to menu
string seat_chosen;
key avatar;
integer STOP = FALSE; // <--- simple boolean check, used to pass to run_time_permissions
default
{
touch_start(integer total_number)
{
avatar = llDetectedKey(0);
llDialog(avatar, "choose a seat", seat, 11);
llListen(11,"",NULL_KEY,"";);
}

listen(integer channel, string name, key id, string message)
{
if(message != "stop";)
{
seat_chosen = message;
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
else //message is stop
{
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
STOP = TRUE;
}
}
run_time_permissions( integer perm )
{

if(PERMISSION_TRIGGER_ANIMATION & perm)
{
if(STOP)
{
list anims = llGetAnimationList(avatar);
integer index;
integer animlength = llGetListLength(anims);
for(index = 0; index < animlength; index++)
{
llStopAnimation(llList2String(anims, index));
}
STOP = FALSE;
}
else
{
llStartAnimation(seat_chosen);
}
}
}
}
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
Try this:
02-11-2009 22:03
CODE


list seat = ["KneeUp","SitUp","sleep","Stop"];
string seat_chosen;
string current;
key avatar;

default
{
touch_start(integer total_number)
{
avatar = llDetectedKey(0);
llDialog(avatar, "choose a seat", seat, 11);
llListen(11,"",NULL_KEY,"");
}
listen(integer channel, string name, key id, string message)
{
seat_chosen = message;
llRequestPermissions(avatar, PERMISSION_TRIGGER_ANIMATION);
}
run_time_permissions( integer perm )
{
if(PERMISSION_TRIGGER_ANIMATION & perm){
if (seat_chosen != "Stop") {
llStartAnimation(seat_chosen);
current = seat_chosen;
} else llStopAnimation(current);
}
}
}

DebbieAnn Fairplay
Registered User
Join date: 14 Jul 2004
Posts: 35
02-11-2009 22:15
Thank you, I'll try it now