Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
|
11-04-2005 19:37
So I grabbed Cross Lament's useful code and stuck a rotation into it. The script detects av flight, then begins (theoretically) to rotate the attachment holding the script.
// Agent Flying Detection // // Place this script in any prim on the object, preferrably one that doesn't change between flying and not // // Cross Lament's messy code follows.
integer isFlying = FALSE ;
default { state_entry() { llSetTimerEvent( 2 ) ; // Polling rate, check every couple of seconds } timer() { integer flystatus = llGetAgentInfo( llGetOwner() ) ; // if the agent is flying, and the status holder says they're not... if( ( flystatus & AGENT_FLYING ) && !isFlying ) { isFlying = TRUE ; llTargetOmega(<0,-20,0>,1,1); llMessageLinked( LINK_ALL_OTHERS, 1, "", NULL_KEY ) ; // Hell yeah, tell everyone! } // if the agent is NOT flying, and the status holder says they are... else if( !( flystatus & AGENT_FLYING ) && isFlying ) { isFlying = FALSE ; llTargetOmega(<0,0,0>,1,1); llMessageLinked( LINK_ALL_OTHERS, 0, "", NULL_KEY ) ; // Nope, I'm not. } } }
But it doesn't work beyond the first time after recompile. If you cross a sim border, it works one more time. I dunno. What am I missing?
|
Huns Valen
Don't PM me here.
Join date: 3 May 2003
Posts: 2,749
|
11-04-2005 21:36
The last time I played with llTargetOmega(), it only updated once. That is a very old bug. You had to go out of the area and return to see a change in it. Maybe you are seeing the same thing. Put some debug code into your functions that say "Turning on" and "Turning off" to make sure your basic logic is OK.
|
Logan Bauer
Inept Adept
Join date: 13 Jun 2004
Posts: 2,237
|
11-05-2005 11:01
From: Huns Valen The last time I played with llTargetOmega(), it only updated once. That is a very old bug. You had to go out of the area and return to see a change in it. Maybe you are seeing the same thing. Put some debug code into your functions that say "Turning on" and "Turning off" to make sure your basic logic is OK. I just tested Kage's code and the logic does seem right to me, I even took a similar script I had and modified it to try to get the same results... With both scripts I had the following results : If you don't have it attached, it works fine - fly and it rotates, walk and it doesn't... However, as soon as you DO attach it, back to square one, llTargetOmega doesn't update... 
|
Sol Columbia
Ding! Level up
Join date: 24 Sep 2005
Posts: 91
|
11-07-2005 10:10
Would this work?
integer flystatus= FALSE ;
default { state_entry() { llSetTimerEvent( 2 ) ; // Polling rate, check every couple of seconds }
timer() { flystatus = llGetAgentInfo( llGetOwner() & AGENT_FLYING) ;
if( flystatus ==TRUE ) { llTargetOmega(<0,-20,0>,1,1); llMessageLinked( LINK_ALL_OTHERS, 1, "", NULL_KEY ) ; // Hell yeah, tell everyone! }
else if( flystatus==FALSE) { llTargetOmega(<0,0,0>,1,1); llMessageLinked( LINK_ALL_OTHERS, 0, "", NULL_KEY ) ; // Nope, I'm not. } } }
|
Dyne Talamasca
Noneuclidean Love Polygon
Join date: 9 Oct 2005
Posts: 436
|
11-07-2005 10:18
Yeah, this sounds like the same problem I'm seeing with rotating attachments. If you detach and reattach, it'll update. Beyond that...
|
Kage Seraph
I Dig Giant Mecha
Join date: 3 Nov 2004
Posts: 513
|
11-07-2005 12:04
Drat. 
|