Jump to content
The simFlight Network Forums

threshold coordinates


Recommended Posts

I would really appreciate some help on the following:

What would be a way of getting the coordinates of the threshold of the runway you are on?

If there is no direct way (via offsets etc), but MakeRunways must be used, how this could be exploited using a Lua script?

Link to comment
Share on other sites

What would be a way of getting the coordinates of the threshold of the runway you are on?

If there is no direct way (via offsets etc), but MakeRunways must be used, how this could be exploited using a Lua script?

You'd need to access one or other of the runways index files created by MakeRunways, searching for the runway whose coordinates most closely match your current position (read from FSUIPC offsets). To distinguish between close runways you'd need to go further and actually check that your position lies ON one of those runways. There will be some sort of trigonometrical algorithm for that, using the length, width and central position of the runways. Lua is fully capable of such things with a comprehensive maths library as well as file handling.

Regards

Pete

Link to comment
Share on other sites

Pete,

thanx for the input.

I was afraid that MakeRunways files would be the only option.

I'll get around the maths, but I am at a loss as for which MakeRunways index file to use, and more importantly on file handling with Lua.

Could you point to the right direction?

For example, the relevant reading for file handling would be paragraph 5.7 in Lua Manual (http://www.lua.org/manual/5.1/)?

Link to comment
Share on other sites

I'll get around the maths, but I am at a loss as for which MakeRunways index file to use

Have a look at them, see which you'd be happiest reading and decoding. The only ones with the needed runway data in are:

R4.CSV or R5.CSV: test format, includes runway centre coordinate, width and length, for precise testing whether you are on the runway.

RUNWAYS.XML: text, but in XML format. Really more work to decode unless you can find a Lua-accessible XML parser.

For example, the relevant reading for file handling would be paragraph 5.7 in Lua Manual (http://www.lua.org/manual/5.1/)?

Looks like it, yes. I don't this there are any others.

Regards

Pete

Link to comment
Share on other sites

Copy the tips on the files.

If you have any advise for reading material regarding file handling with Lua (more elaborate than the manual) please advise (sorry that I reiterate this, but I know almost nothing about programming, so I would need some kind of "human readable" material).

vbr

Link to comment
Share on other sites

If you have any advise for reading material regarding file handling with Lua (more elaborate than the manual) please advise (sorry that I reiterate this, but I know almost nothing about programming, so I would need some kind of "human readable" material).

Hmm. Sorry. Examples are probably best. The Lua plug-in "Record to csv.lua" uses the file library to write a CSV file, so may be of help. There are examples in the User Contributions subforum too, but I wouldn't have thought any use files.

For basic programming you really need a good book. I don't know of anything on-line. The only tuitional book I have for Lua is "Programming in Lua". I have the 2nd edition published in 2006 by Lua.org. I see the third edition is out now. Both are available on Amazon, at over £20 each though. There is a "Beginning Lua Programming" book, cheaper and (it says) suitable for beginners in programming. That's also available as a Kindle edition which could be handy.

Regards

Pete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.