映射手柄方向键的问题

Post a reply


In an effort to prevent automatic submissions, we require that you complete the following challenge.
Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :| :mrgreen: :geek: :ugeek: :arrow: :angel: :clap: :crazy: :eh: :lolno: :problem: :shh: :shifty: :sick: :silent: :think: :thumbup: :thumbdown: :salute: :wave: :wtf: :yawn: :facepalm: :bravo: :dance: :beard: :morebeard: :xmas: :HeHe: :trollface: :cookie: :rainbow: :monkeysee: :monkeysay: :happybday: :headwall: :offtopic: :superhappy: :terms: :beer:
View more smilies

BBCode is ON
[img] is OFF
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: 映射手柄方向键的问题

映射手柄方向键的问题

Post by reborn » 29 Jun 2020, 20:26

因为dpad没有特定的joykey所以我把他映射到方向键上了,我想请问一下为什么我不能直接映射KeyToHoldDown为我想要的组合键,或者再用方向键去映射组合键也不工作

Code: Select all

#NoEnv
#Persistent
#IfWinActive, ahk_exe anki.exe

SetTimer, WatchPOV, 5
return

WatchPOV:
GetKeyState, POV, JoyPOV
KeyToHoldDownPrev = %KeyToHoldDown%

if POV < 0   ; 没有角度
    KeyToHoldDown =
else if POV > 31500                 ; 315 至 360 度: 向前
    KeyToHoldDown = Up
else if POV between 0 and 4500      ; 0 至 45 度: 向前
    KeyToHoldDown = Up
else if POV between 4501 and 13500  ; 45 至 135 度: 向右
    KeyToHoldDown = Right
else if POV between 13501 and 22500 ; 135 至 225 度: 向下
    KeyToHoldDown = Down
else                                ; 225 到 315 度: 向左
    KeyToHoldDown = Left

if KeyToHoldDown = %KeyToHoldDownPrev%  ; 已经按下了正确的按键 (或者不需要按键).
    return  ; 什么都不做.

;if KeyToHoldDown
;    Send, {%KeyToHoldDown% down}  ; 自动重复的键击.
;return

SetKeyDelay -1  ; 避免键击之间的延迟.
if KeyToHoldDownPrev   ; 要释放之前的按键.
    Send, {%KeyToHoldDownPrev% up}  ; 释放它.
if KeyToHoldDown   ; 要按下按键.
    Send, {%KeyToHoldDown% down}  ; 按下它.
return
    
Joy1::*
Joy2::Space
Joy3::send {@}
Joy4::r
Joy5::Numpad1
Joy6::Numpad2
Joy7::^z
Joy8::Numpad3

Top