Jump to content
The simFlight Network Forums

Recommended Posts

Posted
6 hours ago, GASimPilot said:

Thanks for the reply.  I have been trying to get the lua scripting working, and I cannot figure out how to read "A:PLANE HEADING DEGREES MAGNETIC" successfully.  It always comes back 0.   Here is my script.  It does write the 0 correctly to the Heading Bug.  If you could point me to my error, I would greatly appreciate it.

SimVar("A:PLANE HEADING DEGREES MAGNETIC")
SimVar("K:HEADING_BUG_SET")

function PFD_HDG_SYNC()

local curhdg = SimRead("A:PLANE HEADING DEGREES MAGNETIC")

SimCommand("K:HEADING_BUG_SET:" .. curhdg)

end

You're close ;D
The Variable Syntax is the Same as used in the Actions, so it should be:

SimVar("(A:PLANE HEADING DEGREES MAGNETIC, Degrees)")
SimRead("(A:PLANE HEADING DEGREES MAGNETIC, Degrees)")

 

What eventually could be an Issue is the Concatenation when the Value returned is not an Integer/whole Number.
Maybe print the resulting Command to the lua.log to analyze if the Result is correct

Log("K:HEADING_BUG_SET:" .. curhdg)

 

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.