Jump to content
The simFlight Network Forums

Recommended Posts

Posted (edited)

Hi,

Don't know where to ask this, but what is the syntax for READ statements used in the LUA samples I've been seeing for FS-X interfaces.  Can't find any reference in FSUIPC or LUA documentation.  I require data from two FSUIPC offsets.  How do you determine what suffix to use on READ?

Filename: display vals.lua

Location: E:\Steam\steamapps\common\FSX\Modules

I've tried without success (these are Level-D 767 offsets added by Lekseecon_f):

while 1 do
  BrakePress = ipc.readUW(0x8b90)
  AltFlapPos = ipc.readUB(0x9300)

  ipc.display("brake pressure="..BrakePress..",  alternate flap position="..AltFlapPos..)
  ipc.sleep(200)
end

 

Yet, I can log these offsets from within FS-X:

BrakePressure%20AlternateFlaps_zpsyaj1hp

From Lekseecon_f manual:

Quote

offset in the 0x9.... range is 1 byte (8 bit)
offset in the 0x8.... range is 4 bytes (32 bit)

Please consider this is my first attempt at LUA.  For all I know, my READs might work fine and the DISPLAY is whacked.

Dazed and confused...

Edited by Demon
Posted
9 minutes ago, Demon said:

Don't know where to ask this, but what is the syntax for READ statements used in the LUA samples I've been seeing for FS-X interfaces.  Can't find any reference in FSUIPC or LUA documentation.

Really? You don't look very far then. The Lua library document included in your FSUIPC Documents library contains details of all of the lua library functions offered by FSUIPC and WideClient! Have another look!  Each ipc.readXX function has its own description clearly stating the type of value it is intended to read. (Pages 4-6, in alphabetic order!).

11 minutes ago, Demon said:

've tried without success (these are Level-D 767 offsets added by Lekseecon_f):

I'm afraid I can't help with those. I have no idea what format Lekseecon uses, nor what "offset in the 0x..." is supposed to mean. You need support with that program, not FSUIPC. But 32-bits is either UD or SD depending on whether signed or not -- as described in the documentation. It says very clearly that UW is unsigned 16 bit.

Pete

 

Posted (edited)

ARGH!!!

There's 14 PDFs in the FSUIPC download and I always skipped over that one.

I even downloaded the LUA Package.

Thanks for the rapid response Pete, and sorry for the stupid question, again.

Robert

 

EDIT: Thanks again Pete.  I'm a programmer by trade, so it was easy to clean up the syntax once I got a swift kick in the right direction:

Quote

    50734 Monitor IPC:8B90 (U32) = 30
    50734 Monitor IPC:9300 (U8) = 1
    58406 Aircraft="Level D Simulations B767-300ER Winglet - CVA B767-300ER Winglet"
    58406 System time = 05/12/2016 18:43:57, Simulator time = 18:43:37 (22:43Z)
    65688 Starting everything now ...
    67203 Advanced Weather Interface Enabled
    77563 Monitor IPC:8B90 (U32) = 29
    77766 Monitor IPC:8B90 (U32) = 26
    82969 Monitor IPC:9300 (U8) = 2
    85172 Monitor IPC:9300 (U8) = 3
    85375 Monitor IPC:8B90 (U32) = 27
    85578 Monitor IPC:9300 (U8) = 4
    86578 Monitor IPC:9300 (U8) = 5
    86781 Monitor IPC:8B90 (U32) = 26
    87766 Monitor IPC:8B90 (U32) = 27
    89375 Monitor IPC:8B90 (U32) = 26
    91578 Monitor IPC:8B90 (U32) = 27
    92984 Monitor IPC:8B90 (U32) = 26

 

Edited by Demon
Posted

Thanks again for the great support Pete.  I may be a programmer by trade, but I'm no longer able to work effectively due to side effects of sleep apnea; cannot concentrate long, really bad short term memory, etc.  I have a cpap machine to help me breath at night, but it can't function properly when I tear off my mask in my sleep.

(see, right now I'm fumbling to try to remember all the LUA mods I did only yesterday)

I missed a critical element and there's at least one syntax error in IPC.Display.

So for the next guy, here's a simple checklist to get a LUA script going.

1. If you want to have LUA scripts running continually to update hardware gauges, you need to start them up once FS-X is ready to fly:

File: ipcready.lua

Folder: FSX\Modules

ipc.macro("Lua KK_BrakePress")			-- place your background LUA scripts in here.

2. Add your LUA scripts also in the Modules folder.

3. Start FS-X.

4. Start Lekseecon once the Level-D fully initialized.

LUA%20logging_zps5n8pqnbl.png

5. If you do not get the expected results, look at the Log files in the Modules folder.

6. I suggest deleting the log files before the next run, LUA logs are concatenated and could be misleading.

7. Individual Log files and LUA windows are most helpful in debugging.

8. FSUIPC will add a few LUA entries in the FSUIPC.INI file, don't worry about them.

[LuaFiles]
1=ipcready
2=KK_AltFlapPos
3=KK_BrakePress

[Window.LUA display]
Docked=2643, 2215, 3532, 2424
Docked=1386, 249, 313, 154

9. Don't forget to add the variables in the Lekseecon.INI file in My Documents.

Brake System Pressure
761

Alternate Flaps
768

:)

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.