Whats wrong with this script?
|
|
woofbag Fudo
Registered User
Join date: 3 Aug 2006
Posts: 31
|
08-28-2007 22:33
default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); { if(llGetAgentInfo(llGetOwner())& AGENT_FLYING) { llStartAnimation("Jetpack Controls Anim 5"  ; } else { llStopAnimation("Jetpack Controls Anim 5"  ; } } } It keeps giving me syntax errors...
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
08-28-2007 22:42
|
|
woofbag Fudo
Registered User
Join date: 3 Aug 2006
Posts: 31
|
08-28-2007 22:53
uh.... how would I put that into my script?
|
|
Darko Lednev
Registered User
Join date: 20 Aug 2007
Posts: 31
|
08-28-2007 22:56
You get the syntax error because a "{" after the llRequestPermissions whitch is not closed. Still I don't think it will work because you need a "run_time_permissions" state that will trigger if the permission is obtained. Something like this (Not tested, just a guideline): default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } run_time_permissions(integer permissions) { if(llGetAgentInfo(llGetOwner())& AGENT_FLYING) { llStartAnimation("Jetpack Controls Anim 5"  ; } else { llStopAnimation("Jetpack Controls Anim 5"  ; } } }
|
|
woofbag Fudo
Registered User
Join date: 3 Aug 2006
Posts: 31
|
08-28-2007 23:14
ok, tried this: default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { if (llGetAgentInfo(llGetOwner())& AGENT_FLYING) { llStartAnimation("Jetpack Controls Anim 5"  ; } else { llStopAnimation("Jetpack Controls Anim 5"  ; } } } And I still get errors...
|
|
Darko Lednev
Registered User
Join date: 20 Aug 2007
Posts: 31
|
08-28-2007 23:22
HINT1: Count the brackets HINT2: Use the LSLEditor ( /54/16/182108/1.html)
|
|
woofbag Fudo
Registered User
Join date: 3 Aug 2006
Posts: 31
|
08-28-2007 23:31
hm... ok, according to LSLeditor, it should work. but its not requesting permission in SL... EDIT: Ok, this script is totally wrong... first off, I can only activate this while flying. secondly, when I stop flying, it doesn't turn off. It's supposed to activate while flying or not, and turn the animation on when flying and off when not flying. this is so confusing x_x
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
08-28-2007 23:48
In order for your script to properly turn the animations on and off you will need to periodically poll the agent info for the current animation / state using the timer event.
Though I would suggest getting one of the many Animation Override scripts and add your animation to its configuration.
|
|
woofbag Fudo
Registered User
Join date: 3 Aug 2006
Posts: 31
|
08-29-2007 00:11
this is all very confusing @_@. I got the AO here /54/ff/52524/1.html but I have absolutely no idea how to use it...
|
|
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
|
08-29-2007 00:27
integer was_flying; default { on_rez(integer param) { llResetScript(); } state_entry() { if(llGetAttached()) { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } } run_time_permissions(integer perm) { was_flying = llGetAgentInfo(llGetOwner()) & AGENT_FLYING; if(was_flying) { llStartAnimation("Jetpack Controls Anim 5"  ; } else { llStopAnimation("Jetpack Controls Anim 5"  ; } state active; } } state active { on_rez(integer param) { llResetScript(); } state_entry() { llSetTimerEvent(0.5); } timer() { integer now_flying = llGetAgentInfo(llGetOwner()) & AGENT_FLYING; if(was_flying) { if(!now_flying) { llStopAnimation("Jetpack Controls Anim 5"  ; was_flying = now_flying; } } else { if(now_flying) { llStartAnimation("Jetpack Controls Anim 5"  ; was_flying = now_flying; } } } }
|
|
woofbag Fudo
Registered User
Join date: 3 Aug 2006
Posts: 31
|
08-29-2007 00:36
Dude you're a life saver, thanks a billion!!
|
|
Darko Lednev
Registered User
Join date: 20 Aug 2007
Posts: 31
|
08-29-2007 00:46
Here is another one: string currAnim = "Sit"; default { state_entry() { llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { llSetTimerEvent(3.0); } else { llOwnerSay("I'm sory, I need the permissions."  ; llSleep(3.0); llResetScript(); } } timer() { integer info = llGetAgentInfo(llGetOwner()); if (info & AGENT_FLYING) { llStopAnimation(currAnim); string newAnim = llGetInventoryName(INVENTORY_ANIMATION,0); llStartAnimation(newAnim); currAnim = newAnim; } else { llStopAnimation(currAnim); } } }
|