Jump to content
Sign in to follow this  
psaunder

Who is programming in LUA for LOMAC?

Recommended Posts

I understand that some people here may have already played with LOMAC LUA scripting.

 

Can anyone give me a short summary of what they know about this?

 

If not, I s'pose i'll have to go and read the files myself . :D

 

In case anyone is interested I am application developer.

I mostly work on Unix / Oracle apps, though

can program in C/C++/Perl/Ksh/Oracle/VB and a few others.

 

 

 

pat.

Share this post


Link to post
Share on other sites

I'm not sure how many here have had the time yet to play with the LUA files but the possibilities looks very interesting.

I would very much like to what might be accomplished omce you guys get a grip on LUA and LoMac

Share this post


Link to post
Share on other sites

Well, I don't mind to answer my own question.

There doesn't appear to be as much functionality as I would have liked.

It appears to be a limited subset, just enough for primitive cockpit mods:

 

This is from the export.lua file:

 

Data that we can get out:

=================

LoGetModelTime() -- returns current model time (args - 0, results - 1 (sec))

LoGetMissionStartTime() -- returns mission start time (args - 0, results - 1 (sec))

LoGetPilotName() -- (args - 0, results - 1 (text string))

LoGetIndicatedAirSpeed() -- (args - 0, results - 1 (knots))

LoGetTrueAirSpeed() -- (args - 0, results - 1 (knots))

LoGetAltitudeAboveSeaLevel() -- (args - 0, results - 1 (feet))

LoGetAltitudeAboveGroundLevel() -- (args - 0, results - 1 (feet))

LoGetAngleOfAttack() -- (args - 0, results - 1 (degrees))

LoGetAccelerationUnits() -- (args - 0, results - 1 (G))

LoGetVerticalVelocity() -- (args - 0, results - 1(feet per sec))

LoGetADIPitchBankYaw() -- (args - 0, results - 3 (degrees))

 

Inputs we can give programatically to LOMAC:

=============================

They are identifed by a number which is passed to function

LoSetCommand(command, value)

 

where: value is between -1.0, 1.0

and:

 

command = 1 - joystick pitch

command = 2 - joystick roll

command = 3 - joystick rudder

command = 4 - joystick thrust (both engines)

command = 5 - joystick left engine thrust

command = 6 - joystick right engine thrust

command = 7 - mouse camera rotate left/right

command = 8 - mouse camera rotate up/down

command = 9 - mouse camera zoom

command = 10 - joystick camera rotate left/right

command = 11 - joystick camera rotate up/down

command = 12 - joystick camera zoom

command = 13 - mouse pitch

command = 14 - mouse roll

command = 15 - mouse rudder

command = 16 - mouse thrust (both engines)

command = 17 - mouse left engine thrust

command = 18 - mouse right engine thrust

command = 19 - mouse trim pitch

command = 20 - mouse trim roll

command = 21 - mouse trim rudder

command = 22 - joystick trim pitch

command = 23 - joystick trim roll

command = 24 - trim rudder

command = 25 - mouse rotate radar antenna left/right

command = 26 - mouse rotate radar antenna up/down

command = 27 - joystick rotate radar antenna left/right

command = 28 - joystick rotate radar antenna up/down

command = 29 - mouse MFD zoom

command = 30 - joystick MFD zoom

command = 31 - mouse move selecter left/right

command = 32 - mouse move selecter up/down

command = 33 - joystick move selecter left/right

command = 34 - joystick move selecter up/down

command = 7 - cockpit view (F1)

command = 8 - external view (F2)

command = 64 - increase thrust (both engines)

command = 65 - decrease thrust (both engines)

command = 72 - flaps on/off

command = 73 - air brake on/off

command = 84 - cannon fire on

command = 85 - cannon fire off

command = 161 - increase left engine thrust

command = 162 - decrease left engine thrust

command = 163 - increase right engine thrust

command = 164 - decrease right engine thrust

command = 350 - weapons pickle on

command = 351 - weapons pickle off

 

Is this useful for anyone? I don't plan on making my own cockpit in near century but I do like to hack programs, in a nice way of course. ;-)

Share this post


Link to post
Share on other sites

i guess it would take acces to the sourcecode to implement more LUA functions, right?

Share this post


Link to post
Share on other sites

I'm planning to use LUA, more for getting information out of lo-mac, guages primarily. I'm a little encouraged by one of the devs replying back in the lomac forums asking for what else would be desired.

 

I'm looking for things like warning lights (aka lightbits in Falcon4), gear position engine rpms, etc.

 

Cheers

 

 

Peter

Share this post


Link to post
Share on other sites

Well did the upgrade in the weekend to 1.02, pretty happy with it. Dug out the VB cdroms and hit the code.

 

Good news is the LUA code for dataexport is pretty much whats supplied with 1.02, the sample VB code posted on lomac forums to catch the values worked as well. Glued the sample code to simkits SDK code, and bingo I've got the simkits airspeed guage following the a10 airspeed in lomac :)

 

Cheers

 

Peter

Share this post


Link to post
Share on other sites

Here's a piccy of Lomac driving F4 glass. Can't wait to see additional items exported!.

 

Tilt head to view :)

 

Cheers

 

Peter

post-61-1088907796_thumb.jpg

Edited by bnepethomas

Share this post


Link to post
Share on other sites

One other thing

 

If you use the default script you may find the the update frequency between computer is a touch slow, basically due to the sending computer caching information before sending it. This means a single packet contains several updates.

 

This is fixed by adding, setoption to the script as follows.

 

if socket then

c, e = socket.connect(host, port)

c:setoption('tcp-nodelay',true)

end

 

cheers

 

Peter

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use, Privacy Policy, and 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..