Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

I'm trying to get this assigned to a joystick button so that it works like pushing the button in the VC. What happens is that when the button is pushed, the AP levels out at the current altitude irrespective of what is selected on the AP display. Doing a trace I see this

[C] Control: 66124 - 7703 AP_ALT_VAR_SET_ENGLISH

[C] Control: 65808 - 0 AP_ALT_HOLD_ON

the "7703" is the current altitude (actually the altitude reading from the altimeter) when the button was pushed. I don't know how to get this to it put into my lua script:

i = ipc.readLvar("L:***what can I put in here???***")

ipc.control(66124,i)

ipc.control(65808)

There doesn't seem to be a variable that I can see for this. Is there a "default list" of lvars that can be used, or are they specific to each aircraft? Or another way to do this?

Thanks for any help.

Posted

[C] Control: 66124 - 7703 AP_ALT_VAR_SET_ENGLISH

[C] Control: 65808 - 0 AP_ALT_HOLD_ON

the "7703" is the current altitude (actually the altitude reading from the altimeter) when the button was pushed. I don't know how to get this to it put into my lua script:

i = ipc.readLvar("L:***what can I put in here???***")

ipc.control(66124,i)

ipc.control(65808)

L:Vars aren't used for everything. In this case, since those controls are the standard FS contorls, not sepcific to the aircraft add-on, the normal FS current altitude is the value you need, read from FSUIPC offsets:

The altitude hold holds at the altitude set on the altimeter, which is not necessarily the true AGL, depending on your pressure setting. So the value needed is the altimeter read-out, which is at offset 3324 -- in feet normally, but meters if you've selected that. Assuming you use feet all the time,

i = ipc.readSD(0x3324)

Regards

Pete

Posted

Many thanks for that, just what I needed. Any recommendations on where I could find out more about this stuff, i.e. how would I have known to use readSD, and offset 3324.

Posted

Many thanks for that, just what I needed. Any recommendations on where I could find out more about this stuff, i.e. how would I have known to use readSD, and offset 3324.

The offsets lists for FSUIPC3 and FSUIPC4 are included in the FSUIPC SDK -- see the usual main download site, or the "Useful additional programs" thread in the Download Links subforum.

The Lua "ipc.readXXX" and "ipc.writeXXX" functions are described in the Lua library documents, installed already in your FSUIPC Documents subfolder.

The types of values like "SD = Signed Dword" can usually be easily deduced from the offsets list -- it is either explicitly stated, or easily deduced from the size (1, 2, 4, or 8 bytes) and type of data. There's a useful note about numbers in the FAQ subforum.

Regards

Pete

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.