Jump to content

Easy-to-use Lua Console now included in DCS-BIOS


FSFIan

Recommended Posts

Hi,

since some people who might find this useful will miss it if it's just mentioned in the Home Cockpits forum, I'll drop a note here.

I have published a pre-release of DCS-BIOS v0.8.0 that includes a Lua Console that can help you debug your mission scripts.

 

How to set up:

 

  • Download the MSI installer and install the applicaton
  • start the DCS-BIOS Hub using the start menu shortcut
  • Click the icon in the system tray and click "Open web interface". A configuration page should open in your browser. Select "Setup Scripts" on the left and activate the Lua Console:
    attachment.php?attachmentid=219768&d=1571771981
    This installs a file in the Scripts\Hooks directory.

 

How to use:

  • start the DCS-BIOS Hub
  • Make sure "Enable Lua Console" is checked in the systray menu:
    attachment.php?attachmentid=219769&d=1571771988
    This is a security precaution; anyone who can connect to the web interface of the DCS-BIOS Hub can then execute arbitrary Lua code on your machine. If you also check "Enable access over the network", the web interface will be usable from other machines on the network (point a web browser to <your-LAN-ip>:5010) -- obviously, you should only do this on a LAN that is firewalled from the public internet.
  • Start your mission
  • Open the web interface and click the "Lua Console" menu item.
  • Set the "Environment" dropdown menu to "mission"
  • Type in some Lua code, then press Ctrl+Enter to execute it and show the results.

 

Some useful snippets to try:

 

return list_cockpit_params()

 

return list_indication(n)

(set n to a small number; start at 0 and work your way up.)

 

return c_flag_is_true(42)

to check the status of flag 42.

 

a_set_flag(42)

to set flag 42.

 

a_clear_flag(42)

to clear flag 42.

 

a_set_flag_value(42, 23)

to set flag 42 to value 23.

 

return  a_do_script([[
 trigger.action.outText(trigger.misc.getUserFlag(42), 5 , false)
 ]])

to show the value of flag 42 as a cockpit message

 

local keys = {}
for k, v in pairs(_G) do
keys[#keys+1] = k  
end
return keys

to see what else is available.

setup-scripts.png.6d8e46d75862fc03aa3060c3e5787740.png

systray-lua-console-enabled.png.4ddbf73894d91703192361d010df6050.png

  • Thanks 1
Link to comment
Share on other sites

  • 3 months later...

Hi there,

 

When I run the DCS Hub, I don't get the connectivity checkboxes. I am assuming that this is because it cannot find my DCS installation (which is a none standard location).

 

Is there a way to tell DCS Hub where my installation is?

 

I can connect to the Virtual Cockpit OK because of the entries into the Export.lua file, but I was just interested to see if I could get the checkboxes to work.

 

Thanks!

Processor : Intel Core i7 7800X (3.8 - 4.2 GHz) . Motherboard : ASUS TUF X299 . Memory : 16Gb DDR4 1333 . Graphics : NVIDIA GeForce RTX 2080 Super (+100 CC +700 MC) . Install : DCS on 500Gb SSD . Screen : 3440 x 1440 display with GSYNC . Control : TM Warthog HOTAS, CH Pro Pedals, Naturalpoint Track-IR . Software : VoiceAttack with VAICOM Pro, DCS BIOS

Link to comment
Share on other sites

  • 3 weeks later...
Hi there,

 

When I run the DCS Hub, I don't get the connectivity checkboxes. I am assuming that this is because it cannot find my DCS installation (which is a none standard location).

 

Is there a way to tell DCS Hub where my installation is?

 

I can connect to the Virtual Cockpit OK because of the entries into the Export.lua file, but I was just interested to see if I could get the checkboxes to work.

 

Thanks!

 

 

Did not work for me in firefox, it did with chrome however

(also need make sure you have firewall open to app)

As per doc notes:

 

"You should now be looking at a web browser showing the DCS-BIOS Hub web interface. If that is not the case, verify that your firewall is not blocking the DCS-BIOS Hub from listening on TCP port 5010.

 

 

also there are docs here

{YOUR INSTALL FOLDER}\DCS-BIOS\apps\doc

 

 

open index.html

Link to comment
Share on other sites

  • 2 weeks later...

Hey guys!

 

I've installed DCS BIOS and seemed to have gotten things set up, but I"m getting an error when trying to run commands in the LUA console....

 

For example, when I try this: return list_cockpit_params()

 

I get:

 

 

<string>:1: attempt to call a non-function object
stack traceback:
<string>:1: in main chunk
[G]: ?

 

Any body know what I'm doing wrong?

Link to comment
Share on other sites

Maybe you have your plane set to Client, try changing it to Player.

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

Strange, I get these for the JF-17:

 

Parameter ID Typical Value

 

ACCELERATION_X_W

ACCELERATION_Y_W

ACCELERATION_Z_W

ASM_MECHINFO_BREAKCHUTE

ASM_MECHINFO_CANOPYPOS

ASM_MECHINFO_LEFT_AILERON

ASM_MECHINFO_LEFT_MAINGEAR

ASM_MECHINFO_LEFT_STAB -0,046161

ASM_MECHINFO_NOSEGEAR

ASM_MECHINFO_RIGHT_AILERON

ASM_MECHINFO_RIGHT_MAINGEAR

ASM_MECHINFO_RIGHT_STAB -0,046161

ASM_MECHINFO_SPEEDBREAK

ASM_MECHINFO_STABS -0,046161

ASM_MECHINFO_VERT_STAB

ASM_RATE_PITCH 0,88461

ASM_RATE_ROLL 0,00003

ASM_RATE_YAW 0,000005

CTRL_IND_ON_OFF

EFM_EXT_TANKC

EFM_EXT_TANKL

EFM_EXT_TANKR

EFM_FUEL_LEFT 8990,2

EFM_INT_FUEL 5124,620875

EFM_PEDAL_POSITION

EFM_RPM 71,632415

EFM_SLIDE

EFM_STICK_PITCH

EFM_STICK_ROLL

EFM_T4 386,389923

EFM_TANK1 1090,296117

EFM_TANK2 1895,840817

EFM_TANK3 1069,241971

EFM_TANKL 534,620985

EFM_TANKR 534,620985

EFM_THROTTLE_POSITION

EFM_TOTAL_FUEL 5124,620875

EJECTION_BLOCKED_0

EJECTION_INITIATED_0 -1

JF17_IFF_M1_INT

JF17_IFF_M1_TRS

JF17_IFF_M2_INT

JF17_IFF_M2_TRS

JF17_IFF_M3_INT

JF17_IFF_M3_TRS

JF17_IFF_M6_INT

JF17_IFF_M6_TRS

JF17_ZCP_WIPEOUT

 

Which aircraft are you using?

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

Any of them... I've tried it with the Hornet, VIper and JF17. It must be that something isn't configured correctly, but I've gone over the steps several times and it seems to be correct.

 

I have had Witchcraft working well before, and the other day I thought I'd give DCS BIOS a try. Downloaded it, it installed and updated several things on my machine.

 

One it was ready, it just didn't work at all, no matter what I tried.

 

I then tried witchcraft again, but in that LUA console, the formatting of the returns were all screwed up (see attached).

 

I tried removing and reinstalling both DCS BIOS and Witchcraft but no change... DCS BIOS lua console does not seem to work, and the returns in Witchcraft LUA console is formatted all wonky.

snip1.thumb.PNG.b001cce4a6ce3417c4aa6a4cc5f09b24.PNG

Link to comment
Share on other sites

Any of them... I've tried it with the Hornet, VIper and JF17. It must be that something isn't configured correctly

...

I have had Witchcraft working well before ...

...

I then tried witchcraft again ...

 

Dont know about the Witchcraft thingy that you mention, but the software on post 1 of this thread works for me, the only issue that I had is that it forced me to return my Saved Games folder to drive C, as it didn't work with the redirected Saved Games that I had prior.

 

Here are a couple of screens with it working on my DCS 2.5.6

 

This shows the elements that Indicator 2 (the HUD) has:

 

tQbG0zW.jpg

 

This shows the aircraft current parameters:

 

RYY0nZa.jpg

 

On my Export.Lua I have the following line, to hook with the Console:

 

BIOS = {}; BIOS.LuaScriptDir = [[C:\Program Files\DCS-BIOS\dcs-lua\]]; BIOS.PluginDir = [[C:\Users\Eduardo\AppData\Roaming/DCS-BIOS/Plugins\]]; if lfs.attributes(BIOS.LuaScriptDir..[[bIOS.lua]]) ~= nil then dofile(BIOS.LuaScriptDir..[[bIOS.lua]]) end --[[DCS-BIOS Automatic Setup]]

 

This is an invaluable tool when trying to edit a training mission, it's been real useful to me. Hope you can get it working on your DCS.

 

Best regards,

 

Eduardo


Edited by Rudel_chw

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

OK, I have it working (kinda, sometimes).....

 

So here it is...> If I start DCS, open an instant action mission, select Open Web Interface from the DCS-BIOS icon and then "Enable LUA console" from there, it opens up a browser, all connections are correct and it works! I can set flags, see parameters and indciations!

 

I can then close this mission, open up another instant action mission and it works too, on every map I have.

 

Good so far!

 

Now, when I open up a mission that I've created and go to get things from the DCS-BIOS lua console, nothing happens. It just returns nothing. I can't set flags, see indications, or parameters.

 

Now, the weirder thing is, I can exit my edited mission and load up another instant action mission, but the LUA Console does not work here. It returns nothing, no flags, indications, etc...

 

DCS-BIOS LUA Console now won't work, no matter what I do. I then have to exit DCS entirely, close DCS-BIOS and then open them both up again. Once I do, it works for the Instant Action missions, but not for any user created ones.

 

I'm running the latest Open Beta 2.5.6, if that give any indication.

 

Any help would be greatly appreciated!

Link to comment
Share on other sites

OK, things have gotten better.... This is how I get it to work, mostly.... But I have to do it in the right order.

 

I have to start DCS in admin mode. I then start DCS BIOS in admin, as well. Right click the icon in systray and "Open web interface". Then, check the enable LUA Console.

 

This will work most of the time for me, so I'm quite happy. Thanks for the neat feature, and thanks everyone for the help!

Link to comment
Share on other sites

...

This will work most of the time for me, so I'm quite happy. Thanks for the neat feature, and thanks everyone for the help!

 

Glad you got it working .. I haven’t needed to use Admin mode, maybe it is because I don't have DCS installed on C:/program files/ :thumbup:

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

  • 1 month later...

Hello all, I still can't get the connect successful, my save game is in drive c and the DCS world installation was move to new SSD drive in drive J. I don't know how to /where to add the code to what export.lua file. Could anyone kindly give me more detail about these? I'm really so eager to try this very-powerful tool!

Link to comment
Share on other sites

Looks nice, although I can't call code im my lua scripts (that are loaded via a trigger in the mission).

Is this a known limitation ?

Zip - VEAF :pilotfly:

 

If you want to learn, talk and fly with french-speaking friends, the Virtual European Air Force is here for you ! Meet us on our Discord and our forum

If you're a mission creator, you may want to check the VEAF Mission Creation Tools (and its GitHub repository) a set of open-source scripts and tools that make creating a dynamic mission a breeze !

Link to comment
Share on other sites

  • 1 year later...
  • 4 weeks later...

Hello!
I use DCS BIOS, and I have one question:
It delivers the following output: "BASE_SENSOR_VERTICAL_ACCEL:1.671939\"

How can I use this in triggers, e.g. by checking if g-forces have been too high?

Visit https://www.viggen.training
...Viggen... what more can you ask for?

my computer:
AMD Ryzen 5600G | NVIDIA GTX 1080 Ti OC 11GB | 32 GB 3200 MHz DDR4 DUAL | SSD 980 256 GB SYS + SSD 2TB DCS | TM Warthog Stick + Throttle + TPR | Rift CV1

 

Link to comment
Share on other sites

  • 3 months later...
On 2/10/2022 at 11:12 AM, TOViper said:

Hello!
I use DCS BIOS, and I have one question:
It delivers the following output: "BASE_SENSOR_VERTICAL_ACCEL:1.671939\"

How can I use this in triggers, e.g. by checking if g-forces have been too high?

Check DCS Manual Page 157. X: COCKPIT PARAM IN RANGE
Use BASE_SENSOR_VERTICAL_ACCEL as your param. Then fill in your min and max values.

Link to comment
Share on other sites

  • 1 year later...

Thank you all for this post.

I have followed all the instructions but I seem unable to actually connect to DCS. I'm getting a green light on connection to Virtual Cockpit and Systray Settings Lua Console, but no table to tick in DCS Connection even though I have added the BIOS script line to Export.lua.

When attempting to execute  return list_cockpit_params()  in the Hub for Mission (running an Instant Mission, not from a mission from ME), I simply get the error response that it could not send snippet to DCS within 1 second.

Does anyone know how to overcome this problem?

Cheers

Nix null 
null

image.png

image.png

Link to comment
Share on other sites

2 hours ago, Nix Mills said:

I have followed all the instructions but I seem unable to actually connect to DCS. I'm getting a green light on connection to Virtual Cockpit and Systray Settings Lua Console, but no table to tick in DCS Connection even though I have added the BIOS script line to Export.lua.

 

I don't use the DCS connection item, just LUA Console ... my dashboard looks like this:

 

Yb3F976.jpg

 

On the windows tray icon, I enable the "LUA Console" menu item, like this:

 

4eWRuQc.jpg

 

And then on the DCS-BIOS webpage I select "Lua Console", like this:

 

xbotwHF.jpg

 

I have a default DCS-BIOS Config, like this:

 

nLEP8Wc.jpg

 

And on the dcs.log I see that it is enabled correctly:

 

18vNPz9.jpg

 

Don't know what else to show you, compare with my setup and see if you can spot a difference with yours.

Cheers,

 

Eduardo

  • Like 1

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

@Rudel_chwThank you so much for taking the time to write all this up, Eduardo.

I can see that the missing link on mine is the hook file, which isn't there, and therefore there is no mention of it in the log file either. I'll try and reinstall and figure out why it never created a hook.

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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