Jump to content
The simFlight Network Forums

Recommended Posts

Posted

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?

Posted

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

Posted

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/)?

Posted

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

Posted

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

Posted

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

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.