PythonFlightSim Posted September 28, 2022 Report Share Posted September 28, 2022 Hello, I just bought FSUIPC 7 for MSFS, and would like to use it with the PMDG 738. Problem I am trying to solve with this addon is as follows: Context: I use keyboard and mouse to fly. Problem: Left and right rudder are too sharp in terms of degrees turned, as compared to how they were in P3D. So a single press of left rudder key now seems to turn twice as many degrees. Goal: I would like to use FSUIPC to make smaller incremental movements, when controlling flight surfaces through the keyboard. So each keyboard button press would move the surface X%, for example. Is this possible? If so, how would I go about doing it? Thanks! Link to comment Share on other sites More sharing options...
John Dowson Posted September 28, 2022 Report Share Posted September 28, 2022 7 hours ago, PythonFlightSim said: just bought FSUIPC 7 for MSFS, and would like to use it with the PMDG 738. Problem I am trying to solve with this addon is as follows: You should really have tried with the trial license first to see if FSUIPC7 is suitable for your needs.... There are various things you can try to achieve this. The first, an easiest, would be to assign your key presses to the *_UP, *_DOWN, *_LEFT, *_RIGHT controls, but this would probably just duplicate the movement that you see when assigning in MSFS. For more refined control, you would need to write a lua script which would wait for your key press (using event.key) and in the handling function read the offset with the current value, most probably offset 0x0BBA for rudder, then adjust thus value with the required change and then write the value back to the same offset. I am a bit busy at the moment but when I get time I can look inot providing you with a lua script that does this for the rudder to get you started. What keys are you planning to use? Noe that if you have keys assigned in FSUIPC, you should remove any assignments to those keys in MSFS. John Link to comment Share on other sites More sharing options...
John Dowson Posted September 28, 2022 Report Share Posted September 28, 2022 Btw, maybe you just need to use the trim controls rather than the primary surface controls? Link to comment Share on other sites More sharing options...
PythonFlightSim Posted September 28, 2022 Author Report Share Posted September 28, 2022 13 hours ago, John Dowson said: You should really have tried with the trial license first to see if FSUIPC7 is suitable for your needs.... There are various things you can try to achieve this. The first, an easiest, would be to assign your key presses to the *_UP, *_DOWN, *_LEFT, *_RIGHT controls, but this would probably just duplicate the movement that you see when assigning in MSFS. For more refined control, you would need to write a lua script which would wait for your key press (using event.key) and in the handling function read the offset with the current value, most probably offset 0x0BBA for rudder, then adjust thus value with the required change and then write the value back to the same offset. I am a bit busy at the moment but when I get time I can look inot providing you with a lua script that does this for the rudder to get you started. What keys are you planning to use? Noe that if you have keys assigned in FSUIPC, you should remove any assignments to those keys in MSFS. John Thank you for the quick, detailed, reply and solution suggestions. I do have the Logitech yoke I will need FSUIPC7 for eventually anyway, but it's just that I hate how cheap it feels and prefer using the keyboard. Also allows for more space on my desk. Do you think there would be lag with the lua script? I usually use Numpad 1 and 3 for left and right rudder. I also very much miss how Numpad 5 on P3D would center everything. MSFS has a center option in menu, but it doesn't seem to work the same way as P3D's version did, as I think it affects fewer surfaces. Would love to get that up and working again as it makes flying with the keyboard a breeze. I just went in the game and tried trim, but it's too slow unfortunately. P.S. Thank you for being an awesome dev that goes above and beyond the call of duty to respond and even offer script suggestions. You fully deserve every penny! No worries if you don't have time to write the script, I will still need this app for other purposes. Cheers. Link to comment Share on other sites More sharing options...
John Dowson Posted September 29, 2022 Report Share Posted September 29, 2022 8 hours ago, PythonFlightSim said: Do you think there would be lag with the lua script? Maybe a small lag but shouldn't be that noticeable. 8 hours ago, PythonFlightSim said: I just went in the game and tried trim, but it's too slow unfortunately. Standard trim up/down controls can be quite slow, but you can assign to update the trim offsets and specify the increment required. 8 hours ago, PythonFlightSim said: No worries if you don't have time to write the script I'll take a look at some point, probably at the weekend. Note also that you can also assign the keys directly to update the surface controls without using lua. The advantahe of using lua though would be that you could start with a small increment/decrement (delta) and then increase this delta value on key repeats (i.e. if you hold down the key). John Link to comment Share on other sites More sharing options...
John Dowson Posted September 29, 2022 Report Share Posted September 29, 2022 Please try the attached lua. Take a look at it and adjust the delta and delta increment (on repeat) values for each axis as you like. To use, add it to the [Auto[ section of your FSUIPC7.ini., e.g. Quote [Auto] 1=Lua nmpadFltCntrls I also suggest that to tune the script, assign a button or key to run the lua using the Lua nmpadFltCntrls - then pressing that assigned button/key will kill the running lua and restart it, so you can test your changes. One thing I noticed is that the axis values and simvar values for these controls seem to be negated/reversed, i.e. sending a positive axis value results in the relevant simvar taking a negative value and visa-versa., hence the script is changing the sign when reading the offset value. Let me know how it works and if you have any issues. John nmpadFltCntrls.lua P.S. Make sure you also delete the MSFS assignments to the numpad keys that you are using! 1 Link to comment Share on other sites More sharing options...
PythonFlightSim Posted September 30, 2022 Author Report Share Posted September 30, 2022 11 hours ago, John Dowson said: Let me know how it works and if you have any issues. Worked on the first try, thank you! I think this was what I was meant to do, after clearing MSFS control assignments, and placing that lua script in FSUIPC7 folder. The one thing that sadly did not work is centering with Num5, even if I kept it pressed. Test model was Aerosoft's Twin Otter. Precision seems to be a lot finer than default MSFS controls, which is exactly what I was looking for. Will test it some more to fine tune over time. Thanks again for taking the time to help with this, and I hope it helps someone else out there as well in the future. Link to comment Share on other sites More sharing options...
John Dowson Posted September 30, 2022 Report Share Posted September 30, 2022 7 hours ago, PythonFlightSim said: I think this was what I was meant to do, after clearing MSFS control assignments, and placing that lua script in FSUIPC7 folder. No...that will start the script when you press the End key, and then kill it and start it again when you release. Remove the control sent on release - you don't need that. And you only need this to restart the script to reload the changes made when tuning. If always using the script, it should be started automatically using the FSUIPC7.ini [Auto] section. 7 hours ago, PythonFlightSim said: The one thing that sadly did not work is centering with Num5, even if I kept it pressed. Test model was Aerosoft's Twin Otter. That is strange as the other keys are working. Also no point keeping it pressed as the '5' key is only assigned to a press, and not a repeat press. Is anything centered (rudder, elevator or ailerons)? You can add trim centering as well if that is the issue. Maybe also check with a default aircraft, e.g. the C172. John Link to comment Share on other sites More sharing options...
PythonFlightSim Posted September 30, 2022 Author Report Share Posted September 30, 2022 1 hour ago, John Dowson said: If always using the script, it should be started automatically using the FSUIPC7.ini [Auto] section. Just to double check, if I have it in the [Auto] section, I don't need to "bind" it through the menu as well on click or release? Or do I still need to keep the on click? I am also seeing some weird behavior with the PMDG 738, whereby single clicks do not work anymore when I want to cross the center, so to speak. So if I am turning left, and click right until the point I should be able to start turning right, it only gets to center and stops. Wonder if this is related to the reversed axis comment from earlier. The only thing that works then, is to hold down the left or right rudder key, which then moves it too much. In general it seems the PMDG is a bit harder to control that the Twin Otter is, so I have some tuning work I need to do. I also don't understand why Num5 doesn't work when the rest do. Am guessing that maybe there is back end logic on their end to not allow centering in this fashion? Can I change the values in the lua script without have to restart MSFS, and just FSUIPC7 instead? Thanks again! Link to comment Share on other sites More sharing options...
John Dowson Posted September 30, 2022 Report Share Posted September 30, 2022 24 minutes ago, PythonFlightSim said: Just to double check, if I have it in the [Auto] section, I don't need to "bind" it through the menu as well on click or release? Or do I still need to keep the on click? You only need that to restart the lua script if you change it, i.e. while tuning it. Once you have set it up to your liking, no need to restart it again so you can remove that assignment. 26 minutes ago, PythonFlightSim said: Can I change the values in the lua script without have to restart MSFS, and just FSUIPC7 instead? Thanks again! That is what your 'End' key assignment is for - to restart the script when you change it... 28 minutes ago, PythonFlightSim said: I also don't understand why Num5 doesn't work when the rest do. Am guessing that maybe there is back end logic on their end to not allow centering in this fashion? I don't understand this either - this is using the same controls that move the elevator/aileron/rudder, so if the other keys are working, so should this. Did you try in the C172 - it works in that aircraft here. 32 minutes ago, PythonFlightSim said: I am also seeing some weird behavior with the PMDG 738, whereby single clicks do not work anymore when I want to cross the center, so to speak. So if I am turning left, and click right until the point I should be able to start turning right, it only gets to center and stops. Wonder if this is related to the reversed axis comment from earlier. The only thing that works then, is to hold down the left or right rudder key, which then moves it too much. In general it seems the PMDG is a bit harder to control that the Twin Otter is, so I have some tuning work I need to do. I can't see how any if this relates to reversers - that only affects thrust/throttle. Ground steering for airliners is done in combination with the steering tiller axis, and the rudder only takes affect as the speed increases. You could maybe use the '7' and '9' keys to control the steering tiller. There is also a new nosewheel steering control, but unfortunately this is not yet available for 3rd party apps as it isn't exposed by the SDK. I don't have the PMDG 738m but I have the 737-700 - I can take a look at this, but it will be over the weekend. I can also check the Num5/centering in this aircraft. John 1 Link to comment Share on other sites More sharing options...
John Dowson Posted October 1, 2022 Report Share Posted October 1, 2022 I have added the steering tiller axis to keys Numpad7 and Numpad9 in the attached script. These work slightly different from the other keys as there is no simvar for the steering tiller position - what this means is that when you press one of those key, the initial start value would be 0 (i.e. centered). Try it an see if that helps. Maybe I should add a call to set the steering tiller axis back to 0 (centered) on key release... Numpad5 will also centre the steering axis. I have also added a max limit on the delta value, currently set at 512. Just the one limit for all the axis at the moment - you can update if you want separate limits for each axis. I checked the centering (Numpad5) in the PMDG 737 and that seems to work as expected. I don't understand how that is not working for you in the Twin Otter - is it working in other aircraft? John nmpadFltCntrls.lua 1 Link to comment Share on other sites More sharing options...
PythonFlightSim Posted October 1, 2022 Author Report Share Posted October 1, 2022 Thank you for the new script! I understand the code so I should be able to tweak it myself as well. I was working with flightsim dev tools last year, and found something that would give me a readout of in-game stats. Am wondering if there is something, that will tell me exactly how much the rudder moves, so I can compare output from default controls, with script. Will let you know how it goes! Hope you had a wonderful weekend 😃 Link to comment Share on other sites More sharing options...
John Dowson Posted October 2, 2022 Report Share Posted October 2, 2022 15 hours ago, PythonFlightSim said: I was working with flightsim dev tools last year, and found something that would give me a readout of in-game stats. Am wondering if there is something, that will tell me exactly how much the rudder moves, so I can compare output from default controls, with script. That would be the Rudder Position offset, that the script already uses. There are other offsets available with other rudder stats, for example RUDDER DEFLECTION PCT at offset 0x0BBC. Take a look at the FSUIPC7 Offset Status document - this tells you what information/simvars are held in FSUIPC offsets. You can also add any other simvar defined in the MSFS SDK, any also any available lvar. Check the MSFS documentation for available simvars. 15 hours ago, PythonFlightSim said: Will let you know how it goes! Hope you had a wonderful weekend 😃 Thanks, you too! John 1 Link to comment Share on other sites More sharing options...
PythonFlightSim Posted October 2, 2022 Author Report Share Posted October 2, 2022 11 hours ago, John Dowson said: That would be the Rudder Position offset, that the script already uses. How would I go about debugging this value? I enabled IPC Read and Write, opened FSUIPC console, enabled log activity in the script, but it does not seem to show what is printed out using ipc.log(). Do I need to check a text file somewhere for this log? Any chance I can add you on Discord please? Thanks! Link to comment Share on other sites More sharing options...
John Dowson Posted October 3, 2022 Report Share Posted October 3, 2022 12 hours ago, PythonFlightSim said: How would I go about debugging this value? I enabled IPC Read and Write, opened FSUIPC console, enabled log activity in the script, but it does not seem to show what is printed out using ipc.log(). The logging of IPC read/writes only logs for external applications (IPC = Inter Process Control). To log offsets, use FSUIPC's offset logging capabilities (Log->Offsets..) - see the User guide for details. 12 hours ago, PythonFlightSim said: Any chance I can add you on Discord please? No, I do not provide support via Discord. I spend a lot of time on support as it is - I don't want to open another support channel - I would never get anything else done....! John Link to comment Share on other sites More sharing options...
PythonFlightSim Posted October 3, 2022 Author Report Share Posted October 3, 2022 55 minutes ago, John Dowson said: No, I do not provide support via Discord. I spend a lot of time on support as it is - I don't want to open another support channel - I would never get anything else done....! That is absolutely fair and understandable. Just thought it might be faster. 55 minutes ago, John Dowson said: To log offsets, use FSUIPC's offset logging capabilities (Log->Offsets..) - see the User guide for details. Understood, thanks. Link to comment Share on other sites More sharing options...
PythonFlightSim Posted October 3, 2022 Author Report Share Posted October 3, 2022 Where should I be looking for valid entries for that Offset field in the Offset Logging window? I tried going through the documentation but it is very lengthy. Tried some Rudder related codes from the Offset Status PDF but nothing was printed to console. One suggestion would be to make that Offset field a drop down perhaps, or have a link from that window to a quick cheat sheet showing valid entries. Tooltips above the headers Offset and Type would also be useful, as I am not sure what they are referring to. Thanks! Link to comment Share on other sites More sharing options...
John Dowson Posted October 4, 2022 Report Share Posted October 4, 2022 11 hours ago, PythonFlightSim said: Where should I be looking for valid entries for that Offset field in the Offset Logging window? I tried going through the documentation but it is very lengthy. Tried some Rudder related codes from the Offset Status PDF but nothing was printed to console. All offsets are documented in the FSUIPC7 Offsets Status document. If nothing was printed in the console, then you forgot to check the Normal log file checkbox - you have to select were you want the logging to go. 11 hours ago, PythonFlightSim said: One suggestion would be to make that Offset field a drop down perhaps, or have a link from that window to a quick cheat sheet showing valid entries. Tooltips above the headers Offset and Type would also be useful, as I am not sure what they are referring to. Never going to happen, sorry. That would be far too much work for little benefit for a very few people. I am struggling to get new functionality in as it is due to the amount of time I am spending on support and just keeping up with MSFS and P3D releases. There are far more useful things for the majority of folks I am planning to implement at some point already. John Link to comment Share on other sites More sharing options...
John Dowson Posted October 4, 2022 Report Share Posted October 4, 2022 Btw, maybe take a look at FSInterrogate (FSInterrogate2std.exe) or Examiner - both available in the Utils folder of your FSUIPC7 installation folder. John 1 Link to comment Share on other sites More sharing options...
PythonFlightSim Posted October 4, 2022 Author Report Share Posted October 4, 2022 1 hour ago, John Dowson said: Btw, maybe take a look at FSInterrogate (FSInterrogate2std.exe) or Examiner - both available in the Utils folder of your FSUIPC7 installation folder. Thanks! That was very useful. Using that tool I was able to set increments to about half their default value. local initialRudderDelta = 2000 local initialAileronDelta = 1500 local initialElevatorDelta = 1000 Centering still doesn't seem to work for me, even with the default Cessna, but I realized the built-in centering should be fine for now, with it just missing elevator centering. Cheers! Link to comment Share on other sites More sharing options...
John Dowson Posted October 4, 2022 Report Share Posted October 4, 2022 9 minutes ago, PythonFlightSim said: That was very useful. Using that tool I was able to set increments to about half their default value. local initialRudderDelta = 2000 local initialAileronDelta = 1500 local initialElevatorDelta = 1000 Those increments/deltas are over 10-times greater than the delta I started with and provided to you, which was 128. They are pretty huge increments and I can't see how you can control the primary flight surfaces with those...but each to their own! 12 minutes ago, PythonFlightSim said: Centering still doesn't seem to work for me, even with the default Cessna, This is very strange...are you using any of the MSFS assistance options? If so, maybe they are interfering. Otherwise suitable logging should explain what is happening... 13 minutes ago, PythonFlightSim said: I realized the built-in centering should be fine for now, with it just missing elevator centering. You can always update the script to send those controls on a Numpad5 key press: Rudder Center: control/event 65689 Center Ailer Rudder:: control/event 65612 John Link to comment Share on other sites More sharing options...
PythonFlightSim Posted October 4, 2022 Author Report Share Posted October 4, 2022 Just now, John Dowson said: Those increments/deltas are over 10-times greater than the delta I started with and provided to you, which was 128. They are pretty huge increments and I can't see how you can control the primary flight surfaces with those...but each to their own! It's probably because I've used a keyboard to fly with MSFS since it's original version, lol. Didn't have the money for a proper one, and I still think the Logitech one feels cheap, especially with a lack of force feedback like the driving wheels have. One day I hope to be able to afford a Brunner yoke or something similar. Reproduced a bug I keep experiencing. It seems that after you take off, if you increment past the center of an axis, you can end up not being able to increment back past that axis. I end up being stuck in one axis direction, unless I resort to holding the button down, to get back past that axis again. Doesn't always happen, and I am wondering if it's detecting that I am trying to hold down the button, when I am not? Link to comment Share on other sites More sharing options...
John Dowson Posted October 4, 2022 Report Share Posted October 4, 2022 1 minute ago, PythonFlightSim said: Reproduced a bug I keep experiencing. It seems that after you take off, if you increment past the center of an axis, you can end up not being able to increment back past that axis. I end up being stuck in one axis direction, unless I resort to holding the button down, to get back past that axis again. Doesn't always happen, and I am wondering if it's detecting that I am trying to hold down the button, when I am not? No idea, sorry. Enable logging in the lua script by setting the logActivity variable to true (and re-start)- that should tell you what is happening. John Link to comment Share on other sites More sharing options...
PythonFlightSim Posted October 4, 2022 Author Report Share Posted October 4, 2022 7 hours ago, John Dowson said: Enable logging in the lua script by setting the logActivity variable to true (and re-start)- that should tell you what is happening. It seems that the enabling of log slows down the game when logging, unless I am mistaken. In order to reproduce the issue, I need to click a couple times in a row, and thus might not be able to reproduce it with logging turned on. Will keep trying to debug it as I get more time. Link to comment Share on other sites More sharing options...
John Dowson Posted October 5, 2022 Report Share Posted October 5, 2022 Logging shouldn't make too much difference in performance, but that also depends upon the amount of data being logged...throttling the logging can have quite a severe influance on performance. What key repeat rate are you using/seeing? Maybe this needs adjusting.... I will take a ;ppl at the script again later today and try it for more than a few seconds and let you know if I find anything... John Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now