-
Notifications
You must be signed in to change notification settings - Fork 1
/
Crysis_.ahk
885 lines (777 loc) · 12.6 KB
/
Crysis_.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
#SingleInstance force
#Persistent ; Keep this script running until the user explicitly exits it.
#Warn ; Enable warnings to assist with detecting common errors.
Layer := 1 ; To initialise my 3 layer keymap.
; Crounch and Prone to deal with toggle.
Crounch := 0
Prone := 0
SetCapsLockState, AlwaysOff
SetScrollLockState, AlwaysOff
Process, Priority, , A
;#InstallKeybdHook
;#InstallMouseHookccccccccccccccccccccccccccccccccccccccccccc
{ ;Monitoring Windows
BlockInput, On
KeyHistory
WinGetActiveTitle, Title
WinWait, %Title%
SetKeyDelay 0, 32
Send {Lwin down}{Right}{Right}{Right}{Right}{Lwin up}{LControl down}{k}{LControl Up}
;sleep 32
#IfWinExist Event Tester
{
WinClose Event Tester
Run, C:\Program Files (x86)\Thrustmaster\TARGET\Tools\EventTester.exe
WinWait, Event Tester
SetKeyDelay 0, 32
Send {Lwin down}{Right}{Right}{Lwin up}{esc}{esc}{esc}{esc}
Sleep 32
MouseClick, left, 36, 40
MouseClick, left, 104, 62
BlockInput, Off
return
}
#IfWinExist
#If WinActive("Event Tester") || WinActive("AHK Studio - C:\Users\hon0_Corsair\Documents\GitHub\AutoHotKey_Script\AutoHotKey_Script.ahk")
{
$F5::
WinActivate %Title%
SetKeyDelay 2000, 32
Send {F5}
return
}
#IfWinActive
}
{ ;Before running a Game. Run and/or close Program.
#F1::Suspend, Toggle
#F4::ExitApp
#t::
{
If !WinExist("MSI Afterburner")
{
Run, C:\Program Files (x86)\MSI Afterburner\MSIAfterburner.exe
WinWait MSI Afterburner
MsgBox Rat Pro S profile Crysis.
MsgBox Razer Orbweaver Profile AHK_Crysis.
}
Else If !WinExist("Set Timer Resolution")
{
Run, D:\- Téléchargements sur D\TimerResolution.exe
WinWait Set Timer Resolution
WinMinimize Set Timer Resolution
WinWait MSI Afterburner
}
Else if WinExist("MSI Afterburner") || WinExist("Set Timer Resolution")
{
WinActivate, MSI Afterburner
WinActivate, Set Timer Resolution
}
return
}
} ;Before running a Game. Run and/or close Program.
;Testing
/*
m::
Send o
if (A_PriorKey = "space")
SendInput {p}
return
*/
/* ;Testing
{
#If InGame = 0
#g::
InGame :=1
return
#If InGame = 1
#g::
InGame :=0
return
#If
^#g::MsgBox %InGame%
return
}
*/
/* ;Layer checker
z::
ToolTip %Layer%
SetTimer, RemoveToolTip, 2000
return
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return
*/
{ ; Layer modifier
CapsLock:: ;Key disabled by "SetCapsLockState, AlwaysOff".
Layer := 2
if (A_ThisHotkey = A_PriorHotkey && A_TimeSincePriorHotkey < 200)
Layer := 3
KeyWait, CapsLock
Layer := 1
Return
}
{ #if Layer = 1
{ ; Global remapping
z::z
s::s
q::q
d::d
{ ; w ;*[Crysis_]
w::
If Prone = 1
{
SendInput w
Prone := 0
}
else if Crounch = 1
{
sendinput {space}{w}
Crounch := 0
Prone := 1
}
Else if Prone = 0
{
SendInput w
Prone := 1
}
return
}
{ ; Space
~Space::
Prone := 0
If (Prone = 1)
Crounch := 1
Else If Crounch = 1
Crounch := 0
return
}
{ ; Down
$Down::
If Prone = 1
{
sendinput {w}{Down}
Prone := 0
Crounch := 1
}
Else
{
send {down}
Crounch := 1
}
return
}
{ ; v
$v::
KeyWait v, t0.100
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {Numpad7 down}
KeyWait v
SendInput {Numpad7 Up}
}
else
{
SendInput {v down}
sleep 32
SendInput {v Up}
}
return
}
/*
esc::
KeyWait esc, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {esc down}
KeyWait esc
SendInput {esc up}
}
else
{
SendInput {i down}
sleep 32
SendInput {i Up}
}
return
*/
{ ; Nuopad 5
Numpad5::
{
BlockInput, On
SendInput {Numpad2 Down}
;SendInput {Numpad5}{Numpad5}
MouseMove, 400, -150 , 2, R
SendInput {Numpad2 Up}
BlockInput, Off
return
}
}
{ ; XButton1
~XButton1::
KeyWait XButton1, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {Backspace down}
KeyWait XButton1
SendInput {Backspace up}
}
else
{
SendInput i
}
return
}
{ ; Xbutton2
~XButton2::
/*
KeyWait XButton2, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {Numpad7 down}
KeyWait XButton2
SendInput {Numpad7 up}
}
else
*/
{
BlockInput, On
SendInput {Numpad2 Down}
;SendInput {Numpad5}{Numpad5}
MouseMove, 0, -400 , 2, R
SendInput {Numpad2 Up}
BlockInput, Off
sendinput {XButton2}
}
return
}
}
{ ; Mouse Wheel Layer 1
{ ; WheelUp
~WheelUp::
SetkeyDelay, 0, 32
If GetKeyState("MButton")
send {Home}
;Else
; If (GetKeyState("6Joy1")==1)
; send g
Return
}
{ ; WheelDown
~WheelDown::
SetkeyDelay, 0, 32
If GetKeyState("MButton")
send {End}
;Else
; If GetKeyState("Space")
; send {End}
Return
}
}
{ ; All Layer 1 Digit remapping Layer 1 Short/Long, Layer 2 Short/Long, Layer 3 Short/Long
$SC002:: ;[1, F1], [7, F7], [F13, F19]
KeyWait SC002, t0.200&
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F1 down}
KeyWait SC002
SendInput {F1 up}
}
else
{
SendInput {SC002 down}
sleep 32
KeyWait SC002
SendInput {SC002 up}
}
return
$SC003:: ;[2, F2], [8, F8], [F14, F20]
KeyWait SC003, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F2 down}
KeyWait SC003
SendInput {F2 up}
}
else
{
SendInput {SC003 down}
sleep 32
KeyWait SC003
SendInput {SC003 up}
}
return
$SC004:: ;[3, F3], [9, F9], [F15, F21]
KeyWait SC004, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F3 down}
KeyWait SC004
SendInput {F3 up}
}
else
{
SendInput {SC004 down}
sleep 32
KeyWait SC004
SendInput {SC004 up}
}
return
$SC005:: ;[4, F4], [10, F10], [F16, F22]
KeyWait SC005, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F4 down}
KeyWait SC005
SendInput {F4 up}
}
else
{
SendInput {SC005 down}
sleep 32
KeyWait SC005
SendInput {SC005 up}
}
return
$SC006::
{
BlockInput, On
SendInput {Numpad2 Down}
;SendInput {Numpad5}{Numpad5}
MouseMove, -400, -150 , 2, R
SendInput {Numpad2 Up}
BlockInput, Off
}
return
/*
$SC006:: ;[5, F5], [11, F11], [F17, F23]
KeyWait SC006, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F5 down}
KeyWait SC006
SendInput {F5 up}
}
else
{
BlockInput, On
SendInput {Numpad2 Down}
;SendInput {Numpad5}{Numpad5}
MouseMove, -400, -150 , 2, R
SendInput {Numpad2 Up}
BlockInput, Off
}
return
*/
$SC007::
{
BlockInput, On
SendInput {Numpad2 Down}
;SendInput {Numpad5}{Numpad5}
MouseMove, 400, 150 , 2, R
SendInput {Numpad2 Up}
BlockInput, Off
}
return
/*
$SC007:: ;[6, F6], [12, F12], [F18, F24]
KeyWait SC007, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F6 down}
KeyWait SC007
SendInput {F6 up}
}
else
{
BlockInput, On
SendInput {Numpad2 Down}
;SendInput {Numpad5}{Numpad5}
MouseMove, 400, 150 , 2, R
SendInput {Numpad2 Up}
BlockInput, Off
}
return
*/
}
#If ; End of "If Layer = 1".
}
{ #if Layer = 2
{ ; Global remapping
;#IfWinActive EscapeFromTarkov
LButton::F1
RButton::F2
XButton1::F3
XButton2::F4
tab::!l
w::b
x::i
c::,
v::Del
F8::F9
F9::F10
;#IfWinActive
}
{ ; Mouse Wheel Layer 2
~WheelUp::
SetkeyDelay, 0, 32
send {PgUp}
Return
~WheelDown::
SetkeyDelay, 0, 32
send {PgDn}
Return
}
{ ;All Layer 2 Digit remapping Layer 1 Short/Long, Layer 2 Short/Long, Layer 3 Short/Long
$SC002:: ;[1, F1], [7, F7], [F13, F19]
KeyWait SC002, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F7 down}
KeyWait SC002
SendInput {F7 up}
}
else
{
SendInput {SC008 down}
sleep 32
KeyWait SC002
SendInput {SC008 up}
}
return
$SC003:: ;[2, F2], [8, F8], [F14, F20]
KeyWait SC003, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F8 down}
KeyWait SC003
SendInput {F8 up}
}
else
{
SendInput {SC009 down}
sleep 32
KeyWait SC003
SendInput {SC009 up}
}
return
$SC004:: ;[3, F3], [9, F9], [F15, F21]
KeyWait SC004, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F9 down}
KeyWait SC004
SendInput {F9 up}
}
else
{
SendInput {SC00A down}
sleep 32
KeyWait SC004
SendInput {SC00A up}
}
return
$SC005:: ;[4, F4], [10, F10], [F16, F22]
KeyWait SC005, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F10 down}
KeyWait SC005
SendInput {F10 up}
}
else
{
SendInput {SC00B down}
sleep 32
KeyWait SC005
SendInput {SC00B up}
}
return
$SC006:: ;[5, F5], [11, F11], [F17, F23]
KeyWait SC006, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F11 down}
KeyWait SC006
SendInput {F11 up}
}
else
{
SendInput {SC00C down}
sleep 32
KeyWait SC006
SendInput {SC00C up}
}
return
$SC007:: ;[6, F6], [12, F12], [F18, F24]
KeyWait SC007, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F12 down}
KeyWait SC007
SendInput {F12 up}
}
else
{
SendInput {SC00D down}
sleep 32
KeyWait SC007
SendInput {SC00D up}
}
return
}
{ ;Layer 2 "f" remapping
$f::
KeyWait f, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {h down}
KeyWait f
SendInput {h up}
}
else
{
SendInput {g down}
sleep 32
SendInput {g up}
}
return
}
{ ;Layer 2 "r" remapping
$r::
KeyWait r, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {y down}
KeyWait r
SendInput {y up}
}
else
{
SendInput {t down}
sleep 32
SendInput {t up}
}
return
}
#If ; End of "If Layer = 2".
}
{ #if Layer = 3
{ ; Global remapping
;#IfWinActive EscapeFromTarkov
LButton::F1
RButton::F2
XButton1::F3
XButton2::F4
tab::AppsKey
w::Numpad0
x::Numpad1
c::Numpad2
v::Numpad3
;r::y
;f::h
F8::F9
F9::F10
;#IfWinActive
}
{ ; Mouse Wheel Layer 3
SetkeyDelay, 0, 32
If GetKeyState("MButton")
send {PGUP}
else
send {Insert}
;Else
; If (GetKeyState("6Joy1")==1)
; send g
Return
~WheelDown::
SetkeyDelay, 0, 32
If GetKeyState("MButton")
send {PGDN}
Else
send {Del}
;Else
; If GetKeyState("Space")
; send {End}
Return
}
{ ;All Layer 3 Digit remapping Layer 1 Short/Long, Layer 2 Short/Long, Layer 3 Short/Long
$SC002:: ;[1, F1], [7, F7], [F13, F19]
KeyWait SC002, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F19 down}
KeyWait SC002
SendInput {F19 up}
}
else
{
SendInput {F13 down}
sleep 32
KeyWait SC002
SendInput {F13 up}
}
return
$SC003:: ;[2, F2], [8, F8], [F14, F20]
KeyWait SC003, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F20 down}
KeyWait SC003
SendInput {F20 up}
}
else
{
SendInput {F14 down}
sleep 32
KeyWait SC003
SendInput {F14 up}
}
return
$SC004:: ;[3, F3], [9, F9], [F15, F21]
KeyWait SC004, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F21 down}
KeyWait SC004
SendInput {F21 up}
}
else
{
SendInput {F15 down}
sleep 32
KeyWait SC004
SendInput {F15 up}
}
return
$SC005:: ;[4, F4], [10, F10], [F16, F22]
KeyWait SC005, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F22 down}
KeyWait SC005
SendInput {F22 up}
}
else
{
SendInput {F16 down}
sleep 32
KeyWait SC005
SendInput {F16 up}
}
return
$SC006:: ;[5, F5], [11, F11], [F17, F23]
KeyWait SC006, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F23 down}
KeyWait SC006
SendInput {F23 up}
}
else
{
SendInput {F17 down}
sleep 32
KeyWait SC006
SendInput {F17 up}
}
return
$SC007:: ;[6, F6], [12, F12], [F18, F24]
KeyWait SC007, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {F24 down}
KeyWait SC007
SendInput {F24 up}
}
else
{
SendInput {F18 down}
sleep 32
KeyWait SC007
SendInput {F18 up}
}
return
}
{ ;Layer 3 "f" remapping
$f::
KeyWait f, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {k down}
KeyWait f
SendInput {k up}
}
else
{
SendInput {j down}
sleep 32
SendInput {j up}
}
return
}
{ ;Layer 3 "r" remapping
$r::
KeyWait r, t0.200
t:= A_TimeSinceThisHotkey
If ErrorLevel
{
SendInput {i down}
KeyWait r
SendInput {i up}
}
else
{
SendInput {u down}
sleep 32
SendInput {u up}
}
return
}
#If ; End of "If Layer = 3".
}
{ ;HotStrings
::ahk::AutoHotKey
::viei@::[email protected]
}
#g::
MouseGetPos, xpos, ypos
MsgBox, The cursor is at X%xpos% Y%ypos%.
return
#s::
MouseClick, left, 36, 40
MouseClick, left, 104, 62
return
#x::
MouseMove, 50, -50 , 10, R ;moves the mouse in a box
MouseMove, -100, 0 , 10, R ;around it's starting position
MouseMove, 0, 100 , 10, R
MouseMove, 100, 0 , 10, R
MouseMove, 0, -100 , 10, R
MouseMove, -50, 50 , 10, R
return