Jump to content

Tip: Ruler with kilometers and nautical miles.


Recommended Posts

Posted

Normally, when you want to see the distance with the ruler in miles or kilometers you have to switch between in the settings.

But you can modify the me_map_window.lua so that you see both. Please see attached picture.

You have to modify the function updatRulerText in the following way:
 

local function updateRulerText_()
  if getRulerStarted_() then
    local distance = getDistance(ruler_.tape.points[1], ruler_.tape.points[2])
	local mdistance = distance
    local angleInRadians = getAngle(ruler_.tape.points[1], ruler_.tape.points[2])
    local angle = math.mod(360 + UC.toDegrees(angleInRadians), 360)
	
	local unitSys = OptionsData.getUnits()
	local sunit
	local msunit
	--if (unitSys == "metric") then
		sunit = _('m')	
		distance = math.floor(distance)
        if (distance > 1000) then
            distance = distance /1000
            sunit = _('km')
        end
	--else
		msunit = _('feet')
		mdistance = math.floor(mdistance/0.3048)
        if (mdistance > 6076.12) then
            mdistance = math.floor(mdistance/6.07612) / 1000
            msunit = _('nm')
        end
	--end
	
	local text = distance ..' '..sunit..', '..mdistance..' ' ..msunit..', '.. angle ..'°'
    
    ruler_.text.title = text
  end
end

enjoy  

 

ruler_modification.PNG

  • Like 1
  • Thanks 3
Posted (edited)

Oh my god yes this would be brilliant to have as standard.

Now all we need is the ability to set magnetic and grid (or whatever the hell it is) heading.

Edited by Northstar98
  • Like 2

Modules I own: F-14A/B, F-4E, Mi-24P, AJS 37, AV-8B N/A, F-5E-3, MiG-21bis, F-16CM, F/A-18C, Supercarrier, Mi-8MTV2, UH-1H, Mirage 2000C, FC3, MiG-15bis, Ka-50, A-10C (+ A-10C II), P-47D, P-51D, C-101, Yak-52, WWII Assets, CA, NS430, Hawk.

Terrains I own: South Atlantic, Syria, The Channel, SoH/PG, Marianas.

System:

GIGABYTE B650 AORUS ELITE AX, AMD Ryzen 5 7600, Corsair Vengeance DDR5-5200 32 GB, NVIDIA GeForce RTX 4070S FE, Western Digital Black SN850X 1 TB (DCS dedicated) & 2 TB NVMe SSDs, Corsair RM850X 850 W, NZXT H7 Flow, MSI G274CV.

Peripherals: VKB Gunfighter Mk.II w. MCG Pro, MFG Crosswind V3 Graphite, Logitech Extreme 3D Pro.

  • 1 year later...
Posted

Sorry to necro this thread, but does anyone know what file this code is in for the F10 map view during a mission? The original post is great, but it only works in the Mission Editor.

Thanks. 🙂

  • Recently Browsing   0 members

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