|
Tad Giugiaro
Registered User
Join date: 27 Oct 2005
Posts: 3
|
10-27-2005 19:33
im having trouble figuring out why my llSetTimerEvent is firing prior to the llMessageLinked calls inside the for each. i have 2+ prims, this code is in the root prim, basically i want to step through each prim and set the new FULLBRIGHT on using the bright command below and off using dim (since fullbright apparently does not have a setlink type of function i am attempting it this way by sending message to each prim and tell it to turn itself on or off) im still new so plz be easy on me...  chaseLights() { llMessageLinked(LINK_SET, 0, "dim", ""); for (iNumLoop = 1; iNumLoop <= iNumPrims; iNumLoop++) { llMessageLinked(iNumLoop, 0, "bright", ""); llSleep(fChaseSleep); llMessageLinked(iNumLoop, 0, "dim", ""); } llSetTimerEvent(fSleep); }
the only thing in the child prims is a script with link message event handler that does the set primitives for the FULL BRIGHT option (on or off). any help is appreciated. if you couldn't figure it out by the function name, im basically trying to have a string of lights that chase each other to the end then start at the beginning again. the timer event calls this function ****EDIT*** sorry, forgot to mention, the llSetTimerEvent doesn't actually set the timer event or maybe it does but because the other stuff inside the for loop isn't done yet it somehow erases it? and doesn't fire the timer event *********** - Tad
|
|
Stylez Gomez
Union Micro
Join date: 4 Jun 2004
Posts: 146
|
10-27-2005 19:54
It's my understanding that you can only set timer events inside of states, since that's where they persist. I'm not sure how your code is structured, but try calling the llSetTimerEvent after you call the chaseLights() function. I'm not 100% sure of this, since I've NEVER tried to call an llSetTimerEvent from within a function. 
|
|
Tad Giugiaro
Registered User
Join date: 27 Oct 2005
Posts: 3
|
10-27-2005 20:01
ya, it works, just so everyone knows, this same structure works if i just use a setlink function like llSetLinkColor instead of the llMessageLinked functions. i think it might have something to do with the setprimparam function that sleeps for .2 seconds but i figured it would wait for it to complete instead of moving further down code in the root prim.
|
|
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
|
10-28-2005 02:05
You can set up a timer event (that's llSetTimerEvent()) anywhere, including in function, because the function when it executes that line of code is part of a state.
You can't put timer() or any other event into a function though.
Without the rest of your code it's not clear what's happening. But llSetTimerEvent(x) will trigger an event call every x seconds, and will try to execute it then and there. You can turn it off with llSetTimerEvent(0.0) but other than that if you've set it once it will keep firing until you change it.
That can mess up such timing event. I'm not sure why you're using one though, if you want it to propogate through the object you don't need to code for the delay, that will happen anyway.
|
|
Hinkley Baldwin
Registered User
Join date: 13 May 2004
Posts: 77
|
10-28-2005 02:15
Try changing LINK_SET to LINK_ALL_OTHERS. In your code you're also messaging yourself so if you've got a link_message() event in this prim it will get executed when you issue the llMessageLinked() which could be the problem.
|
|
Tad Giugiaro
Registered User
Join date: 27 Oct 2005
Posts: 3
|
10-28-2005 14:40
omg, ty Hinkley and everyone else... got it to work
i did in fact have a link_message() event in the same script, it still confuses me as to why it executed those commands in the order i was seeing...
oh well, i understand how t his could have messed things up though, however to me my code in the function should have halted until it returned from that link_message event, but i guess my logic has failed once again... rofl
|