start animation via menu
|
|
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
|
09-07-2007 00:22
Hi, I tried to figure out how to solve this script. It gives an error at line 13. no overload for method 'llStartAnimation' takes '2' arguments I like to start a animation via a menu and it should ask for permission each time there will be another one selected. integer COMMAND_CHANNEL = 101; string CurrentAnimation = ""; integer PermGranted=FALSE; list Animaties = [ "animation1", "animation2", "animation3", "animation4", "animation5"] ;
StartAnimatie(key id, string anim) { CurrentAnimation = anim;
if (!PermGranted) llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION); else llStartAnimation(id, CurrentAnimation); }
StopAnimatie() { if (PermGranted) llStopAnimation(CurrentAnimation); }
default { state_entry() { llListen(COMMAND_CHANNEL, "", NULL_KEY, "" ); }
listen( integer chan, string name, key id, string msg ) { integer index; if (msg == "menu" ) { llDialog(llDetectedKey(0), "Choose your animation:", ["animation4", "animation5", "stop", "animation1", "animation2", "animation3"], COMMAND_CHANNEL); } index = llListFindList(Animaties, [ llToLower(msg) ]);
if (index != -1) { StartAnimatie(id, llList2String(Animaties, index)); } else if ( msg == "stop") { StopAnimatie(); } }
run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { PermGranted = TRUE; llStartAnimation(CurrentAnimation); } } }
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
09-07-2007 00:58
From: Milcoi Delcon llStartAnimation(id, CurrentAnimation); llStartAnimation has only one parameter: a string containing the name of the animation to play. The avatar is specified by whom granted PERMISSION_TRIGGER_ANIMATION.
|
|
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
|
09-07-2007 01:38
ok... so change this into llStartAnimation(CurrentAnimation); should solve the problem?
when I test this the script seems ok but it won't ask for permission when you select another animation and I don't see it stopping the former animation.
help would be nice. ty
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
09-07-2007 02:08
From: Milcoi Delcon ok... so change this into llStartAnimation(CurrentAnimation); should solve the problem? It should. From: someone it won't ask for permission when you select another animation This script only requests permissions when PermGranted is false. PermGranted is set to true once and never set false again, unless the script is reset. From: someone and I don't see it stopping the former animation. This script only calls llStopAnimation when the Stop button is pressed by the user.
|
|
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
|
09-07-2007 02:21
I think I solved it! I added: 2 more Permgranted = FALSE; removed the ID at llStartAnimation(CurrentAnimation); 1 extra llStopAnimation(CurrentAnimation); integer COMMAND_CHANNEL = 101; string CurrentAnimation = ""; integer PermGranted=FALSE; list Animaties = [ "animation1", "animation2", "animation3", "animation4", "animation5"] ;
StartAnimatie(key id, string anim) { CurrentAnimation = anim;
if (!PermGranted) llRequestPermissions(id, PERMISSION_TRIGGER_ANIMATION); else llStartAnimation(CurrentAnimation); }
StopAnimatie() { if (PermGranted) llStopAnimation(CurrentAnimation); }
default
{ state_entry() { llListen(COMMAND_CHANNEL, "", NULL_KEY, "" ); }
listen( integer chan, string name, key id, string msg ) { integer index; if (msg == "menu" ) { llDialog(llDetectedKey(0), "Choose your animation:", ["animation4", "animation5", "stop", "animation1", "animation2", "animation3"], COMMAND_CHANNEL); } index = llListFindList(Animaties, [ llToLower(msg) ]);
if (index != -1) { llStopAnimation(CurrentAnimation); // to make sure the animation stop PermGranted = FALSE; //extra to request permission each time llSleep(1); StartAnimatie(id, llList2String(Animaties, index)); } else if ( msg == "stop") { StopAnimatie(); PermGranted = FALSE; //extra to request permission each time } }
run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { PermGranted = TRUE; llStartAnimation(CurrentAnimation); } } }
|
|
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
|
09-07-2007 04:10
just to confirm.
it's working within SLSEditor
ty
|
|
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
|
09-07-2007 10:15
perfect in SLS editor...
In SL it's not that good. when selecting an animation for the first time it gives me an error that there is no animation to stop.
I want that option, first stop the current animation before starting the new one.
any 1 willing to help?
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
09-07-2007 21:49
You need to insert a conditional filter to only execute llStopAnimation if an animation is currently playing. i.e., if CurrentAnimation != ""
|
|
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
|
09-08-2007 04:17
Could you please help puting this into the right position in the script.
I tried serverall way's but no succes.
|
|
Milcoi Delcon
Registered User
Join date: 24 May 2007
Posts: 30
|
09-08-2007 05:14
something like this? integer COMMAND_CHANNEL = 101; string CurrentAnimation = ""; integer PermGranted=FALSE; list Animaties = [ "ani1", "ani2", "ani3", "ani4", "ani5"] ; StartAnimatie(key id, string anim) { CurrentAnimation = anim; if (!PermGranted) llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } default { state_entry() { llListen(COMMAND_CHANNEL, "", NULL_KEY, "" ); } listen( integer chan, string name, key id, string msg ) { integer index; if (msg == "menu" ) { llDialog(llGetOwner(), "Choose your animation:", ["ani4", "ani5", "ani1", "ani2", "ani3"], COMMAND_CHANNEL); } index = llListFindList(Animaties, [ llToLower(msg) ]); if (CurrentAnimation != ""  { llStopAnimation(CurrentAnimation); } if (index != -1) { PermGranted = FALSE; // ask permission StartAnimatie(id, llList2String(Animaties, index)); } } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { PermGranted = TRUE; llStartAnimation(CurrentAnimation); } } }
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
09-08-2007 20:33
That should do it. You'll also want to blank the value of CurrentAnimation immediately after calling llStopAnimation, so that the test you just inserted is consistent.
|