Gah, I just got stuck on a bug for about an hour. Looked everywhere until by fluke I found out what I'd done and then it was obvious how I'd cocked up.
Consider this:
So basically I want anim to be set if either anim function returns true because and animation is occuring.
Here's the dumbass problem: due to incomplete boolean evaluation (meaning as soon as the test is satisfied, the rest of the clauses are ignore) if AnimFunction1 returns true, anim=1 and therefore the second line goes "OK anim=1 so I don't even need to look at the part after the OR" and so AnimFunction2 never gets called! This is no good if both functions are supposed to run EVERY frame.
Anyway fixed it with:
Simple, unless later on Mark decides to optimise Blitz by saying, hmm the second part of the OR is only a variable test, thus is quicker to check than the function so I'll do that first. That would break my code and lots of others I expect...so it's very unlikely :-) phew.
Doh!
Consider this:
Local Anim=AnimFunction1() Anim = Anim or AnimFunction2()
So basically I want anim to be set if either anim function returns true because and animation is occuring.
Here's the dumbass problem: due to incomplete boolean evaluation (meaning as soon as the test is satisfied, the rest of the clauses are ignore) if AnimFunction1 returns true, anim=1 and therefore the second line goes "OK anim=1 so I don't even need to look at the part after the OR" and so AnimFunction2 never gets called! This is no good if both functions are supposed to run EVERY frame.
Anyway fixed it with:
Anim = AnimFunction2() or Anim
Simple, unless later on Mark decides to optimise Blitz by saying, hmm the second part of the OR is only a variable test, thus is quicker to check than the function so I'll do that first. That would break my code and lots of others I expect...so it's very unlikely :-) phew.
Doh!