thomas747400 Posted September 22, 2016 Report Posted September 22, 2016 Hi all. I am trying to create a lua event handler which is triggered whenever a FSUIPC offset reaches a certain value (rather than polling the offset). The event shall trigger if my aircraft passes 10'000ft. Reading through the FSUIPC "Lua Library" document I noted the "event.offsetmask" handler... would this do the trick? I have researched the topic of masking but the penny hasn't dropped and I would appreciate some guidance, perhaps a small example to solve the above... event.offsetmask (0x3324, ????, UD, "myfunction") Thanks in advance Thomas
Pete Dowson Posted September 24, 2016 Report Posted September 24, 2016 On 9/22/2016 at 3:27 PM, thomas747400 said: The event shall trigger if my aircraft passes 10'000ft. Reading through the FSUIPC "Lua Library" document I noted the "event.offsetmask" handler... would this do the trick? Not really. Masks are binary patterns of bits, designed to allow you to test for specific bit changes in a bit-oriented value, of which there are plenty (usually indicating conditions or switch settings). The number 10,000 in decimal is Hex 0x2710, so you can't even get close with a mask of x2000, which would trigger at 8192. Really it is easiest just to take all numbers and look out for 10000 or the first value you see above. If you really thought that might be detrimental to performance, use a Timer event instead, maybe for 100 mSecs, and read the offset on that to check. Pete
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now