Implementing SnapTap Feature Using AutoHotInterception in AHK

I’m trying to replicate a feature called “Snap Tap” found in Razer keyboards, which is similar to the Null Movement/Null Bind function. I found an existing AutoHotkey (likely AHK v1) script that perfectly replicates this function, but I want the script to operate at a lower system level to minimize latency.

Without SnapTap mode, pressing two opposite directional keys simultaneously can cause the game to interpret it as a command to stop moving, requiring the player to release one of the keys to register a new direction. However, with SnapTap mode enabled, when you press two opposite directional keys simultaneously, such as “A” and “D,” the keyboard prioritizes the last key pressed. This means that if you press “A” to move left and then press “D” to move right without releasing “A,” the keyboard will only register the last key pressed, which is “D.” This allows your character to instantly change direction to the right without stopping, even though both keys are being pressed at the same time.

Interception API: My first attempt was using the Interception API to replicate this action. Unfortunately, it resulted in numerous bugs, likely due to my own errors.

Keyboard Hook: My next approach involved creating a Keyboard Hook. I almost succeeded, but it had persistent bugs after performing specific sequences of actions.

AutoHotInterception: I discovered the AutoHotInterception library, which gave me renewed hope. Returning to Interception, I made several attempts, but my lack of programming experience became increasingly apparent.

Despite these setbacks, I haven’t given up. I’m reaching out for help to get this working. Below is the original Null Movement.ahk script in case anyone can assist me in adapting it.

#SingleInstance
#NoEnv
#MaxHotkeysPerInterval 99000000
#HotkeyInterval 99000000
#KeyHistory 0
ListLines Off
Process, Priority, , A


; Null Movement Script
; This updates the A and D keys so that only one is held down at a time
; This avoids the situation where game engines treat holding both strafe keys as not moving
; Insead holding both strafe keys will cause you to move in the direction of the last one that was pressed

a_held := 0 ; Variable that stores the actual keyboard state of the a key
d_held := 0 ; Variable that stores the actual keyboard state of the d key
a_scrip := 0 ; Variable that stores the state of the a key output from the script
d_scrip := 0 ; Variable that stores the state of the d key output from the script

*$a:: ; Every time the a key is pressed, * to include occurences with modifiers (shift, control, alt, etc)
    a_held := 1 ; Track the actual state of the keyboard key
    
    if (d_scrip){ 
        d_scrip := 0
        Send {Blind}{d up} ; Release the d key if it's held down, {Blind} so it includes any key modifiers (shift primarily)
    }
    
    if (!a_scrip){
        a_scrip := 1
        Send {Blind}{a down} ; Send the a down key
    }
    return

*$a up:: ; Every time the a key is released
    a_held := 0
    
    if (a_scrip){
        a_scrip := 0
        Send {Blind}{a up} ; Send the a up key
    }
        
    if (d_held AND !d_scrip){
        d_scrip := 1
        Send {Blind}{d down} ; Send the d down key if it's held
    }
    return

*$d:: ; Every time the d key is pressed
    d_held := 1
    
    if (a_scrip){
        a_scrip := 0
        Send {Blind}{a up}
    }
    
    if (!d_scrip){
        d_scrip := 1
        Send {Blind}{d down}
    }
    return

*$d up:: ; Every time the d key is released
    d_held := 0
    
    if (d_scrip){
        d_scrip := 0
        Send {Blind}{d up}
    }
    
    if (a_held AND !a_scrip){
        a_scrip := 1
        Send {Blind}{a down}
    }
    return

New contributor

vini_seboldp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật