• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Water Rudder mod XML

  • Thread starter Deleted member 1281
  • Start date
D

Deleted member 1281

Guest
Hi! I want to use the water rudder command (Ctrl-W) to do other things. The default def in modeldef.xml is this:

Code:
<PartInfo>
        <Name>lever_water_rudder</Name>
        <AnimLength>100</AnimLength>
        <Animation>
                <Parameter>
                    <Sim>
                        <Variable>WATER RUDDER HANDLE POSITION</Variable>
                        <Units>percent</Units>
                    </Sim>
                    <Lag>100</Lag>
                </Parameter>
        </Animation>
        <MouseRect>
                <Cursor>Hand</Cursor>
                <HelpID>HELPID_GAUGE_WATER_RUDDER_LEVER</HelpID>
                <TooltipID>TOOLTIPTEXT_WATER_RUDDER_HANDLE</TooltipID>
                <EventID>TOGGLE_WATER_RUDDER</EventID>
        </MouseRect>
</PartInfo>

Now instead of EventId ... /EventId I would like to use (as I understand one has to)

<CallbackCode>
(&gt;K:TOGGLE_WATER_RUDDER)
... plus the desired custom suite of key events
</CallbackCode>

But already the single toggle doesn't seem to work -??

Any pointers greatly appreciated!
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
You need to write the script with a "mouse event" sequence, and add a <MouseFlags> section:


Code:
<MouseFlags>LeftSingle</MouseFlags>
<CallbackCode>
    (M:Event) 'LeftSingle' scmp 0 == if{ (&gt;K:TOGGLE_WATER_RUDDER) }
    (* more action stuff here *) 
</CallbackCode>
 

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
His setup can work it is just missing the MouseFlags section.
 
D

Deleted member 1281

Guest
Many thanks, this certainly points me in the right direction. However, I still have a problem with executing several events. Here is what I have in the Callbackcode section now (this is the beginning of a Prop Reversing routine) :

Code:
    <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 == if{
          (&gt;K:TOGGLE_WATER_RUDDER)
          (L:Reversing,bool) ! (&gt;L:Reversing,bool)
          (L:Reversing,bool) if{
            491 (&gt;K:THROTTLE_SET)
            -491 (&gt;K:PROP_PITCH_SET)
          } els{
            (&gt;K:PROP_PITCH_LO)
          }
        }
    </CallbackCode>

The water rudder control object now moves as designed, so (&gt;K:TOGGLE_WATER_RUDDER) is executed correctly. Anything after that, however, not even the L variable assignment is perfomed. Even if (&gt;K:TOGGLE_WATER_RUDDER) is followed by (&gt;K:TOGGLE_ALL_LIGHTS) no lights are turned on or off.

Bill, you have your (* more action stuff here *) outside the closing "if" curly, but it doesn't make any difference when I put any subsequent commands there.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Well, it really depends on what you want as a 'trigger' for the (* more action stuff *). Your choices are manifold, most of the following can produce separate results:

LeftSingle
LeftDouble
LeftRelease
LeftDrag


RightSingle
RightDouble
RightRelease
RightDrag


MiddleSingle
MiddleDouble
MiddleRelease
MiddleDrag


WheelUp
WheelDown
Move
Leave


LeftAll
RightAll

MiddleAll
 
Messages
1,052
Country
australia
What happens if you put the TOGGLE_WATER_RUDDER last instead of first?

Code:
<CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 == if{
          (L:Reversing,bool) ! (&gt;L:Reversing,bool)
          (L:Reversing,bool) if{
            491 (&gt;K:THROTTLE_SET)
            -491 (&gt;K:PROP_PITCH_SET)
          } els{
            (&gt;K:PROP_PITCH_LO)
          }
          (&gt;K:TOGGLE_WATER_RUDDER)
        }
    </CallbackCode>
 
D

Deleted member 1281

Guest
Thanks guys but no luck so far...Have tried this for testing:

Code:
      <MouseFlags>LeftSingle</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 == if{
          (&gt;K:ALL_LIGHTS_TOGGLE)
          (&gt;K:TOGGLE_TAIL_HOOK_HANDLE)
          -491 (&gt;K:PROP_PITCH_SET)
          (&gt;K:TOGGLE_WATER_RUDDER)  <!-- only this command is executed!? -->
        }
      </CallbackCode>

Likewise this:

Code:
       <MouseFlags>LeftSingle+RightSingle+LeftDouble+RightDouble</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 == if{ (&gt;K:ALL_LIGHTS_TOGGLE) }
        (M:Event) 'RightSingle' scmp 0 == if{ (&gt;K:TOGGLE_TAIL_HOOK_HANDLE) }
        (M:Event) 'LeftDouble' scmp 0 == if{ -491 (&gt;K:PROP_PITCH_SET) }
        (M:Event) 'RightDouble' scmp 0 == if{ (&gt;K:TOGGLE_WATER_RUDDER) }
      </CallbackCode>

In both cases only the water rudder toggle is executed.

The whole animation section looks like as follows, perhaps there is some error in the further context? It would be super cool if prop reverse could be assigned to a keypress!

Code:
<Animation name="reverse_lever_water_rudder"  guid="2ddc2ea6-2e71-43bb-b248-0eab72ddbbcc"     length="100" type="Sim" typeParam2="reverse_lever_water_rudder" typeParam="AutoPlay" />

<PartInfo>
  <Name>reverse_lever_water_rudder</Name>
  <AnimLength>100</AnimLength>
  <Animation>
    <Parameter>
      <Sim>
        <Variable>WATER RUDDER HANDLE POSITION</Variable>
        <Units>percent</Units>
      </Sim>
      <Lag>100</Lag>
    </Parameter>
   </Animation>
   <MouseRect>
      <Cursor>Hand</Cursor>
      <HelpID>HELPID_GAUGE_WATER_RUDDER_LEVER</HelpID>
      <TooltipID>TOOLTIPTEXT_WATER_RUDDER_HANDLE</TooltipID>
      <MouseFlags>LeftSingle+RightSingle+LeftDouble+RightDouble</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 == if{ (&gt;K:ALL_LIGHTS_TOGGLE) }
        (M:Event) 'RightSingle' scmp 0 == if{ (&gt;K:TOGGLE_TAIL_HOOK_HANDLE) }
        (M:Event) 'LeftDouble' scmp 0 == if{ -491 (&gt;K:PROP_PITCH_SET) }
        (M:Event) 'RightDouble' scmp 0 == if{ (&gt;K:TOGGLE_WATER_RUDDER) }
      </CallbackCode>
   </MouseRect>
</PartInfo>
 
Messages
1,564
Country
thailand
I don't think this necessarily has to be associated with a Mouse section, Mouse event, or 3D cockpit. If I understand, you want a keyboard assignment to do something for you in addition to running its prescribed K:Event. You could also play around with this approach to see if it leads anywhere:

Find an acceptable Event (Water rudder may not function for all planes AFAIK*) and locate the associated A:Variable that describes the status of the system that the Event controls.

Assign a keyboard shortcut to the Event if it doesn't already exist. When the keyboard shortcut is entered, the Event (K:MyEvent) will occur.

In an <Update> section, do something like:
Code:
(A:Variable, bool) 1 ==
  if{
    Your Prop Reverse script
    (>K:MyEvent) whatever is needed to change Event status back to the original state.  Would be ideal if the K:Event is a Toggle ...
  }

where K:MyEvent is the Event you select, and (A:Variable, bool) is whatever A:Var and unit combination is associated with that Event. In this hypothetical example, A:Variable is a bool that changes to 1 when K:MyEvent is performed.

Hope it helps.

Bob

*At least, I could not get water rudder A:Vars, eg, (A:WATER RUDDER HANDLE POSITION, percent over 100) to change when keying Ctrl + W in any aircraft other than a floatplane like the Beaver . Could be that this is the root of your difficulty?? Maybe ... not sure.

For grins, you could try PITOT_HEAT_TOGGLE (Shift + H) or AP_MASTER (Z) rather than Water Rudder.

[edit] While this might work occasionally, based on Roy's comments below, I agree the better approach is to 'assign a control action to TOGGLE WATER RUDDER and use it to do anything else you wish if you have written appropriate event capture code' however that is done, which is the topic of this thread ...
 
Last edited:

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
Water rudder is one of the contact point Class entries.
0=none
1=Wheel
2=Scrape
3=Skid
4=Float
5=Water Rudder
The DH Beaver has two class 5 contact points, one at the rear of each float.
In general, unless the aircraft has a water rudder, no control will be assigned to TOGGLE WATER RUDDER, hence WATER RUDDER HANDLE POSITION, will not change.
However you can assign a control action to TOGGLE WATER RUDDER and use it to do anything else you wish if you have written appropriate
event capture code.
Roy
 
D

Deleted member 1281

Guest
Yes, that's about the size of it, I want to hijack the water rudder keyboard assignment (Ctrl-W) to do a custom radial engine prop reversing. The reversing script is already working when clicking a gauge. But I want this on Ctrl-W, first, and then naturally to reassign it to a joystick button. The idea is, you land your heavy four-engined beast, hit the joystick button and get immediate reversing (braking) action.

To recap what I have. I have declared a contact point class 5. The custom object that I constructed for testing (a cube rotating 45 degrees) goes through its animation when Ctrl-W is hit, and goes back to zero rotation when Ctrl-W is hit again. The problem at present is I cannot make Ctrl-W to execute anything apart from this animation - something I need to do, however, if prop reverse is to work.

The A: vars associated with water rudder all show 0 throughout whatever the state of my pseudo water rudder object, as predicted by Bob and Roy, above. Edit, WATER RUDDER HANDLE POSITION with unit "percent over 100" shows 100 throughout.

As for the suggestion sketched by Roy ..
However you can assign a control action to TOGGLE WATER RUDDER and use it to do anything else you wish if you have written appropriate
event capture code.

Can you spell this out a bit? I am at wit's end in this area. How does one assign a control action? What does "appropriate event capture code" look like and where does it go?
 
Last edited by a moderator:

taguilo

Resource contributor
Messages
1,585
Country
argentina
Yes, that's about the size of it, I want to hijack the water rudder keyboard assignment (Ctrl-W) to do a custom radial engine prop reversing. The reversing script is already working when clicking a gauge. But I want this on Ctrl-W, first, and then naturally to reassign it to a joystick button. The idea is, you land your heavy four-engined beast, hit the joystick button and get immediate reversing (braking) action.

Then forget all about that <CallbackCode> and other stuff you posted from a modeldef file, and also the contact point class 5 (get rid of everything), and instead put a gauge in main [VCockpit] section of the panel containing something like:

Code:
<Keys>
  <On Event="TOGGLE_WATER_RUDDER">
      (L:Reversing,bool) ! (&gt;L:Reversing,bool)
      (L:Reversing,bool)
      if{
           491 (&gt;K:THROTTLE_SET)
          -491 (&gt;K:pROP_PITCH_SET)
         }
      els{
            (&gt;K:pROP_PITCH_LO)
           }
  </On>  
</Keys>

Then, any time you hit CTRL+W prop reversing will happen, because FS events are always executed no matter they don't give a proper action for the current aircraft.

The problem with capturing keyboard commands from XML gauges is that they only work in VC/2D views, so if you are in External view and execute CTRL+W, nothing will happen. Possible solutions are:

-Use a C++ event handler (gauge), these work fine in any view mode.
-Wait a bit for a new module I'll be releasing soon, that will enable XML event captures in any view mode, among other enhancements:)

Tom
 

ddawson

Resource contributor
Messages
862
Country
canada
Have you looked at TOGGLE_RAD_INS_SWITCH and the related variable RAD_INS_SWITCH? I just checked P3D and they're still active, even though the Concorde only appeared in FS2000.
That would give you a testable on/off condition.

Edit: perhaps not as valuable as I thought. In FSX you can't assign it to a game controller without manually editing the config file...

Doug
 
Messages
1,564
Country
thailand
How does one assign a control action? What does "appropriate event capture code" look like and where does it go?

I'm learning some things in this thread too. Tom answered the latter question. Assigning a control action would be in reference to the (FSX) drop-down menu Options-Settings-Controls-Buttons/Keys.
 
Messages
440
Country
us-wisconsin
Tom
I've gotten away with this. It always loads my keytraps, regardless of view, if the pilot finds it and closes it.. Well, shouldn't have touched that menu/selection without knowing. Doug's gauge will load this if not loaded via previous flight as a window.
Code:
[WindowXX]
Background_color=0,0,0
size_mm=10,10
window_size_ratio=1.000
position=0
visible=1 // <-- Special
ident=12345
sizeable=0
nomenu=1 // <-- Special
type=Special // <-- Special
gauge00=SHRS_F111!KEYTRAP, 0,0,10,10 //< -- <Keys><On Event> etc.....
I hate too many windows, being 2D or VC. This is a good work around with it's own negativities.
 
Last edited:
Messages
440
Country
us-wisconsin
Doug,
Isn't ironic that the INS still works but yet the Nose Visor doesn't? Oh the memories of FS02 and it's ....
 
Messages
1,564
Country
thailand
Hmmm ... this is one of those Pandora's Box threads. Definitions and information about Key and Events and Traps seem widely scattered in various forums posts, so maybe it's time for a Wiki entry on Event Traps. The wiki, "Refreshing Panels in FS9" has some relevant links, but a stand-alone wiki topic might be useful.

Which I would be happy to write except for the fact that I can see that I don't understand them well enough. So, can someone help me out by offering succinct definitions of "Key", "Event", and "Trap" as they are used in the context of this topic, and I will start from there.

ขอขอบคุณสำหรับความช่วยเหลือ

Bob
 
Messages
1,564
Country
thailand
Doug,
Isn't ironic that the INS still works but yet the Nose Visor doesn't? Oh the memories of FS02 and it's ....

You've been at this a while, Roman. First, reference to FS02, then sneaking in a panel.cfg property that shows up only in the obscure FS9 Panels SDK ...
 
Messages
440
Country
us-wisconsin
Bob,
Good morning. Still trying to write the response to Manfred's post. Little parts, here & there. I call it a "trap" when FS gets control of the keyboard in a users context or via a standard command. In the standard FSX(9) context one could get control of the users keyboard as does the GPS does in certain menus of the GPS itself. Or - one could trap an event. In the following it is the (&gt;K:XPNDR) or in C the XPNDR command or via keyboard "T". That particular command does nothing more than select the digit in which the user can +/- the selected transponder digit. I use that event as a trigger, irregardless of the transponder. After the trigger and the relevant code, the trigger itself get's negated. The XPNDR command is key to our project as it is easy to assign.

Code:
<Gauge Name="SHRS KEYTRAP" Version="1.0">
  <Image Name="BLANK.bmp"/>
  <Macro Name="SMK_OFF">(L:SMK@1, bool) if{ @1 (&gt;K:SMOKE_OFF) 0 (>L:SMK@1, bool) }</Macro>
  <Macro Name="SMK_CTRL">if{ (L:SMK@1, bool) ! if{ @1 (&gt;K:SMOKE_ON) 1 (>L:SMK@1, bool) } } els{ (L:SMK@1, bool) if{ @1 (&gt;K:SMOKE_OFF) 0 (>L:SMK@1, bool) } } (L:SMK@1, bool) (A:SMOKE ENABLE, bool) and if{ 0 (>L:SMK@1, bool) }</Macro>

  <Keys>

    <On Event="AP_MASTER">(A:AUTOPILOT MASTER, bool) if{ 1 (>L:AP_PITCH_MAIN, bool) 1 (>L:AP_ROLL_MAIN, bool) } els{ 0 (>L:AP_PITCH_MAIN, bool) 0 (>L:AP_ROLL_MAIN, bool) }</On>

    <!--(A:SIM ON GROUND, bool) ! if{ 0 (>L:AP_TF_ACTIVE, bool) }-->

    <On Event="XPNDR">
      (L:AP_REF_WARN_R, bool) ! (L:AP_REF_WARN_P, bool) ! and if{ 0 (&gt;L:master caution,bool) }
      0 (>L:AP_REF_WARN_P, bool) 0 (>L:AP_REF_WARN_R, bool)
      (L:RadarValid, bool) ! (L:AP_TF_ACTIVE, bool) and if{ 1 (>L:AP_REF_WARN_P, number) }
    </On>

    <On Event="ENGINE_AUTO_START">(A:ELECTRICAL MASTER BATTERY, bool) ! if{ (&gt;K:TOGGLE_MASTER_BATTERY) } (A:BRAKE PARKING POSITION, percent) 50 &gt; (A:SIM ON GROUND, bool) (L:Battery, bool) ! and and if{ 1 (>L:BatteryCharger, bool) 0 (>L:Battery, bool) } els{ 1 (>L:Battery, bool) 0 (>L:BatteryCharger, bool) }</On>

    <On Event="SMOKE_TOGGLE">
      (A:SMOKE ENABLE, bool) if{
      1 (>L:SMK33, bool) @SMK_OFF(33)
      1 (>L:SMK34, bool) @SMK_OFF(34)
      1 (>L:SMK9, bool) @SMK_OFF(9)
      1 (>L:SMK10, bool) @SMK_OFF(10)
      1 (>L:SMK11, bool) @SMK_OFF(11)
      1 (>L:SMK12, bool) @SMK_OFF(12)
      1 (>L:SMK13, bool) @SMK_OFF(13)
      1 (>L:SMK14, bool) @SMK_OFF(14)
     
<!-- ETC THRU SMK84 as needed -->

      (A:SIM ON GROUND, bool) ! if{ (L:Fuel_Dump, bool) ! (&gt;L:Fuel_Dump, bool) } }
    </On>

    <On Event="BRAKES">(A:SIM ON GROUND, bool) ! (A:Gear left position,percent) 4 &lt; (A:Gear right position,percent) 4 &lt; and and if{ (L:Flares_mode, number) 0 == (L:ViewSystemStatus, number) 0 == and if{ 5 (>L:Flares_mode, number) } els{ 0 (>L:Flares_mode, number) } }</On>


    <On Event="ALL_LIGHTS_TOGGLE">
      (L:Beacon, bool) ! (>L:Beacon, bool) 0 (>L:TACTICAL_POWER, bool) (L:FLOOD_POWER, bool) ! (>L:FLOOD_POWER, bool)
      (L:NAV_LT_MAIN, bool) ! (>L:NAV_LT_MAIN, bool) 1 (>L:NAV_LT_FLASH, bool) (>K:LANDING_LIGHTS_OFF) (L:ViewSystemStatus, number) 0 == if{ 3 (>L:LightsToggled, number) }
    </On>

    <On Event="PANEL_LIGHTS_TOGGLE">(L:TACTICAL_POWER, bool) ! (>L:TACTICAL_POWER, bool)  (L:ViewSystemStatus, number) 0 == if{ 1 (>L:LightsToggled, bool) }</On>

    <On Event="TOGGLE_WATER_RUDDER">(L:ViewSystemStatus, number) 0 != if{ 1 (>L:Sound_Hyd1, number) }</On>

    <On Event="SPOILERS_TOGGLE">(L:ViewSystemStatus, number) 0 != if{ 1 (>L:Sound_Hyd2, number) }</On>

    <On Event="TOGGLE_TAIL_HOOK_HANDLE">(L:ViewSystemStatus, number) 0 != if{ 1 (>L:Sound_Hyd3, number) }</On>

    <On Event="TOGGLE_STARTER1">(L:ViewSystemStatus, number) 0 != if{ 1 (>L:Sound_Click,number) }</On>
    <On Event="TOGGLE_ALTERNATOR1">(L:ViewSystemStatus, number) 0 != if{ 1 (>L:Sound_Click,number) }</On>
    <On Event="TOGGLE_STARTER2">(L:ViewSystemStatus, number) 0 != if{ 1 (>L:Sound_Click,number) }</On>
    <On Event="TOGGLE_ALTERNATOR2">(L:ViewSystemStatus, number) 0 != if{ 1 (>L:Sound_Click,number) }</On>

    <On Event="TOGGLE_WING_FOLD">(L:ViewSystemStatus, number) 0 != if{ 1 (>L:Sound_Hyd3, number) }</On>

  </Keys>

Darnit!! Still have to respond to the OP!
 
D

Deleted member 1281

Guest
OKAY now!! Many thanks for all of your insights and snippets of code. Tom, I can report that your solution works just as you said it would, and it is a treat no longer having to hunt for an elusive mouse spot when your eyes should be focused on the runway. Yes, it works only from the VC, so looking very much forward to your
new module I'll be releasing soon, that will enable XML event captures in any view mode, among other enhancements:)Tom
Through no particular merit of mine this reversing routine -- which is based on some published cfg settings -- responds nicely to throttle (more throttle more braking action) and allows curved reverses into parking lots, tight taxiways etc, which I had always assumed wasn't possible.

Here is a screenie of my WIP Stratotanker coming to a comfortable halt on Launceston's fairly short runway.

screen-05-28.jpg


Thanks again everybody, and further comments most welcome! I will study the other suggestions as well even though I must admit the C++ route is beyond me, unless you can point me to a practical FSX related tutorial for absolute dummies.
 
Last edited by a moderator:
Messages
1,564
Country
thailand
Question - Is it possible to change the assignment of Water rudder to add a joystick button? If that isn't possible, building on what Roman said, above, then can you associate your prop reverse script with the Transponder Event ("XPNDR") instead of "TOGGLE_WATER_RUDDER"? This might be useful because I suspect it is possible to assign Transponder to a joystick button (drop-down menu Options-Settings-Controls-Buttons/Keys), thus enabling your prop reverse script to be triggered via joystick button associated with Transponder. What sort of views this does or does not work in ... beats me, but might be worth a try.

As Roman advises, Transponder is a pretty benign Event ... it just sequentially highlights transponder digits but does not change anything.

Bob
 
Top