Jump to content
Sign in to follow this  
byork

Event Handler, but the Key Evnet has a Parameter

Recommended Posts

Anyone have any ideas into this one:This works:void FSAPI EventHandler (ID32 event, UINT32 evdata, PVOID userdata) { if (event == KEY_ROTOR_BRAKE) { speed_bug_right++; }}Here I am capturing when Rotor Brake has been fired.What happens is that any time the key rotor brake event is fired in simulation, the speed bug variable increments by one.This code works fine.However...I want to be able to capture this:if (event == KEY_ROTOR_BRAKE, 3939)Note the extra parameter, 3939.So basically I'm trying to capture this event when it happens:trigger_key_event (KEY_ROTOR_BRAKE, 3939);But it doesn't work. The extra parameter messes things up somehow. It results in speed_bug_right var increasing all by itself for some reason, 18 times a second, even though no ROTOR BRAKE is not firing at all.Any ideas?

Share this post


Link to post
Share on other sites
IIRC neither userdata or evdata ever worked.-Dai
I should engage my brain before writing in this forum :( Actually, I got it to work, like this:if ( (event == KEY_ROTOR_BRAKE) && (evdata == 26801) )This will read parameter associated with the Rotor Brake.So whenever that event is fired, you can do something.

Share this post


Link to post
Share on other sites

Interesting... (pokes old code and finds memo from Arne)... yes, evdata always did work (apologies for FIM) but neither I nor Arne could get userdata to work. Has anyone else succeeded?-Dai

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...