Jump to content
The simFlight Network Forums

View dependent controller button function?


Recommended Posts

Hi,

I have a hat switch on my yoke, which is set up to 'pan' the view in the main FS configuration. When using aricraft from FS9 that have no VC, I have made a gauge in XML (using "on key" statements) to show side view windows, since FSX no longer can do this. They work fine when I change view with the keyboard, but not when I use the hat switch...

If I program the view directions to the individual points of the hat switch with fsuipc, the view switching in the 2D panel is good. However, panning modes (VC view or spot) are then messed up... Is there a way to set button assignments in fsuipc to only work in one view? Or is there another better solution for this problem (that doesn't involve having an actual VC).

I have been advised on the fsdeveloper forum that I could capture the view direction of the hat switch with C++ and Simmconnect, but that is outside of my abilities. I am happy / reasonably competent in XML though.

Thanks,

Geoff

Link to comment
Share on other sites

I have a hat switch on my yoke, which is set up to 'pan' the view in the main FS configuration. When using aricraft from FS9 that have no VC, I have made a gauge in XML (using "on key" statements) to show side view windows, since FSX no longer can do this. They work fine when I change view with the keyboard, but not when I use the hat switch...

If I program the view directions to the individual points of the hat switch with fsuipc, the view switching in the 2D panel is good. However, panning modes (VC view or spot) are then messed up... Is there a way to set button assignments in fsuipc to only work in one view? Or is there another better solution for this problem (that doesn't involve having an actual VC).

 

 

 

Try assigning the hat in FSUIPC4's Axis Assignments to the FS control called "Pan view". That pans in VC mode but selects specific view directions in 2D mode.

 

Pete

Link to comment
Share on other sites

Try assigning the hat in FSUIPC4's Axis Assignments to the FS control called "Pan view". That pans in VC mode but selects specific view directions in 2D mode.

 

Pete

 

Thanks, but no joy there.

Tried assigning all eight positions of the hat to 'Pan View' and set the control to repeat while held. Not panning properly and not selecting any views in the 2D. Am I missing something like a parameter for each of the positions?

Also tried setting each of the hat positions to the various pan directions - now it does pan, but it is not as smooth as the FSX panning, especially in the VC view, where it seems to go in discrete steps (so I guess I did something wrong)? Views /are/ selected in the 2D cockpit, but the key is not sent so the view panels are not toggled, which was the point of the excersise... Any other ideas?

Also, although this could actually be useful, the view does not reset on release of the hat switch.

Cheers,

Geoff

Link to comment
Share on other sites

Thanks, but no joy there.

 

Strange, because it works perfectly here. Maybe I'm misunderstanding what you actually need?

 

Tried assigning all eight positions of the hat to 'Pan View' and set the control to repeat while held.

 

 

Ouch! Why? So you didn't actually try what I suggested, assigning the Hat on Axis Assignments to Pan view (not in Button assignments)?

 

Pete

Link to comment
Share on other sites

Strange, because it works perfectly here. Maybe I'm misunderstanding what you actually need?

 

Ouch! Why? So you didn't actually try what I suggested, assigning the Hat on Axis Assignments to Pan view (not in Button assignments)?

 

Pete

 

Oops! I misread your 1st reply and assumed that I had to set it as a button (or rather, several buttons).

Anyway, setting it as an axis then does exactly the same as FSX would do by default. Is that right?

 

What I was looking for, was a way to send capture the view direction in use in order to use 2D panel views based on the direction - something that was removed by FSX with the clear assumption that nobody would want to fly aircraft without a VC (I disagree with this).

I have a solution that works quite well using some code from a thread on fsdeveloper... On the keyboard, if I press the '9' key on the numberpad, I get the forward right view in the 2D panel and I can 'capture' that event with XML code like this:

<Keys>
		<On Event="VIEW_FORWARD_RIGHT">1 (>L:FrontRightView, number)</On>
</Keys>	

I can then use that variable to close the panel view, and open an appropriate side view. The problem is that this only works with the keyboard view commands. In order to make it work from the hat switch, I would either need to have a way to capture the hat switch command itself (simconnect, C++ and too far from my comfort zone), or find a way to make the hat switch also send the key 'view forward right' etc when selecting that position.

If I only cared about the 2D cockpit view, the solution would be simple: set the eight positions of the hat switch to the appropriate view directions in fsuipc. This works regardless of whether the hat is set to pan in the FSX config. However, that would then mess up panning in the other views, unless I could make that assignment view specific.

The other option, would be some module or other to return the current view direction, but I have not found anything for this. I know there is a gauge from Doug Dawson that will tell me when I'm in the cockpit view or not...

 

Geoff

Link to comment
Share on other sites

Oops! I misread your 1st reply and assumed that I had to set it as a button (or rather, several buttons).

Anyway, setting it as an axis then does exactly the same as FSX would do by default. Is that right?

 

Yes. That was the idea, for those who wanted to disable controllers altogether in FSX.

 

What I was looking for, was a way to send capture the view direction in use in order to use 2D panel views based on the direction - something that was removed by FSX with the clear assumption that nobody would want to fly aircraft without a VC (I disagree with this).

 

 

Hmm. I'm obviously still not understanding. Here "panel view" selects specific views in 2D mode, AND returns to forward when released, whilst still panning in VC mode.  So you have view selection in 2D and panning in VC. As far as I recall (and I know it has been a long time -- I gave up FS9 when fSx came out -- but I certainly had my rocker switches on my yoke programmed to do exactly that.

 

Sorry, but it seems I'm lost.

 

Pete

Link to comment
Share on other sites

Yes. That was the idea, for those who wanted to disable controllers altogether in FSX.

 

 

Hmm. I'm obviously still not understanding. Here "panel view" selects specific views in 2D mode, AND returns to forward when released, whilst still panning in VC mode.  So you have view selection in 2D and panning in VC. As far as I recall (and I know it has been a long time -- I gave up FS9 when fSx came out -- but I certainly had my rocker switches on my yoke programmed to do exactly that.

 

Sorry, but it seems I'm lost.

 

Pete

 

I am trying to emulate that FS9 behaviour in FSX, with bitmap 2d panel views as there is no VC.

 

As I'm sure you know, in FS9 you can set view directions, eyepoints and zoom factors for each direction in the panel.cfg. Then you set a [fixed_window.xx] entry that contains an overlay to look like a window / view from the left seat looking right etc etc. When you 'look' in that direction, the eyepoint, zoom and direction from the panel.gfg are used, and if defined, the overlay from the fixed window is used too. This is great for wing views etc.

 

I am trying to replicate that behaviour in FSX, but annoyingly all those nice panel.cfg commands were dumped in favour of seeing the VC or nothing... FSX cannot handle fixed windows or individual viewpoints set in the same way as FS9. There are cameradefinitions, so that helps with the wing views.

 

The only solution I found so far is to use some XML code to show a different 'panel' - no gauges, just a bitmap - depending on which view direction was pressed. The problem is that I am severely limited in what information I have to tell me where I am currently looking. There is no nice variable to say 'cockpit view, forward right is currently in use' - if that existed, this would be really easy. Instead, the only reliable handle I've got is the key capture in XML. That is only sent when the view direction is commanded directly. For whatever reason, the hat switch is not triggering that key to be sent for each view, but it is changing the view direction. If the hat switch individual positions are set to the view directions, then the relavent key is sent.

 

Actually... I have just had a thought, which is that perhaps I am being a little dense and could in fact also capture the PAN_UP / DOWN keys if they are in the SDK, along with using Doug's gauge to only do it in the 2D view... This is worth testing...

 

Geoff

Link to comment
Share on other sites

I am trying to emulate that FS9 behaviour in FSX, with bitmap 2d panel views as there is no VC.

 

Yes, and this is what I don't understand as I don't see a difference. Sorry.

 

FSX cannot handle fixed windows or individual viewpoints set in the same way as FS9. There are cameradefinitions, so that helps with the wing views.

 

 

Ah, so it isn't to do with just looking out the window in different directions? You want predefined cameras, effectively. And these can't be done with the camera options?

 

Have you looked at programs like EZDOK and OpusFSX? They do a good job. I use EZDOK myself.

 

Regards

Pete

Link to comment
Share on other sites

Yes, and this is what I don't understand as I don't see a difference. Sorry.

 

 

 

Ah, so it isn't to do with just looking out the window in different directions? You want predefined cameras, effectively. And these can't be done with the camera options?

 

Have you looked at programs like EZDOK and OpusFSX? They do a good job. I use EZDOK myself.

 

Regards

Pete

 

In FSX, when there is no VC and you look right, you see only the scenery to the right. In FS9 you could easily define a bitmap image to also be displayed on that view so that when you looked right, you'd see the scenery /and/ that image, so it would look like you were looking out of the cockpit. See attached screenshot from FS9 - there is /no/ VC there, just the illusion of one using a fixed bitmap (the wingtip /is/ part of the model).

GCS3371.bmp

 

When I take the same aircraft, with no VC, in FSX there is no easy facility to get those views back, with the bitmap overlay. I can add them as panels, but then I need code to open and close them when the view is in the appropriate direction - FSX cannot do this natively anymore... I found an XML solution from Joao Muas on fsdeveloper that allows me to capture key commands to the views, and that way set up code to switch to the right bitmap / panel in my panel.cfg. Only problem being that it only works for the key presses, and not the joystick hat switch.

Here is what the FSX view looks like with no 'extras' - all you get is the wing.

GCS0005.bmp

 

Hope that makes more sense.

 

I have had a quick look at EZDOK, but as far as I can see, there is no provision for fixed views with bitmap overlays. Perhaps I am wrong?

 

(Anyway, it might all be worthless as I seem to be getting OOM errors with these view switching scripts, so perhaps they have deeper problems...)

 

Thanks,

Geoff

Link to comment
Share on other sites

In FSX, when there is no VC and you look right, you see only the scenery to the right. In FS9 you could easily define a bitmap image to also be displayed on that view so that when you looked right, you'd see the scenery /and/ that image, so it would look like you were looking out of the cockpit.

 

Oh, I see! It isn't the VIEWS you want, but the cockpit walls/windows around them.

 

I found an XML solution from Joao Muas on fsdeveloper that allows me to capture key commands to the views, and that way set up code to switch to the right bitmap / panel in my panel.cfg. Only problem being that it only works for the key presses, and not the joystick hat switch.

 

I'm rather lost again. What are "key commands" in this context? FS controls ("Key Events" or K:... in XML) are numerical values which are sent internally in WM_COMMAND messages. As such they can be assigned to key presses and to buttons and axes, of which the hat switch is actually treated as both by FSUIPC. You could actually have the hat switch send both the view changing controls it currently does AND send othere controls  to switch your panel bit map, if in fact it is implemented that way.

 

Additionally, or maybe alternatively, the controls ("Key Events") sent to FS from any source can be received and acted upon in FSUIPC Lua plug-ins using the event.control function. Wouldn't this be a way of programming your needs?

 

Regards

Pete

Link to comment
Share on other sites

You may try to use "conditional buttons assignment" for the hatswitch buttons, e.g
 

100=W8320!1 R0,34,C65672,0      ; PAN IN VC/EXTERNAL VIEW
101=W8320=1 H0,34,K102,8        ; KEYPRESS IN 2D PANEL VIEW

so, for the above example if you press the POV-RIGHT button while in 2D panel it generates keypress (NUM-6) and operates normally as PAN button in other view modes (VC, external, top-down). Just change the keypress assignment above to your predifined key for each of HAT buttons (32-39).

If you use that FIXED-VIEW XML gauge, maybe it's also possible to assign the hatswitch buttons for PANEL ID OPEN/CLOSE/TOGGLE directly,
 

100=W8320!1 R0,38,C65672,0      ; PAN IN VC/EXTERNAL VIEW
101=W8320=1 H0.38,C66507,10001  ; OPEN PANEL ID 10001 (CUSTOM FIXED-VIEW)
102=W8320=1 U0.38,C66507,10001  ; CLOSE PANEL ID 10001


I hope this will be helpful,

Regards,
-xcorez-

Link to comment
Share on other sites

Oh, I see! It isn't the VIEWS you want, but the cockpit walls/windows around them.

 

 

I'm rather lost again. What are "key commands" in this context? FS controls ("Key Events" or K:... in XML) are numerical values which are sent internally in WM_COMMAND messages. As such they can be assigned to key presses and to buttons and axes, of which the hat switch is actually treated as both by FSUIPC. You could actually have the hat switch send both the view changing controls it currently does AND send othere controls  to switch your panel bit map, if in fact it is implemented that way.

 

Additionally, or maybe alternatively, the controls ("Key Events") sent to FS from any source can be received and acted upon in FSUIPC Lua plug-ins using the event.control function. Wouldn't this be a way of programming your needs?

 

Regards

Pete

 

They are key events captured using XML code like I showed in post #5. I have to admit they were new to me when starting this gauge, so my understanding of them is more than likely incorrect!

Yes, thanks - Lua plugins is where my reading and testing will probably take me next...

 

You may try to use "conditional buttons assignment" for the hatswitch buttons, e.g

 

100=W8320!1 R0,34,C65672,0      ; PAN IN VC/EXTERNAL VIEW
101=W8320=1 H0,34,K102,8        ; KEYPRESS IN 2D PANEL VIEW

so, for the above example if you press the POV-RIGHT button while in 2D panel it generates keypress (NUM-6) and operates normally as PAN button in other view modes (VC, external, top-down). Just change the keypress assignment above to your predifined key for each of HAT buttons (32-39).

If you use that FIXED-VIEW XML gauge, maybe it's also possible to assign the hatswitch buttons for PANEL ID OPEN/CLOSE/TOGGLE directly,

 

100=W8320!1 R0,38,C65672,0      ; PAN IN VC/EXTERNAL VIEW
101=W8320=1 H0.38,C66507,10001  ; OPEN PANEL ID 10001 (CUSTOM FIXED-VIEW)
102=W8320=1 U0.38,C66507,10001  ; CLOSE PANEL ID 10001

I hope this will be helpful,

Regards,

-xcorez-

 

That's great - thanks for the pointers...

 

I think first I will have to work out why FSX is gaining about 150-200MB to it's memory footprint with each of these views when I open them (consistently and at any airport I care to choose) and then not unloading that. It is quickly enough to get me an OOM message with heavier scenery areas, making the concept of the 2D views rapidly less appealing!

 

Thanks,

Geoff

Link to comment
Share on other sites

They are key events captured using XML code like I showed in post #5. I have to admit they were new to me when starting this gauge, so my understanding of them is more than likely incorrect!

 

The list of FSX controls which FSUIPC has installed in your FSUIPC Documents folder lists them all, and those are the same names listed in FSUIPC's drop-down assignments lists (though the latter also includes FSUIPC's own added controls and those for Lua and Macro files). The example in post #5 was "View forward right" which you will see in both places. The list document provides the numerical equivalent which is what you'd use in a Lua plug-in, and is how the FSUIPC INI file records your assignments. FSX uses the name strings instead in its XML file recording assignments.

 

I think first I will have to work out why FSX is gaining about 150-200MB to it's memory footprint with each of these views when I open them (consistently and at any airport I care to choose) and then not unloading that. It is quickly enough to get me an OOM message with heavier scenery areas, making the concept of the 2D views rapidly less appealing!

 

I'm afraid I'm a bit out of my depth with FSX's panel display handling, but I would have thought the Panel ID open and Panel ID close controls would work without loading multiple copies. There's also a Panel ID toggle control.

 

Pete

Link to comment
Share on other sites

The list of FSX controls which FSUIPC has installed in your FSUIPC Documents folder lists them all, and those are the same names listed in FSUIPC's drop-down assignments lists (though the latter also includes FSUIPC's own added controls and those for Lua and Macro files). The example in post #5 was "View forward right" which you will see in both places. The list document provides the numerical equivalent which is what you'd use in a Lua plug-in, and is how the FSUIPC INI file records your assignments. FSX uses the name strings instead in its XML file recording assignments.

 

I'm afraid I'm a bit out of my depth with FSX's panel display handling, but I would have thought the Panel ID open and Panel ID close controls would work without loading multiple copies. There's also a Panel ID toggle control.

 

Pete

 

Thanks, I have looked at a couple of tutorials earlier on Lua and that will be a good way to do it, if I can get the gauge stable...

The code I have got already does indeed use Panel ID open / Close and some custom L:Vars from a gauge by Doug Dawson that can tell me when different panel ID windows are actually open...

I guess that the memory issue comes from the fact that FSX just doesn't like big 2D panels and obviously has some trouble when several of them are open. In FS9 I could have a single 5120x1600 front view with about 100 custom XML gauges and popups without too much trouble. In FSX, that just won't open and I have had to split it into two several parts, just to get it all to display!

 

Geoff

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.