Jump to content
The simFlight Network Forums

Simple (?) LUA script


Recommended Posts

I'm using FSUIPC to assign keystrokes to a couple of GoFlight modules (RP48 and P8). Specifically, I'm using the RP48 to activate various MCP buttons (LNAV, VNAV, etc) that have been assigned keystrokes via the iFly routine (accessed from the FSX "Add-On" drop-down menu). For example, I've assigned SHF-F7 to activate VNAV. As we all know, the LED won't light up when FSUIPC is used for the button assignment.

I have a rudimentary understanding of how to make the LED turn on via a LUA script. If I understand it, I could have LUA monitor a hex memory address (offset) and, depending on the content of (0 or 1) that address, LUA will turn on the LED.

Using skittles' LUA tutorial, I've come up with what I think the routine might look like:

function VNAV (offset, value) -- Turns on LED #1 on to indicate the VNAV button on the MPC has been pushed

model = GFRP48

unit = 0

id = 0

if value == 1 then

gfd.SetLight(model, unit, id)

else

gfd.ClearLight(model, unit, id)

end

end

event.offset("????", "??", "VNAV")

My question is: how can I establish what the variables for the offset value and string value are? The offset library doesn't have anything for the MCP buttons (VNAV, etc) I've programmed.

Link to comment
Share on other sites

My question is: how can I establish what the variables for the offset value and string value are? The offset library doesn't have anything for the MCP buttons (VNAV, etc) I've programmed.

You need to specify the aircraft because FS itself has no VNAV option. You mention "iFly". do you mean the recent iFly 737NG? I understand that needs another free program to interface it to FSUIPC offsets. The information you need should be included in the details for that program.

For other aircraft it will vary. Very few add-on aircraft for FSX use FSUIPC offsets, so you have to seek other ways.

Regards

Pete

Link to comment
Share on other sites

Hi Pete,

Thanks so much for the quick response. You're a true champion.

Yes, it's for the new iFly 737 NGX (for FSX). Do you have details (i.e. whereabouts) about the free program that interfaces with the FSUIPC offsets?

Is my script on the right track?

I'd also like to eventually use it (same functions, VNAV, LNAV, CMD) for the recent PMDG 737NGX (for FSX). Are the offsets for those options subject to the pending SDK?

Thanks a million.

Chris

Link to comment
Share on other sites

Yes, it's for the new iFly 737 NGX (for FSX). Do you have details (i.e. whereabouts) about the free program that interfaces with the FSUIPC offsets?

Sorry, no. I think Jouni Tormanen was developing this, using the iFly SDK, but i have no other details at present. I don't know if it's ready yet. I suggest you ask at the iFly support forum.

Is my script on the right track?

Yes, though you won't know if "value == 1" is right until you know how the switch settings are stored. You might need to test bits instead using logic.And.

I'd also like to eventually use it (same functions, VNAV, LNAV, CMD) for the recent PMDG 737NGX (for FSX). Are the offsets for those options subject to the pending SDK?

Well, more than the SDK. Someone would need to use the SDK to provide data via offsets.

Regards

Pete

Link to comment
Share on other sites

Thanks. Oddly enough, there was a post on the iFly board yesterday from Steve Masson that said Jouni was on holiday, but their FSUIPC kit is "being worked on . . . " <g>

Again, thanks for your help. It is sincerely appreciated.

Chris

Link to comment
Share on other sites

  • 2 weeks later...

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.