Jump to content

Archived

This topic is now archived and is closed to further replies.

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

  • 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.
  • Donation Goals

    AVSIM's 2020 Fundraising Goal

    Donate to our annual general fundraising goal. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.


    34%
    $8,560.00 of $25,000.00 Donate Now
×
×
  • Create New...