SparkerInVR Posted March 4, 2021 Report Posted March 4, 2021 I wrote a VR HUD so I can fly outside of the cockpit while in VR. I do not see anything wrong with it but when it is running it is blocking the commands from reaching MSFS. I am quite new to FSUIPC7 so might have done something wrong and so please tell me. Voice Attack is to important to me to give up so it could be great if they could get along. Any ideas Bill VR_HUD.zip
John Dowson Posted March 4, 2021 Report Posted March 4, 2021 12 minutes ago, SparkerInVR said: Any ideas Bill Looks ok to me on an initial look - I don't think that it could be blocking commands. But what do you mean by this - what sort of commands are they? As the wnd library creates a separate window, if your commands are key presses, they will go to the window you create in the script if it has the focus. Could that be the issue? Check by giving focus back to the main FS window. Do you have ' KeyboardFocus=Yes' set in your [Buttons] section? I've finished for the evening now - I'll take a look in more detail tomorrow. John
SparkerInVR Posted March 4, 2021 Author Report Posted March 4, 2021 11 minutes ago, John Dowson said: Looks ok to me on an initial look - I don't think that it could be blocking commands. But what do you mean by this - what sort of commands are they? As the wnd library creates a separate window, if your commands are key presses, they will go to the window you create in the script if it has the focus. Could that be the issue? Check by giving focus back to the main FS window. Do you have ' KeyboardFocus=Yes' set in your [Buttons] section? I've finished for the evening now - I'll take a look in more detail tomorrow. John Yes they are key presses so that might be the issue. I do not see a ' KeyboardFocus=Yes' set in my [Buttons] should there be?
John Dowson Posted March 5, 2021 Report Posted March 5, 2021 14 hours ago, SparkerInVR said: Yes they are key presses so that might be the issue. As I said, you can check if this is the issue by giving focus back to the main FS window or FSUIPC after the wnd window has been created. Did you try this? 14 hours ago, SparkerInVR said: I do not see a ' KeyboardFocus=Yes' set in my [Buttons] should there be? After testing as mentioned above (and in my first post) to confirm this is the issue, you can try adding that to your [Buttons] section (and any profile [Buttons.xxxx] sections) to see if that resolves your issue.
SparkerInVR Posted March 5, 2021 Author Report Posted March 5, 2021 Tested this morning with the same issue with one new one that the text is flashing. I added the ' KeyboardFocus=Yes' to the [Buttons] section and after a restart same issue. I had MSFS in a place where I could type into and after I gave the Vocie Attack command 'flaps down' I could no longer type in that search box. Voice Attack recognized the command but I heard a tone that I thinks means a keyboard entry has been given where no where for it to go. If I close out the Script window everything is back to normal. This is the first time I have had a issue with any window while using Voice Attack and have many open when I am streaming in VR. One other thing I am curious about is why I do not see a FSUIPC7.log entry for my VR_HUD.lua script. I thought this would have been easy when I got the script to work and display info on the desktop but I was very wrong. Bill FSUIPC7.zip
John Dowson Posted March 5, 2021 Report Posted March 5, 2021 1 hour ago, SparkerInVR said: One other thing I am curious about is why I do not see a FSUIPC7.log entry for my VR_HUD.lua script. Thats because you are logging lua plugins separately (one of your Log options), so its logged in a separate file - which you also included! 1 hour ago, SparkerInVR said: Tested this morning with the same issue with one new one that the text is flashing. Do you mean that the text in the wnd window is flashing? Strange....or do you mean the usual windows flashing that occurs when there is new input? Did you try, as I have asked, giving the window focus back to the FS or FSUIPC before activating the button? If not, please do so and let me know the result. But also, looking at your ini, you don't have any assignments at all in FSUIPC. So are your assignments in MSFS? If so, MSFS MUST have the focus to receive these. So, as I have said, please try giving the focus back to MSFS BEFORE you issue a command, to see if that works. The 'keyboardFocus=Yes' will not affect assignments in MSFS - you need to assign in FSUIPC for that to take affect. It seems to me that your problem is that you have assigned in MSFS, which means that MSFS must have the focus to receive the keyboard input, and when you start the lua script it creates a new window which, by default, accepts the keyboard input but does not handle it. But I need you to do the tests previously mentioned to confirm this. I could. maybe, look into either changing input focus back to the previous window once a wnd call creates a window, or look into forwarding keyboard events from the wnd window back to MSFS or FSUIPC so they get handled. But, first, I need to understand if this is what the actual issue is, so please follow my instructions and report back. John
SparkerInVR Posted March 5, 2021 Author Report Posted March 5, 2021 3 hours ago, John Dowson said: Do you mean that the text in the wnd window is flashing? Strange....or do you mean the usual windows flashing that occurs when there is new input? The text is being re displayed at rate of about 2 to 3 time a second. 3 hours ago, John Dowson said: Did you try, as I have asked, giving the window focus back to the FS or FSUIPC before activating the button? If not, please do so and let me know the result. After the Lua script window is being displayed I was at the Select Departure Airport in the search box and entered many letters than gave a voice command and at that point I could no longer enter any letters because the focus was somewhere else. 3 hours ago, John Dowson said: But also, looking at your ini, you don't have any assignments at all in FSUIPC. So are your assignments in MSFS? If so, MSFS MUST have the focus to receive these. So, as I have said, please try giving the focus back to MSFS BEFORE you issue a command, to see if that works. The 'keyboardFocus=Yes' will not affect assignments in MSFS - you need to assign in FSUIPC for that to take affect. My only purpose of using FSUIPC7 is to be able to create a Lua window on the desktop with info from MSFS about aircraft (heading, airspeed, altitude. etc.). everything else is being handled by MSFS. 3 hours ago, John Dowson said: I could. maybe, look into either changing input focus back to the previous window once a wnd call creates a window, or look into forwarding keyboard events from the wnd window back to MSFS or FSUIPC so they get handled. But, first, I need to understand if this is what the actual issue is, so please follow my instructions and report back. I was not sure if your wnd window supported keyboard input and that would make a difference how it would be handled. I hope I have answered your questions and we can find some kind of solution. I did a Twitch stream this morning in VR with MSFS and did do some out of the cockpit flying and was always wondering what my instruments were telling me. Having that info while outside would be so reassuring. Thanks for your time Bill
John Dowson Posted March 5, 2021 Report Posted March 5, 2021 19 minutes ago, SparkerInVR said: The text is being re displayed at rate of about 2 to 3 time a second. Ok. Then I think that the wnd window maybe getting the focus back (and so keyboard input events) when it is being updated. 20 minutes ago, SparkerInVR said: I was not sure if your wnd window supported keyboard input and that would make a difference how it would be handled. No keyboard support has been added to the wnd window, so any keyboard input relies on basic windows functionality. Keyboard input certainly isn't forwarded to the FS, but I'm not sure (without investigating) if the input would fall back to FSUIPC, but probably not (due to your issue). I'm sorry, but this is something that I will need to look into. I'm very bust at the moment, but this is now on my list to investigate. I will get back to you once I have had time to look at this in more detail. Hopefully later next week. John
John Dowson Posted March 11, 2021 Report Posted March 11, 2021 Hi @SparkerInVR. I'm going to look at this now. Just reviewing the issue and this struck me: On 3/5/2021 at 7:28 PM, SparkerInVR said: After the Lua script window is being displayed I was at the Select Departure Airport in the search box and entered many letters than gave a voice command and at that point I could no longer enter any letters because the focus was somewhere else. But the 'Select Departure Airport' is done when in the main menus, not when you have started a flight. Or am I missing something here? Lua scripts can't (or shouldn't) be started until you are 'ready-to-fly', i.e. out of the main menu and with an aircraft loaded. That is when they should be started... Anyway, I am going to try your script now and will report back. John
John Dowson Posted March 11, 2021 Report Posted March 11, 2021 Ok, I can see the issue (keyboard commands not working when MSFS has the focus and a wnd window is displayed). Such command work when FSUIPC7 has the focus. I also think the lua is being started too early, but that is a separate issue (that I will also look into).
John Dowson Posted March 11, 2021 Report Posted March 11, 2021 (edited) 15 minutes ago, John Dowson said: Ok, I can see the issue (keyboard commands not working when MSFS has the focus and a wnd window is displayed). Such command work when FSUIPC7 has the focus. Sorry, I was mistaken - I hadn't clicked the 'Ready To Fly' button. After doing that, MSFS receives my key board input and forwards to FSUIPC7 via simconnect as expected. So I am not sure what is going on in your situation.... I'll download Voice Attack now and install the free version and try with that. I cannot test in VR though. P.S. The 'KeyboardFocus=Yes' is used (sometimes) when you have keys assigned to button presses, and it isn't used for key assignments (MSFS or FSUIPC7 must have the focus for any key assignments to work). Sorry if that confused you - I wasn't sure if your 'commands' were via button presses or key assignments. Edited March 11, 2021 by John Dowson PS added
John Dowson Posted March 11, 2021 Report Posted March 11, 2021 Can you confirm that your issue is only when you are in the menus please, and not when you have a plane loaded and a flight started. If that is the case, then your issue would be fixed when I correct the start process. Anyway, I'll do this first and then you can check - I'd rather do this first than install VoiceAttack (although its downloaded ready). John
John Dowson Posted March 11, 2021 Report Posted March 11, 2021 Can you try the following version please, v7.0.7a. In this version, luas won't be started until a flight loads, and will be killed when going back to the main menu. There is a slight issue in that luas are initially started, then killed, then restarted. This is due to the events being received from MSFS being a bit of a mess, but I'll take a look in more detail tomorrow to see if I can prevent this. It should be ok to check for you issue though. Thanks. FSUIPC7.exe
SparkerInVR Posted March 11, 2021 Author Report Posted March 11, 2021 With the new version my script is starting when "New Activities" is displayed. Since sim update 3 VR is such a mess I am not using MSFS till they can get this resolved.
John Dowson Posted March 12, 2021 Report Posted March 12, 2021 16 hours ago, SparkerInVR said: With the new version my script is starting when "New Activities" is displayed. Yes, sorry. I've corrected a few things in the attached version if you could try that. 16 hours ago, SparkerInVR said: Since sim update 3 VR is such a mess I am not using MSFS till they can get this resolved. Ok. But could you just try the attached version please to see if your window is now displayed at the correct time. Also, if you could let me know if, once started, it is still affecting VoiceAttack, that would be good. Thanks, John FSUIPC7.exe
SparkerInVR Posted March 12, 2021 Author Report Posted March 12, 2021 After selecting a flight plan and clicking on the first fly button the Lua script window is now displayed. When I give a voice command you can see that the Lua script window takes focus from other windows. So I have the focus on the MSFS window and when I say "VR Mode" the focus leaves it and moves to the Lua script window. Without the Lua script window open and I have the FSUIPC7 window open and having focus when I say "VR Mode" the focus goes to MSFS. So with the Lua script window open and either having FSUIPC7 or MSFS with the focus the Lua script will always get the focus when I say a Voice Attack command. Bill
John Dowson Posted March 12, 2021 Report Posted March 12, 2021 2 hours ago, SparkerInVR said: After selecting a flight plan and clicking on the first fly button the Lua script window is now displayed. When I give a voice command you can see that the Lua script window takes focus from other windows. So I have the focus on the MSFS window and when I say "VR Mode" the focus leaves it and moves to the Lua script window. Without the Lua script window open and I have the FSUIPC7 window open and having focus when I say "VR Mode" the focus goes to MSFS. So with the Lua script window open and either having FSUIPC7 or MSFS with the focus the Lua script will always get the focus when I say a Voice Attack comma Ok, thanks for the update. I'll check that here with VoiceAttack when I get a chance, but it will be without VR. However, looks to be more of a problem with VoiceAttack changing the focus, not FSUIPC. FSUIPC will not be doing this (I think, but need to check!). Btw, have you tried VoiceAttack support? I will look into this further. I think the lua wnd windows are created as sub-windows of the FS, but need to check. I could maybe change them to be FSUIPC sub-windows, or make this an option. I'll take a look in more detail now and get back to you - but sometime next week, when i have time. John
John Dowson Posted March 15, 2021 Report Posted March 15, 2021 On 3/12/2021 at 8:47 PM, John Dowson said: I will look into this further. I think the lua wnd windows are created as sub-windows of the FS, but need to check. I could maybe change them to be FSUIPC sub-windows, or make this an option. I'll take a look in more detail now and get back to you - but sometime next week, when i have time. I've tried this and its not really a possibility, as FSUIPC is usually in the system tray (no main window displayed), this also hides any sub-windows. There was also an update issue (slow refresh rate) which was strange, but not worth looking into as I can't make this a sub-window of FSUIPC as indicated. It is not FSUIPC that is changing focus to the Wnd display window. I think you should raise an issue with VoiceAttack, letting them know of the problem. They must be setting the focus back to the FS, but are setting it to the Wnd sub-window instead of the main window. See if they can fix this to give focus back to the main FS window instead. Otherwise, I could look into forwarding events from the sub-window to the FS window, but I think the correct solution would be for VoiceAttack to send the commands to the correct FS window in the first place. John
John Dowson Posted March 16, 2021 Report Posted March 16, 2021 17 hours ago, John Dowson said: I think the correct solution would be for VoiceAttack to send the commands to the correct FS window in the first place. I asked about this on VoiceAttack and this is there response: Quote When VoiceAttack sends input (key press, mouse click), it first gains access to a Window via its handle (via window title, process name or Windows class name), and then proceeds to send input via Windows' API (virtual key presses/clicks). If your software is creating 'windows' within an application that has no way of receiving API input from Windows, but solely relies on hardware input, there's not much VoiceAttack is going to be able to do. Now, that may be a huge assumption on my part, as I do not yet have MSFS (been working on overhauling VA for months now - cant.make.it.stop - hoping one day soon)- so, I will need to refer you (or maybe your user - or both) to the VoiceAttack user forum (http://voiceattack.com/forum) or the VoiceAttack Discord server (http://voiceattack.com/discord), as there are many that participate in those outlets that use MSFS and possibly your software as well. I also participate in those outlets, so I'll probably be part of the solution. Make sure you or your user provide as much information as you can, including the steps taken, what the expectation is versus what is being experienced. This will usually result in a faster response and hopefully a solution for you. I still don't know if this is a general issue or in VR only. I'll check without VR when I get a chance. John
John Dowson Posted March 18, 2021 Report Posted March 18, 2021 A final update from VoiceAttack: Quote Since you're clearly defining a class name for your window, it should be possible for VA to find it by that class name (assuming there is some type of input that needs to be sent to it). The user would need to look at sections labeled, 'Send commands to this target' and ' Advanced Variable Control (Scope and Events)' in the VA help document - they'll ultimately need to send their commands to the your window like this: Noting the, '+' to indicate that we're searching for a class name (instead of a title or process name). Sorry, can't attach the image, but you need to select 'Send Command to this target' and then select to enter in the text box (not Active Window) and enter +AceApp - which is the windows class name of MSFS. I think the issue may be that the lua Wnd window has the focus when being updated, and as it is updating several times a second, your input is going to the lua window. Explicitly stating that it should go to the FS window should resolve your issue (although i have not tested, sorry!).
SparkerInVR Posted March 18, 2021 Author Report Posted March 18, 2021 6 hours ago, John Dowson said: A final update from VoiceAttack: Sorry, can't attach the image, but you need to select 'Send Command to this target' and then select to enter in the text box (not Active Window) and enter +AceApp - which is the windows class name of MSFS. I think the issue may be that the lua Wnd window has the focus when being updated, and as it is updating several times a second, your input is going to the lua window. Explicitly stating that it should go to the FS window should resolve your issue (although i have not tested, sorry!). I will test this as soon as I get a chance. I changed from "Microsoft Flight Simulator - *" to "+AceApp" and Active Window was not selected. It made no difference into how My Lua script interacted with MSFS using FSUIPC7. I guess this was just a bad idea and now fully understanding what I can do with FlyWithLua in X-Plane cannot be realized in MSFS. It is a shame but will look for other solutions to do what I am trying to do. Thanks Bill
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