Jump to content

DCS BIOS LUA Console, read cockpit DeviceID:Argument values for DCS:AJS37


Duckling

Recommended Posts

I'm searching for a working method to read the status of a switch on a device other then Mainpanel/(0). 
Not sure if this 'should' work or my attempt fails to using lack of understanding LUA/DCS?

 

I set a switch via LUA console with no issues:
GetDevice(31):performClickableAction(3307, 1)

 

But when trying to read the same argument value by issuing:
returnValue = GetDevice(31):get_argument_value(3307)
return returnvalue

 

The response is:
Response:runtime error
1 | [string "Lua Console Snippet"]:2: attempt to call mathod 'get_argument_value' (a nil value)

 

Anyone that can guide me to working command?


Best
Gus


Edited by Duckling

- - - -

Link to comment
Share on other sites

Hi

Any help or idea appreciated. 
Should I be able to extract cockpit data via the DCS:BIOS Console using the syntax above?

 

Do anyone here that have both DCS:AJS37 module and DCS:BIOS help out making that simple test described above, it would help greatly to easy troubleshoot this.


(I do see applicable cockpit data active in DCS:BIOS Control reference so the connection is alive and question is in the LUA Console to query device/arguments)

Right now I can't say for sure if it's my current config that fails, the LUA (HUB Version) Console that have issues with me, my syntax or if DCS:AJS37 Module that must be treated different some how.


In my early A-10 simpit, I had the imports working from DCS (but there running older version of DCS:BIOS with Oakes scripts and SIOC)

 

Work in progress is converting a real AJ37 Viggen to a simulator to join our existing J35 and J39 Sims at https://en.flygmuseum.com/ (ESOW Sweden)
Existing MIL SIMs running X-Plane but this one is targeted (Of Couse) to run DCS, though the option to run it on X-Plane/FS2020/Prepar3D must be possible.
That pushes us away from the 'simple' approach to use DCS:BIOS/Arduino and target is to use Oakes scripts here and IOCards/SIOC.

 

Status right now is that the cabin is cut behind the canopy (so front of those mighty airtakes remains)
Work on converting the panels to simulator use is almost completed. Gauges, radar and a lot other remain.

 

Not exactly a Home Cockpit but essential not far from it.

Early stages yet but if anyone like us to have a buildthread here to follow our progress, say the word

 

All the best 
Gus

IMG_0965.jpg


Edited by Duckling
  • Like 3

- - - -

Link to comment
Share on other sites

Did you manage to get your switch problem solved?

I haven't done anyting with DCS bios yet but a few things I'd try.

 

Most of the example I see of get_argument_value use dev0, something like:

 

local val = dev0:get_argument_value(arg_number)

 

Actually, Reading someof the code, should the arg value be 267 instead, as defined here:

 

defineToggleSwitch("RB_BK_REL_MODE",2, 3307, 267, "Weapon System", "RB-04/RB-15/BK Release Mode Switch")

 

so maybe try:

returnValue = GetDevice(31):get_argument_value(267)

Link to comment
Share on other sites

Nopp, no joy yet .. and my LUA skill is far from top notch. (Tested just in case with suggested but failed)

 

Testing ongoing. Digged into the metateble of the device 31 (in this case) and the function "get_argument_data" isn't listed there so I guess there no option to get it status that way.

 

3307 on devID 31 AJS37 is FR22's Group Selector knob, and the definitions of type, function, and coding differs for that same differs between HB, DCS BIOS HUB and the DCS-BIOS branch code for AJS37.

 

Reused some code from above did mange to get the CK37 NAV and Destination display Digits and control some other multipos switches so not totally stranded yet.

 

Going straight through LUA console here just to see what I manage to grab from the generic export environment but no luck on just this 'knob' yet. 

 

Cheers

 

edit: @Savvy , If you planed for but haven't used DSC:BIOS yet, I'd say go for it. Can look a bit overwhelming at first but both code and documentation are great and cost for the Aurdinos is almost negligable


Edited by Duckling

- - - -

Link to comment
Share on other sites

On 3/14/2021 at 9:06 AM, BlackLibrary said:

@Duckling 

may look at our Discord. Here you find help!

 

BlackLibrary, thank you. Lost myself within your linked documentation for a while (or rather a day or two and still just scratched the surface ..), just the comprehensive ajs37.lua is a real timesaver for our ongoing work. 

Small donation inbound 

 

Cheers

Gus


Edited by Duckling
  • Thanks 1

- - - -

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...