Jump to content

Script LUA for F18


BlackHole

Recommended Posts

I am making changes in LUA scripts

to add parameters on the F18 plane

 

Here is my test example:

 

* Devices.lua file

 

- TEST

devices ["TEST"] = counter () - 60

 

 

* Devices_init.lua file

 

- TEST

creators [devices.TEST] = {

"AvLuaDevice"

LockOn_Options.script_path .. "test_device.lua"

{}

}

 

 

* Main_init.lua file

 

- TEST

TEST_PARAM_GAUGE = CreateGauge ("parameter")

TEST_PARAM_GAUGE.parameter_name = "TEST_PARAM"

TEST_PARAM_GAUGE.arg_number = 600

TEST_PARAM_GAUGE.input = {0,100}

TEST_PARAM_GAUGE.output = {0,1}

 

 

 

* Test_device.lua file

 

local my_param = get_param_handle ("TEST_PARAM") - get shared parameter (created if not exist), i.e. databus

my_param: set (0.1) - set to 0.1

local update_time_step = 0.1

make_default_activity (update_time_step)

--update will be called 10 times per second

 

function post_initialize ()

print ("post_initialize called")

end

 

function update ()

local v = my_param: get ()

my_param: set (10)

end

 

function SetCommand (command, value)

- if command == 3001 then

- print ("user click")

- end

end

 

--need_to_be_closed = false - close lua state after initialization

 

 

 

* Export.lua file

 

- test

local a26 = MainPanel: get_argument_value (600)

 

 

 

==> My problem is that I do not get the value 10 in my variable?

==> I always have the value 0 while for the other standard arguments, it works.

==> I added the device last (60) is the last device

==> I checked that the arg_number 600 did not exist

 

==> Can you help me?

Link to comment
Share on other sites

Was it really necessary to crosspost this three times?

 

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

  • Recently Browsing   0 members

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