Jump to content

Recommended Posts

Posted (edited)

Here is an AutoHotkey script of mine that helps solving some weird ME maths.

 

These conversions are all obtained with a single Alt+Numpad keystroke:

[TABLE]
!
Num5
| Heading | expected as 360 complement :cry:

||

!
NumADD
| Altitude | convert meters into feet

!
NumENTER
| Altitude | convert feet into meters

||

!
NumIns
| Speed | m/s into knots

!
NumDot
| Speed | knots into m/s||

||

!
Num7
| adds 1 | to current field value

!
Num1
| subs 1 | to current field value

||

!
Num8
| Ranged values | applies +5% (mirror value into clipboard)

!
Num2
| Ranged values | applies -5% (mirror value into clipboard)

||

!
Num9
| Ranged values | applies +10% (mirror value into clipboard)

!
Num3
| Ranged values | applies -10% (mirror value into clipboard)

 

[/TABLE]

 

Attached dcs_me.ahk code:

 


; DCS A-10C Mission Editor (110810) {{{
; These keystrokes take the number entered in an input
; field to replace it with the results of some maths:

; o---------------------------------------o
; | ALT-NUMPAD keys usage                 |
; o---------------------------------------o  o--------------------------o
; |                                       |  |                          |
; |   +1      +5%       +10%              |  |  7     8     9           |
; |                                       |  |                          |
; |                                       |  |                          |
; |          360CMPL               ALT    |  |        5                 |
; |                               (feet)  |  |                     ADD  |
; |                                       |  |                          |
; |   -1      -5%       -10%              |  |  1     2     3           |
; |                                       |  |                          |
; |                                ALT    |  |                          |
; |                              (meters) |  |                    ENTER |
; |  Speed          Speed                 |  |                          |
; |  (knots)        (m/s)                 |  |  INS        DEL          |
; |                                       |  |                          |
; o---------------------------------------o  o--------------------------o

;}}}

SetKeyDelay, 100
METERS_SEC_S_IN_KNOTS = 1.94384449
METERS_IN_FEET        = 3.2808399

^+ScrollLock:: ; ---------------- Reload (after some modification) {{{
   MsgBox, 0, AutoHotkey, • Reloading %A_ScriptName%, .9
   Reload
return ;}}}

!Numpad5:: ; -------------------- 360 complement {{{
   Send, ^a^x
   clipboard := 360 - Mod(clipboard,360)
   Send, %clipboard%^a
return ;}}}

!Numpad7:: ; -------------------- +1 {{{
   Send, ^a^x
   clipboard := clipboard +1
   Send,       %clipboard%^a
return ;}}}
!Numpad1:: ; -------------------- -1 {{{
   Send, ^a^x
   clipboard := clipboard -1
   Send,       %clipboard%^a
return ;}}}

!Numpad8:: ; -------------------- +5% (and -5% in clipboard) {{{
   Send, ^a^x
   min       := Round(0.95 * clipboard)
   max       := Round(1.05 * clipboard)
   Send,        %max%^a
   clipboard :=  min
return ;}}}
!Numpad2:: ; -------------------- -5% (and +5% in clipboard) {{{
   Send, ^a^x
   min       := Round(0.95 * clipboard)
   max       := Round(1.05 * clipboard)
   Send,        %min%^a
   clipboard := max
return ;}}}

!Numpad9:: ; -------------------- +10% (and -10% in clipboard) {{{
   Send, ^a^x
   min       := Round(0.90 * clipboard)
   max       := Round(1.10 * clipboard)
   Send,        %max%^a
   clipboard :=  min
return ;}}}
!Numpad3:: ; -------------------- -10% (and -10% in clipboard) {{{
   Send, ^a^x
   min       := Round(0.90 * clipboard)
   max       := Round(1.10 * clipboard)
   Send,        %min%^a
   clipboard := max
return ;}}}

!NumpadAdd:: ; -------------------- ALT (feet/meters) {{{
   Send, ^a^x
   max       := Round(clipboard * METERS_IN_FEET)
   min       :=       clipboard
   Send,        %max%^a
   clipboard :=  min
return ;}}}
!NumpadEnter:: ; -------------------- ALT (meters/feet) {{{
   Send, ^a^x
   max       :=       clipboard
   min       := Round(clipboard / METERS_IN_FEET)
   Send,        %min%^a
   clipboard :=  max
return ;}}}

!NumpadDot:: ; -------------------- SPEED (m-s/knots) {{{
   Send, ^a^x
   max       := Round(clipboard * METERS_SEC_S_IN_KNOTS)
   min       :=       clipboard
   Send,        %max%^a
   clipboard :=  min
return ;}}}
!Numpad0:: ; -------------------- SPEED (knots/m-s) {{{
   Send, ^a^x
   max       :=       clipboard
   min       := Round(clipboard / METERS_SEC_S_IN_KNOTS)
   Send,        %min%^a
   clipboard :=  max
return ;}}}

 

Updates:

 

Update #1:

When some
+/- %
range is applied, the mirror
-/+ %
value gets stored in the clipboard, ready for a paste into the other (MIN/MAX) field of the UNIT'S HEADING IN LIMITS.

Update #2 (110810):

Added Altitude and Speed converters:

 

o NumpadAdd converts meters into feet

o NumpadEnter converts feet into meters

 

o NumpadDot converts meters/sec into knots

o Numpad0 converts knots into meters/sec

 

In all these cases, the replaced value is left into the clipboard ready to be pasted back.

Update #3 (110812):

Some cleanup to make it usable within any textfield:

 

o Unnecessary uppercase keystrokes replaced with lowercase

 

 

Attached file extension has to be changed from .txt back to .ahk

dcs_me.txt

Edited by ivanwfr
Updated
  • Recently Browsing   0 members

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