Jump to content
The simFlight Network Forums

Need help with *.lua file


AUA348

Recommended Posts

Dear all,

I have a lua script for automatic change of view: cycleViews.lua It used to work but I haven't used it for quite a while now. So, here comes the problem: once I run the lua script (execution and kill of the script is assigned to a joy-button) the script is executed. So far so good. In the log file (FSUIPC7.log) it can be seen that the desired keypresses are sent to MSFS. However, these keypresses don't cause the desired funcion to happen. If I press the keys manually within MSFS, everything works like it should, but for some reason (I'm not so much into lua scripting to be honest...) the keypresses sent by FSUIPC are not working.

Is there anyone here, who can help me in solving this issue?

Best regards,

Chris

Link to comment
Share on other sites

Does MSFS have the focus? MSFS needs to have the focus to receive key events. Alternatively, you can set the following parameter in the [General] section of your FSUIPC7.ini file:
    SetForegroundOnKeySend=Yes
Otherwise you can use ipc.keypressplus with an option parameter of 4 to change the focus to MSFS before the keystroke is sent, or 12 to do this and also return the focus to the original active window after the keypress has been sent.

John

Link to comment
Share on other sites

Yes, should be - I will take a look later today - need to pop out for a few hours. I will let you know once I have taken a look.
Also, please remember that when you attach log files, please attach a full log file and not a continuation log (i.e. don't use the New log feature).

Does it work if you manually give MSFS the focus?

Also. please check that you are using the latest official release 7.3.16, or the latest beta 7.3.17a (available from the Announcements sub-forum).

Thanks,

John

Link to comment
Share on other sites

Yes, I'm using the latest release. Updated it prior to posting here as I thought it might be an issue. No it also doesn't work when manually giving FS2020 the focus. What I have noticed is, that once the script runs and I put any window on top of MSFS, MSFS jumps on top whenever a view change in the lua file is triggered. That was also the case before setting SetForegroundOnKeySend=Yes and using the keypressplus command. 

Looking forward to your feedback!

Cheers,

Chris

Link to comment
Share on other sites

 

4 hours ago, AUA348 said:

What I have noticed is, that once the script runs and I put any window on top of MSFS, MSFS jumps on top whenever a view change in the lua file is triggered. That was also the case before setting SetForegroundOnKeySend=Yes and using the keypressplus command. 

Ok...then it already sets the FS to the foreground. Strange it isn't wotking as the key presses are being sent, and as the key presses work directly in MSFS. Did you notice when this stopped working (e.g. after what update)?

Sorry but I haven't had time to look at this today - will hopefully get a chance tomorrow...

Cheers,

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.