This are the Support Forums for FSUIPC and related products.

These forums replace the old support forums which have been running for 20+ years. The old forums contain a wealth of information on all FSUIPC products, but are now no longer available.

Please note that you will need to Register and Login to post for support, and also to download attachments. You can view these forums without registering.

Support is also available via Discord. Please use the following invite link to join the FSUIPC Discord server:
https://discord.gg/zjwUTrxmmE

Lua Script at Aircr...
 
Notifications
Clear all

[Solved] Lua Script at Aircraft Load

Posts: 6
Registered
Topic starter
(@vtgoding)
Joined: 2 weeks ago

I am looking to set up a lua script to set certain cockpit switches to a "cold and dark" state when an aircraft loads for a flight.  My understanding is that a lua script can be triggered to run sometime from clicking on "Fly" in the world map until or immediately after "Ready to Fly" is clicked.  Is my understanding correct?

I have thus far been unable to get a lua script to run automatically at aircraft load.  I have run the attached script successfully by triggering it with a button during the flight.

I simplified the setup as much as possible for testing purposes but still could not run the script at aircraft load.  MSFS2020 was run with no community Addons for the testing.  I renamed my FSUIPC7.ini and then ran MSFS2020 / FSUIPC7 to generate a default FSUIPC7.ini file.  I edited FSUIPC7.ini to add

[Auto]

1=PacerStartup  

at the end.  I placed PacerStartup.lua in the same folder where FSUIPC7.ini resides.  After starting MSFS and FSUIPC7 but before going to the global map page, I opened the FSUIPC interface to set Logging > Separate Lua Log & Lua Plug-ins 'on'.  I continued by setting up a ground start-up flight and finally clicking "Ready to Fly".  There was no sign the script ran.  I shut down FSUIPC7 and MSFS.  I've attached the .ini file and logfile as they appeared after MSFS shut down.  There was no Pacerstartup.log created.

What am I missing?

 


5 Replies
Posts: 195
Admin
(@fsuipc)
Joined: 7 months ago
[Auto]
1=PacerStartup

Should be

[Auto]
1=Lua PacerStartup

Many people have this problem...why is this not obvious from the documentation?

The Auto section starts macro and lua files, and lua files must be preceded by 'Lua'

John

 


Reply
Posts: 6
Registered
Topic starter
(@vtgoding)
Joined: 2 weeks ago

Thanks John, that solved it.

Posted by: @fsuipc

why is this not obvious from the documentation?

I was a programmer for 40 years.  One of the hardest aspects of the job is pulling your head out of 10 layers of code and writing product documentation for someone who doesn't know what you know about the product.

Case in point, the documentation for this feature reads:

Each Auto section contains a series of numbered lines (1=..., 2=... etc) each of which is either a Lua command, or a
Macro call. For example:

[Auto.737]
1=Lua SetMyOffsets
2=737 OHD:Air Allbleeds

The term "Lua command" isn't defined anywhere else in the Advanced User Manual.  That sentence and example would be more enlightening for the rest of us if it said:

"…each of which is either a lua file name preceded by 'Lua' or a macro file name.  For example:

[Auto.737]
1=Lua SetMyOffsets
2=737 OHD:Air Allbleeds 

"Lua command" is rendered in plainer English and the italics gives the reader a better idea of what is required to be present vs. the variables that the user needs to supply.

Just a thought.   

 


Reply
Posts: 6
Registered
Topic starter
(@vtgoding)
Joined: 2 weeks ago

Hmm, what I saw is not what I got.  Both code examples in my previous post lost their 'new-line' character controls when I hit 'Add Reply'. This is closer to what I intended them to look like:

[Auto.737]
1=Lua SetMyOffsets
2=737 OHD:Air Allbleeds

and

[Auto.737]
1=Lua SetMyOffsets
2=737 OHD:Air Allbleeds

Don't you just love it when the forum software makes its own mistakes for you?

 


Reply
Posts: 195
Admin
(@fsuipc)
Joined: 7 months ago

As the Lua prefix is only in the example, I have already added the following to make this more clear (will be in next release):

Note that to start a Lua plug-in/script, you must precede the script name with Lua, and no extension (.lua) is needed on the lua script name. For auto-starting macros, use the format <macro file name>:<macro name>, and with no extension (.mcro) on the macro file name.

Posted by: @vtgoding

Hmm, what I saw is not what I got.  Both code examples in my previous post lost their 'new-line' character controls when I hit 'Add Reply'. This is closer to what I intended them to look like:

When you add code, use a code block (including log & ini extracts, etc), i.e. click the '<>' button to format correctly. I have edited your previous post to show how this looks.

John


Reply
Page 1 / 2