1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Custom events again....

Discussion in 'Gauges' started by Naruto-kun, 17/3/12.

  1. taguilo

    taguilo Resource contributor

    Joined:
    20/10/06
    Messages:
    887
    Country:
    argentina
    Ed,
    10,100...1000...up to trigger_key_event(iEvent,iValue) is the same code, no extra lines needed. The only part that could become "heavy" is this one:

    Code:
    const int AC_SWITCH  = 70000;
    
    void FSAPI EventHandler(ID32 event, UINT32 evdata, PVOID userdata)
    {
         switch(event)
        {
             case AC_SWITCH:
    etc
    but that would be the same when using this method and by <EventID> as well.
    In any case, the bad idea would be so many switches,lights and knobs and not the code to handle them;)

    Tom
  2. WarpD

    WarpD

    Joined:
    9/12/07
    Messages:
    398
    Country:
    us-ohio
    Correct me if I'm wrong... but don't Lvars get 'broadcast' during multiplayer mode?
  3. sparouty

    sparouty

    Joined:
    17/5/08
    Messages:
    16
    Country:
    france
    Hi,
    For what I had tested during my Etendard project, L:vars are not shared between multiplayers but L:vars are shared between shared cockpit players...

    Times ago, there was a thread speaking about gauge flooding, and many interesting things were said about that... I didn't find out the link...

    I found also this thread that says that Custom Event can be fired with an (>K:XXXXX) call:
    [FSXA] Custom EventIDs - Questions!

    I didn't have time to try it but I will soon...
    Regards,

    Sylvain
  4. taguilo

    taguilo Resource contributor

    Joined:
    20/10/06
    Messages:
    887
    Country:
    argentina
    Yes, that's what the SDK says (and I know of your devotion to the SDK :) )
    However, in a C++ gaugeset scenario, only those LVars used within the model would be broadcasted and hypotetically received by nobody, so I can't see a big tradeoff here.


    Unfortunately the evaluations and conclutions in that thread were wrong. See post #15 here where I explain the reasons why it can't work.

    Tom
  5. Naruto-kun

    Naruto-kun

    Joined:
    24/6/10
    Messages:
    532
    Country:
    southafrica
    And with 100+ switches....Thats why we need a alternative to using L vars for Right/Left clicks.
  6. Naruto-kun

    Naruto-kun

    Joined:
    24/6/10
    Messages:
    532
    Country:
    southafrica
    There is one other option....use unused FSX key events like the G1000 or the GPS key events to trigger custom events.
  7. sparouty

    sparouty

    Joined:
    17/5/08
    Messages:
    16
    Country:
    france
    Hi,
    I agree with you it's very frustrating to not being able to use (>K:xxxxx) call with custom event.
    But I don't understand why you want left/right click for switch? Most of switch are 2 positions switch for which a single click is needed : a toggle behaviour...so custom event can be easily used.

    Last I never noticed any issue with the use of Lvars in a vc whatever the mode used (single, mp, or sc): most of the Etendard vc animations are based on Lvars without any significant loss of fps... To my own point of view, Lvars are shared only in shared cockpit..
    R.
    Sylvain
  8. Naruto-kun

    Naruto-kun

    Joined:
    24/6/10
    Messages:
    532
    Country:
    southafrica
    We are talking about knobs and multi position switches here. Thats where the left/right click comes in. And having too many L vars will clog up a shared pit. Thats what we are attempting to prevent here....

    Update:

    I just thought of a another option. If you are using L vars for the animation of the knob/switch maybe one can send a value outside of the animation range and have it get reset by the key event in the gauge. Unless it makes the knob jump around that is....
    Last edited: 22/3/12
  9. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,058
    Country:
    unitedstates
    Neither event_handler or the L:vars need be monitored all the time. The only time they would need to be evaluated is when a mouse event of some kind was triggered.

    IOW, every mouse action would set a triggered flag, the evaluation would run, custom key_event sent, L:var updated and finally the triggered flag reset.

    -OR-

    Alternatively, how about multiplexing a couple of unused SET type tokens and their associated variables?
    Last edited: 22/3/12
  10. n4gix

    n4gix Resource contributor

    Joined:
    26/9/06
    Messages:
    9,058
    Country:
    unitedstates
    This is a very, very old thread, but somehow the method that actually works was never posted.

    What Jon and I found is that by setting up one custom L:var we can easily use any form of mouse clicking and wheel rotations to send custom EventId hex numbers:

    0x10001 (>L:Event,enum)

    The event handler in the C gauge will monitor (L:Event,enum), then retrieve the value before resetting via 0 (>L:Event,enum).

Share This Page