forked from ahkscript/AHK-vJoy-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.ahk
44 lines (31 loc) · 834 Bytes
/
example.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
#SingleInstance, force
#include vjoy_lib.ahk
; Set the vjoy id of the stick to control
vjoy_id := 1
; Init the vJoy stick
vjoy_init(vjoy_id)
; Check X axis exists on stick
if (!VJoy_GetAxisExist_X(vjoy_id)){
msgbox Please enable the X axis of vjoy ID %vjoy_id% using the vJoy config utility.
}
; Find out how many buttons we have access to
max_buttons := VJoy_GetVJDButtonNumber(vjoy_id)
; HOTKEYS ===
; Pulse a random Button
F11::
; Decide which button to press
Random, btn, 1, max_buttons
; Press the button
VJoy_SetBtn(1, vjoy_id, btn)
; Wait a while
Sleep 500
; Release the button
VJoy_SetBtn(0, vjoy_id, btn)
Return
; Move the x axis by a random amount
F12::
; Pick a number between 0 and 32767 and store it in val
Random, val, 0, 32767
; Set axis value
VJoy_SetAxis(val, vjoy_id, HID_USAGE_X)
return