s-d-a/DCS-ExportScripts

HELP: Custom functions and math

theonegalen opened this issue · 1 comments

I'm currently building a StreamdeckXL profile for the F-5E. While trying to set up a streamdeck display for the chaff and flare counts, the tens and ones positions are associated with different DCS IDs. This means I have to use two different buttons for the chaff and flare displays, like this:

https://i.imgur.com/YkFJUSY.png

If I could do something to add those two together, like

[new function number] = ([401]*100)+([402]*10)

Then I could just have my streamdeck display the result. But I have no idea how to do this. I see that at the bottom of the F-5E-3.lua file included with DCS-ExportScripts, there's a section called "custom functions." Is there any way to program that new function in the lua file?

Try something like:

local new_number = mainPanelDevice:get_argument_value(401) * 100 + mainPanelDevice:get_argument_value(402) * 10

For an example of a custom function, see line 524 of this.