Results 1 to 4 of 4

Thread: Need help understanding lua arg values

  1. #1
    Member Dojo's Avatar
    United States
       United States
    Join Date
    May 2014
    Posts
    2,219

    Awards Showcase

    Thanks Thanks Given 
    1,887
    Thanks Thanks Received 
    1,651
    Thanked in
    788 Posts

    Need help understanding lua arg values

    Folks - any help is appreciated.

    Working on a couple mods, and I'm stuck at understanding how the argument values should be represented. For this particular mod, I'm making the Radio buttons in the Mirage map-able. I have all of the buttons working except for rotary knobs. I am mostly concerned with the Radio preset selector.

    The Preset knob is defined as a "default_multiposition_knob". Here are the arguments for multiposition knobs.

    Code:
    function default_multiposition_knob(hint_,device_,command_,arg_,count_,delta_,inversed_,min_)
        local min_   = min_ or 0
    	local delta_ = delta_ or 0.5
    
    	local inversed = 1
    	if	inversed_ then
    		inversed = -1
    	end
    
    	return  {
    				class 		= {class_type.TUMB,class_type.TUMB},
    				hint  		= hint_,
    				device 		= device_,
    				action 		= {command_,command_},
    				arg 	  	= {arg_,arg_},
    				arg_value 	= {-delta_ * inversed,delta_ * inversed},
    				arg_lim   	= {{min_, min_ + delta_ * (count_ -1)},
    							   {min_, min_ + delta_ * (count_ -1)}},
    				updatable 	= true,
    				use_OBB 	= true,
    				cycle     	= true,
    			}
    end
    As you can see, the arg_values are "-delta_ * inversed,delta_ * inversed", which I don't know how to represent as values. Essentially, I want the knob to have two functions that are map-able: increase and decrease. I can make it work if I assign each of the 20 presets to a value, but of course that's stupid. Can someone help me interpolate the argument values for increase/decrease? I tried looking for other examples in the Mirage's clickabledata.lua, as well as checking the A-10, and things just aren't defined that way.

    Thanks in advance.
    Last edited by Dojo; 19Feb16 at 16:01.

  2. #2
    Member Hansolo's Avatar
    Denmark
       Denmark
    Join Date
    Jan 2015
    Posts
    150
    Thanks Thanks Given 
    356
    Thanks Thanks Received 
    118
    Thanked in
    61 Posts
    @Dojo taking into account that I do not have Mirage I have a question. The function increase/decrease might work out of the box if they have done it anything like'ish the A-10. I haven't touched any lua file for the presets in the Hog.
    Can you try and map the preset in the Mirage for e.g. '+' and '-' keys om the keyboard. If you can do that then perhaps all you need i a rotary incremental encoder. I use these for the the Hog presets selector. The rotary encremental encoder has two outputs 'A' and 'B'. If you turn clockwise they will change in one sequence and if you turn counter-clockwise then the outputs will change in another sequence (e.g. http://www.electronics-tutorials.ws/io/io4a.gif?81223b)

    Now 'all' you need a little piece of software that can handle this. Being situated in EU it come quite natural for me to use Leo Bodnar cards out of the UK. It's just a small joystick controller board but it comes with software that can detect the direction of rotation and pass it on to DCS. The good thing about this is that even though the outputs 'A' & 'B' changes in a sequence the software will detect the difference and only send on signal to DCS i.e. 'A' or 'B' thus DCS will just see it as a keystroke just like '+'.

    If I misunderstood you question then please disregard :-)

  3. #3
    Member Dojo's Avatar
    United States
       United States
    Join Date
    May 2014
    Posts
    2,219

    Awards Showcase

    Thanks Thanks Given 
    1,887
    Thanks Thanks Received 
    1,651
    Thanked in
    788 Posts
    Hey Hansolo, thanks for the response. Unfortunately, it's not quite the issue I'm having. The hog works out of the box because it's defined in such a way that allows you to. There is no definition, for keyboard or anything else for the mirage.

    I spent sometime with [FSF] Ian this past weekend examining it, and it appears the specific way this is designed in the Mirage makes it difficult, though not impossible with the right software. We got it to partially work by examining it with DCS Witchcraft, but the function is complex, and needs a bit more polish as it skips numbers.

    Ideally, the developer would simply just do it, and save us the headache.

  4. #4
    Member Hansolo's Avatar
    Denmark
       Denmark
    Join Date
    Jan 2015
    Posts
    150
    Thanks Thanks Given 
    356
    Thanks Thanks Received 
    118
    Thanked in
    61 Posts
    Solid copy Dojo. Sorry I could not be of assistance :-(

  5. The Following User Says Thank You to Hansolo For This Useful Post:

    Dojo (23Feb16)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Like our website?

You can help us by donating to cover our costs.

Many sincere thanks!


Search

Follow us

Twitter youtube