From 15b7cb75e506d4983446d5be5cbfcf539bbbcd8f Mon Sep 17 00:00:00 2001 From: notwa Date: Mon, 25 Feb 2013 15:04:51 +0000 Subject: [PATCH] --- gistfile1.ahk | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 gistfile1.ahk diff --git a/gistfile1.ahk b/gistfile1.ahk new file mode 100644 index 0000000..2ce32ce --- /dev/null +++ b/gistfile1.ahk @@ -0,0 +1,64 @@ +#Persistent +#SingleInstance Force +Send {w up} +Send {a up} +Send {s up} +Send {d up} + +Deadzone := 0.6 +SetTimer Wax, 5 +return + +Wax: +GetKeyState JoyX, JoyX +GetKeyState JoyY, JoyY +JoyX := (JoyX - 50)/50 +JoyY := (JoyY - 50)/50 +Angle := ATan(JoyX/JoyY)*2/3.14159 +Angle := (JoyY > 0) ? Angle + 3: Angle + 1 +Length := Sqrt(JoyX**2 + JoyY**2) +; 1 1 0 +; 2 - 0 +; 2 3 3 + +OldX = %HoldX% +OldY = %HoldY% + +if Length > %Deadzone% +{ + if % Angle >= 1.2 && Angle < 2.7 + HoldX = a + else if % Angle >= 3.2 || Angle < 0.7 + HoldX = d + else + HoldX = + if % Angle >= 0.3 && Angle < 1.7 + HoldY = w + else if % Angle >= 2.3 && Angle < 3.7 + HoldY = s + else + HoldY = +} else +{ + HoldX = + HoldY = +} + +SetKeyDelay -1 +if OldX != %HoldX% +{ + if HoldX + Send {%HoldX% down} + if OldX + Send {%OldX% up} +} +if OldY != %HoldY% +{ + if HoldY + Send {%HoldY% down} + if OldY + Send {%OldY% up} +} +return + +F10::ExitApp \ No newline at end of file