Jump to content
The simFlight Network Forums

Possible Lua Auto Load Bug?


ark1320

Recommended Posts

Hi John,

I have been auto loading a fairly large Lua file (over 1000 lines of code, uses LuaToggle for keyboard entries) successfully for years, but am now having what I think might be some kind of loading timing problem with it. If I load a plane directly onto the runway the Lua file does not work, even if I wait about a minute or so before trying to use it. But if I then exit FSUIPC7, and then restart FSUIPC7 manually, the Lua file works. This file makes use of the Wnd library to display short messages in response to keyboard entries, but when FSUIPC7 first starts (auto load), there is no message response to those keyboard entries.
The auto loading of small Lua files that also use the Wnd library, but don't display messages in response to keyboard entries, seem to be working.
I have not made any changes to the [Auto] section of the FSUIPC7.ini file.  I am using FSUIPC7 ver 7.4.8.

Let me know what type of log files might be helpful.

Thanks for any thoughts,

Al

Link to comment
Share on other sites

22 minutes ago, ark1320 said:

If I load a plane directly onto the runway the Lua file does not work, even if I wait about a minute or so before trying to use it.

Try running with the logging console window open (Log-> Open Console) - you should see when the lua auto files are started. Check to see if this lua auto is started and then try to use it.

23 minutes ago, ark1320 said:

Let me know what type of log files might be helpful.

Just show me your .ini and .log files, the latter generated with Lua Plugins logging enabled and showing your issue.

I am now on holiday, back Tuesday, so I will review your files then.

John

Link to comment
Share on other sites

3 hours ago, John Dowson said:

ust show me your .ini and .log files, the latter generated with Lua Plugins logging enabled and showing your issue.

I am now on holiday, back Tuesday, so I will review your files then.

OK, John, thanks. I will get you the files.
In addition to the above general Auto load file problem, I have now found a much smaller aircraft profile specific Lua file that does not work at first with Auto load, but does work if I restart FSUIPC7 manually. So the problem is not Lua file specific.

Have a great Holiday,

Al

BTW, I tried looking at the Console info, but it scrolls way to fast and the small font makes it just about impossible for me to see anything that way.  Age problem!

Link to comment
Share on other sites

On 3/7/2024 at 11:12 PM, ark1320 said:

I have now found a much smaller aircraft profile specific Lua file that does not work at first with Auto load, but does work if I restart FSUIPC7 manually.

But which is the lua script that is not working? Can you attach this script please. You are starting 11 luas with auto-start (6 general and 5 profile-specific), and one twice - you are starting the lua script Nav1FreqInit in both your general section and your profile section.

If you remove the scripts that are working and just run the one that isn't, does that then work or not?

 

Link to comment
Share on other sites

You can also turn off logging for Lua Plugins, and add the following to the top of lua that isn't working properly:

require "ipcDebug"

(the ipcDebug.lua needs to be in your lua folder - it is available in the example plugins zip file)

This will then activate the lua plugin logging for just that script, and it may then be easier to see what is happening in the logs...

Link to comment
Share on other sites

8 hours ago, John Dowson said:

You can also turn off logging for Lua Plugins, and add the following to the top of lua that isn't working properly:

require "ipcDebug"

(the ipcDebug.lua needs to be in your lua folder - it is available in the example plugins zip file)

This will then activate the lua plugin logging for just that script, and it may then be easier to see what is happening in the logs...

John,

Attached are the two log files and one Lua script and the FSUIPC7.ini that I used. Only the one Lua script was auto-loaded, and it did not work meaning it did not respond to the three input keys I tried (N, T, and C). I then killed (Exited) FSUIPC7 and restarted it manually. I then tried the same three input keys and everything worked as expected. 
From what I can tell, the auto-loaded Lua scripts that do not initially work are those the use a key input. For example, in response to the N key, a message that looks like the below should appear for a few seconds in a small window. But that does not happen with the initial auto-load. I wonder if there could be some kind of initial loading or timing issue associated with getting user inputs? I'm starting to see that Auto-loaded scripts that don't make use of user inputs work the first time, those that do don't work the first time.

 

image.png.5ac7b1dacbcb120d7c8d823e04c874b5.png

I think the prev log file below was the results from the auto-load, the log file was from the subsequent manual load. Works fine with the manual load.

Al

FSUIPC7.log FSUIPC7_prev.log NpC4MSFS2020.lua FSUIPC7.ini

Link to comment
Share on other sites

Ran another experiment using one of my auto-loaded lua scripts. I assigned both a button (on my throttle quadrant) and a keyboard key to the same function within the Lua script (the function executes some code to toggle a switch on the panel of the Flysimware Learjet 35A). On first auto-load the button worked, the key did not. After exiting FSUIPC7 and restarting it manually, both the key and the button worked. I repeated the experiment a few times with the same results.  This particular script does not make use of the Wnd library.

Al

Link to comment
Share on other sites

13 hours ago, ark1320 said:

I think the prev log file below was the results from the auto-load, the log file was from the subsequent manual load. Works fine with the manual load.

The prev log shows that no key presses were detected.

9 hours ago, ark1320 said:

Ran another experiment using one of my auto-loaded lua scripts. I assigned both a button (on my throttle quadrant) and a keyboard key to the same function within the Lua script (the function executes some code to toggle a switch on the panel of the Flysimware Learjet 35A). On first auto-load the button worked, the key did not. After exiting FSUIPC7 and restarting it manually, both the key and the button worked.

Ok. So it seems that the issue is nothing to do with lua, but that FSUIPC7 is not picking up key presses when FSUIPC7 is initially (auto?) started, but is when restarted. Very strange...
Presumably none of your key assignments work when FSUIPC7 is initially started, no? Can you check this please.
Is FSUIPC7 being auto-started by MSFS, or are you initially starting it manually, and if so when (i.e. what state is MSFS in when you start FSUIPC7)?

I can't seem to reproduce this here...I will keep investigating....

Link to comment
Share on other sites

Could it be that something else (i.e. not MSFS) has the (keyboard) focus, so that when you press the keys they are not being seen by MSFS and so not being sent to FSUIPC?
Can you test for this - when you find that your key assignments are not working, click on the MSFS main window to give it the focus and try again.
I don't understand why this would be different once FSUIPC7 is restarted though...

Link to comment
Share on other sites

8 hours ago, John Dowson said:

Presumably none of your key assignments work when FSUIPC7 is initially started, no? Can you check this please.
Is FSUIPC7 being auto-started by MSFS, or are you initially starting it manually, and if so when (i.e. what state is MSFS in when you start FSUIPC7)?

MSFS starts FSUIPC7, and the FSUIPC7 flash screen appears about 90-100 seconds after I click to start the sim loading. And yes, none of my key assignments work when FSUIPC7 is initially loaded. Neither General or Profile Specific lua scripts respond. I did click on the screen in the cockpit to hide the yoke, flip a switch, etc., to make sure the sim had focus before trying to input to one of the Lua scripts. Just doesn't work on initial load.  Very strange.

Al

Link to comment
Share on other sites

1 hour ago, John Dowson said:

Do the default MSFS key assignments work?

Yes, the default MSFS key assignments work after initial FSUIPC7 load.

Some more data that may be helpful:
I found some older versions of FSUIPC7 in my Deleted folder:
-- Installed ver 7.4.4: All worked on initial load. 
-- Installed ver 7.4.6: Did NOT work on initial load. Did work after subsequent manual load.
--Installed ver 7.4.8 again. Did not work on initial load. Did work after subsequent manual load.

I repeated the above experiment a few times, ver 7.4.4. always worked on initial load, versions 7.4.6 and 7.4.8 did not. They did always work on subsequent manual load.

I thought maybe the FSUIPC7.ini file General Section entry OpenOnStart=Never might be a factor, but deleting it did not make any difference.

Really appreciate the help -- thank you!

Al

Link to comment
Share on other sites

This is very strange! The problem seems to be that FSUIPC7 is just not receiving key presses (via SimConnect) when initially ran, but is after a restart. And it is also very strange that this only seems to be happening for you - its fine here and I have had no other reports on this (I would expect a lot of support requests if key assignments weren't working!)).

Could you do two more tests please:

1. Start FSUIPC7 before you start MSFS. You will get a pop-up box that says FSUI{C7 is already running - just acknowledge that. Do you receive key presses then (once an aircraft is loaded)?

2. Rename your ini file (temporarily) so that a new default one is created. When you start MSFS and FSUIPC7 is started, activate logging for Buttons & Keys and open the logging console (Log -> Open Console). Load and aircraft and then press some keys - are these key presses then received and logged by FSUIPC7? Once this is done, exit FSUIPC7, delete the newly created FSUIPC7.ini and restore the original one.

Thanks,

John

Link to comment
Share on other sites

4 hours ago, John Dowson said:

(I would expect a lot of support requests if key assignments weren't working!)).

Yes, that also occurred to me.

4 hours ago, John Dowson said:

1. Start FSUIPC7 before you start MSFS. You will get a pop-up box that says FSUI{C7 is already running - just acknowledge that. Do you receive key presses then (once an aircraft is loaded)?

Yes, key presses work right away if I start FSUIPC7 before starting the sim.

4 hours ago, John Dowson said:

Rename your ini file (temporarily) so that a new default one is created. When you start MSFS and FSUIPC7 is started, activate logging for Buttons & Keys and open the logging console (Log -> Open Console). Load and aircraft and then press some keys - are these key presses then received and logged by FSUIPC7? Once this is done, exit FSUIPC7, delete the newly created FSUIPC7.ini and restore the original one.

This is what I see. There is no response in the Console window to key presses with the new FSUIPC7.ini file that I can see. The Console window doesn't change from what you see below.

image.png.79cb850838209da251b9c1977e2bda67.png

Al

Link to comment
Share on other sites

1 hour ago, ark1320 said:

Yes, key presses work right away if I start FSUIPC7 before starting the sim.

Ok, that is interesting as it implies that this issue only (and always) happens when FSUIPC7 is auto-started by the sim - and only for you as far as I can tell...

55 minutes ago, ark1320 said:

Since FSUIPC7 version 7.4.4 works on initial auto load, but version 7.4.8 does not, is there some startup timing difference between the two versions?

There will be, but all timings start once the FS is detected, and it works ok for you when you start FSUIPC7 manually before the FS. And all threads are started ok, it is just that simconnect does not seem to be sending/forwarding key presses/releases.

As one last test, could you find your EXE.xml file (location will be logged in your InstallFSUIPC7.exe file), find the FSUIPC7 entry and remove this:

Quote

<CommandLine>-auto</CommandLine>

or maybe change to this:

Quote

<CommandLine></CommandLine>

i.e. remove the '-auto' flag. This will change some timings,

John

Later: someone else has now reported the same issue: 

 

Edited by John Dowson
Later added
Link to comment
Share on other sites

44 minutes ago, John Dowson said:

As one last test, could you find your EXE.xml file (location will be logged in your InstallFSUIPC7.exe file), find the FSUIPC7 entry and remove this:

Quote

<CommandLine>-auto</CommandLine>

or maybe change to this:

Quote

<CommandLine></CommandLine>

i.e. remove the '-auto' flag. This will change some timings,

That worked!  Key presses responded on initial FSUIPC7 load with FSUIPC7 ver 7.4.8. 🙂
Did this EXE.xml change delay the loading of FSUIPC7, or load it earlier than previously?

Al

Link to comment
Share on other sites

38 minutes ago, ark1320 said:

That worked!  Key presses responded on initial FSUIPC7 load with FSUIPC7 ver 7.4.8

That is interesting....however, I suspect that it was reconnecting a lot at start-up as that will just reduce the initial stall time from  45s to 5s. Can you show me a FSUIPC7.log file please.

I suspect that this is a timing issue between establishing a simconnect connection and requesting the data. I think I will remove this and add the delay between detecting the sim and connecting when auto-started, I will provide an updated version for you to test, probably tomorrow.

John

Link to comment
Share on other sites

24 minutes ago, John Dowson said:

That is interesting....however, I suspect that it was reconnecting a lot at start-up as that will just reduce the initial stall time from  45s to 5s. Can you show me a FSUIPC7.log file please.

I suspect that this is a timing issue between establishing a simconnect connection and requesting the data. I think I will remove this and add the delay between detecting the sim and connecting when auto-started, I will provide an updated version for you to test, probably tomorrow.

John

Yes, looks like it took a number of tries to connect to Simconnect.  I also tried a few keys (N, T, X) just to confirm all was still working -- it was.

Al

FSUIPC7.log

Link to comment
Share on other sites

36 minutes ago, John Dowson said:

Can you try the attached please - and add back the '-auto' command line flag in the exe.
Show me the FSUIPC7.log regardless of all is working or not please and I will take a look tomorrow (finishing now, orders from the wife!).

John

FSUIPC7.exe 663 kB · 0 downloads

I understand those kinds of orders!   🙂

I added back the '-auto' command line flag. Unfortunately, the test FSUIPC7.exe file did NOT work. Log file attached.

Al

FSUIPC7.log

Link to comment
Share on other sites

47 minutes ago, John Dowson said:

There is also a new ini parameter where this can be adjusted if needed.

Good news, latest FSUIPC7 version works -- tried loading the sim twice, both successful.

I noticed a new entry in the EXE.xml file:   <CommandLine>-FSIntegration</CommandLine>, but was not able to pick out the new FSUIPC7.ini timing parameter you mentioned. What is it called?

Thanks very much for the work on this,

Al

Link to comment
Share on other sites

1 minute ago, ark1320 said:

I noticed a new entry in the EXE.xml file:   <CommandLine>-FSIntegration</CommandLine>

That is nothing to do with FSUIPC - I hope that is not in the FSUIPC Launch.Addon section...

2 minutes ago, ark1320 said:

but was not able to pick out the new FSUIPC7.ini timing parameter you mentioned.

This is because they are mot written - you add them only if/when needed.

3 minutes ago, ark1320 said:

What is it called?

There are two new ini parameters that you can add to the [General] section which control the delay between sim detection and trying to connect:
    DetectToConnectDelay - defaults to 5 seconds, used when FSUIPC7 is started manually
    DetectToConnectDelayAuto - defaults to 60 seconds, used when MSFS starts FSUIPC7 (i.e. when the '-auto' command-line argument is present

7 minutes ago, ark1320 said:

Thanks very much for the work on this,

No problem - thanks for testing this for me. The issue seems to be that MSFS does not send the required events when you try to connect obtain a connection too early during its initial loading period. I don't understand why I cannot reproduce this here though, very strange...

John

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.