caponi Posted August 28, 2017 Posted August 28, 2017 Hi guys, i need some help. i will create some cycle buttons for the Mirage 2000 ... but the clickabledata.lua is not working for keybindings. so i have an idea that i will call a function instead of one value. here is my idea. may be that somebody could imagin what i have to do ... i have to questions. is it possible to call a function within the default.lua.value_down i.e. mycycle(3623, +0.1) instead of a fix value ? and ... in which lua file should i extend the lua with mycycle function ? best regards Alf PS: the function is not complete because i don't handle the wrap around for the max value ... but this could be a test for more -- entries for default.lua -- TACAN 10th -- {down = 3623, up = 3623, cockpit_device_id = 23, value_down = mycycle(3623, -0.1), name = _('TACAN Channel 10 Selector CCW'), category = _('ALF Test')}, -- {down = 3623, up = 3623, cockpit_device_id = 23, value_down = mycycle(3623, +0.1), name = _('TACAN Channel 10 Selector CW'), category = _('ALF Test')}, -- TACAN 1s -- {down = 3625, up = 3625, cockpit_device_id = 23, value_down = mycycle(3625, -0.1), name = _('TACAN Channel 1 Selector CCW'), category = _('ALF Test')}, -- {down = 3625, up = 3625, cockpit_device_id = 23, value_down = mycycle(3625, +0.1), name = _('TACAN Channel 1 Selector CW'), category = _('ALF Test')}, -- lua code where ever this must include ?!?! local alftab = {} function mycycle(kc, nxt) i = alftab[kc] if i == nil then i = 0 end i = i + nxt alftab[kc] = i return i end -- test cases mycycle(3623, 0.1) mycycle(3623, 0.1) mycycle(3623, 0.1) mycycle(3623, 0.1) mycycle(3623, 0.1) mycycle(3623, -0.1) mycycle(3625, 0.1) mycycle(3625, 0.1) mycycle(3625, -0.1) for a, b in pairs(alftab or {}) do print('A'..a..' B'..b) end print('Ende') -- result may be ... --A3623 B0.4 --A3625 B0.1 --Ende too much ...
caponi Posted August 28, 2017 Author Posted August 28, 2017 a test was positive, but ... the function mycycle was called once at the init and not at every button press :mad: the next hope for keybindings will die :music_whistling: too much ...
Recommended Posts