Jump to content

HUD element dynamic lua controllers


Recommended Posts

I've successfully used some of the HUD element controllers, e.g.

foo.element_params = {"FOO_PARAM"}
foo.controllers = {
   {"move_up_down_using_parameter", 0, 0.1 },
   }

 

The ones that I currently use are: move_left_right_using_parameter, move_up_down_using_parameter, parameter_in_range, text_using_parameter, opacity_using_parameter

 

The first arg in each controllers entry is the function name (e.g. move_up_down_using_parameter), the second arg is the (0-based) index into the element_params array to determine the param name, and the 3rd arg (and perhaps optional additional args after that?) is used with the function in question (e.g. the 0.1 above scales how much the element moves up and down with the changing value of FOO_PARAM).

 

I found a few others in Cockpitbase.dll that sound useful, but I don't know how to use some of them (others I can guess): change_texture_state_using_parameter, change_color_when_parameter_equal_to_number

 

Anybody have more info on these?

____________

Heatblur Simulations

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

OK, I figured out one of them:

 

foo.element_params = {"FOO_PARAM", "FOO_PARAM2"}
foo.controllers = {
   {"move_up_down_using_parameter", 0, 0.1 },
   {"change_color_when_parameter_equal_to_number", 1, 1, 0.0,1.0,0.0},

 

 

Setting FOO_PARAM2 to 1 changes the colour of the element to green (RGB given by 0.0,1.0,0.0), and setting FOO_PARAM2 back to something else causes it to revert to original colour. Haven't tried yet, but I'm guessing one can either add more args for more value/colour combinations, or use change_color_when_parameter_equal_to_number multiple times.

____________

Heatblur Simulations

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 2 months later...

I forgot to follow up on the above, so for posterity:

It is indeed possible to use change_color_when_parameter_equal_to_number several times, with a unique matching value for each colour triplet, e.g.

    {"change_color_when_parameter_equal_to_number", 1, 1, 1.0,0.5,0.0},
   {"change_color_when_parameter_equal_to_number", 1, 0.9, 0.9,0.45,0.0},
   {"change_color_when_parameter_equal_to_number", 1, 0.8, 0.8,0.40,0.0},
   {"change_color_when_parameter_equal_to_number", 1, 0.7, 0.7,0.35,0.0},

 

then setting FOO_PARAM2 to 0.7 will set your element colour to 0.7,0.35,0.0 for instance. If all you really need is to change the brightness of something, then opacity_using_parameter works better, and simply setting it to some value between 0 (invisible) and 1 (fully opaque).

____________

Heatblur Simulations

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Thanks Gyrovague! How about a "How to make a DCS module HUD" -for dummies guide? :)

  • Like 1

System:

Windows 10 | i7-7700K @ 4.5 Ghz | 32GB of RAM | Nvidia GTX 1080, 3440x1440 | DELL Ultrawide U3415W | Samsung 960 Evo M.2 and 2 TB Seagate Barracuda | TM Warthog Hotas | SLAW F-16 Pedals | Oculus Rift CV1 and HTC Vive PRO VR

 

+ High fidelity F/A-18C simpit :)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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