Most of the commonly reported issues and questions are answered in the Frequently Asked Questions (FAQ) option under the Support menu of this website.
*** PLEASE NOTE ***
Your forum account is not the same as the account used in the shop. They are completely separate accounts.
1st December: A new version of the GoFlight Interface Tool for MSFS is now available.
12th November: A new version of the GoFlight Interface Tool for X-Plane is now available.
6th June: A new version of Virtual Flight Sim Hardware is now available (huge update)
21st November: A new version of the GoFlight Interface Tool for FSX/FSXSE/P3D is now available.

LUA access to Lvars?

I'm just starting to dig into LUA now that it's all contained within GIT. Milviz provide the following Lvars with "Lua" in their names. I'm puzzled on how I can use/set these Lvars from a LUA script?

setlvar("KAP140_LuaHDG_KeyDown",1) doesn't appear to do anything in my LUA script (LUA_KAP140_HDG.lua). So I searched for .LUA scripts thinking perhaps Milviz provided some, nothing found.

KAP140_LuaALT_KeyDown
KAP140_LuaALT_KeyUp
KAP140_LuaAPM_KeyDown
KAP140_LuaAPM_KeyUp
KAP140_LuaAPR_KeyDown
KAP140_LuaAPR_KeyUp
KAP140_LuaARM_KeyDown
KAP140_LuaARM_KeyUp
KAP140_LuaBARO_KeyUp
KAP140_LuaBARO_KeyDown
KAP140_LuaDEC100_KeyDown
KAP140_LuaDEC100_KeyUp
KAP140_LuaDEC1000_KeyDown
KAP140_LuaDEC1000_KeyUp
KAP140_LuaDOWN_KeyDown
KAP140_LuaDOWN_KeyUp
KAP140_LuaHDG_KeyDown
KAP140_LuaHDG_KeyUp
KAP140_LuaINC100_KeyDown
KAP140_LuaINC100_KeyUp
KAP140_LuaINC1000_KeyDown
KAP140_LuaINC1000_KeyUp
KAP140_LuaNAV_KeyDown
KAP140_LuaNAV_KeyUp
KAP140_LuaREV_KeyDown
KAP140_LuaREV_KeyUp
KAP140_LuaUP_KeyDown
KAP140_LuaUP_KeyUp

Any hints on what I might be missing as I guess I don't understand the purpose of these Lvars that Milviz define?

Cheers, Rob.

Comments

  • If KAP140_LuaHDG_KeyDown is appearing in the Lua Console as a valid Lvar then you have written it correctly Rob. I suspect that the gauge the Lvar references is not responding to the value change as it expects something else to happen beforehand or afterwards such as setting KAP140_LuaHDG_KeyUp to 1 (Key goes down and then up) or its being reset and ignored by the gauge.

    Does the lvar appear/work in Detective?
  • edited June 2018
    Hi Steve,

    KAP140_LuaHDG_KeyDown is not mine, none of those are mine, it's what your code detects for Lvars. I honestly don't really understand the purpose of them ... MV have some KAP140 documentation where it lists these Lvars but doesn't same anything about how to use them or what they do. MV don't provide any .LUA scripts so I'm puzzled?

    Using detective it appears the KAP140*_Lua*KeyDown Lvars are set when the corresponding button is clicked in the VC. The "KeyUP" Lvars are never set. So I emulated setting the KeyDown LVars in my Bespoke along with other Lvars and events that got triggered/set.

    So last night I was able to get KAP140 HDG/ROL button to work as expected but was entirely based on what I found via GIT detective and I didn't use any LUA scripts. LUA scripting certainly can do some powerful stuff, but I honestly could not find a need for it ... but if you have any clues/insight on why Milviz would provide those Lvars that might help me understand?

    Cheers, Rob.
  • I would guess that they use Lua within their own aircraft to do some scripting work for gauges, so they have called the Lvars with Lua in the title because they probably fire some internal aircraft Lua code. This of course would not be visible outside the aircraft or to GIT.

    I would try setting the down key and then the up key lavrs and see if that works.

    Best wishes
    Steve
  • Hi Steve,

    Yes, setting the KeyDown along with other Lvars and events did work. The KeyUp never gets triggered or is never visible to detective.

    I did search for all *.LUA scripts and found a few but none were related to Milviz or the KAP140 ... but all is good now without using any LUA scripts. Just need to wrap a few things up and check a few things then get the file posted for others to use.

    Cheers, Rob.
  • Rob, just wondering if you're still planning to release this file or have there been some glitches?

    Thanks, Robert
  • Some glitches, so got put on the back burner for now, sorry.
Sign In or Register to comment.