I finally got it all working except for one teensy tiny problem.
Code: Select all
vgreen := "Joy1"
vred := "Joy2"
vyellow := "Joy3"
vblue := "Joy4"
vorange := "Joy5"
keys := "Joy1,Joy2,Joy3,Joy4,Joy5,Joy6,Joy7,Joy8,Joy9,Joy10,Joy11,Joy12,Joy13,Joy14,Joy15"
GetKeyPress(keyStr) {
keys := StrSplit(keyStr, ",")
loop
for each, key in keys
if GetKeyState(key)
return key
}
Hotkey, %vgreen%, green, On
Hotkey, %vred%, red, On
Hotkey, %vyellow%, yellow, On
Hotkey, %vblue%, blue, On
Hotkey, %vorange%, orange, On
rebind:
; - green
MsgBox, Press a key for green.
Input := GetKeyPress(Keys)
MsgBox, You pressed %Input%
Hotkey, %vred%, green, Off
Hotkey, %Input%, green, On
; - red
MsgBox, Press a key for red.
Input := GetKeyPress(Keys)
MsgBox, You pressed %Input%
Hotkey, %vgreen%, red, Off
Hotkey, %Input%, red, On
; - yellow
MsgBox, Press a key for yellow.
Input := GetKeyPress(Keys)
MsgBox, You pressed %Input%
Hotkey, %vgreen%, yellow, Off
Hotkey, %Input%, yellow, On
; - blue
MsgBox, Press a key for blue.
Input := GetKeyPress(Keys)
MsgBox, You pressed %Input%
Hotkey, %vgreen%, blue, Off
Hotkey, %Input%, blue, On
; - orange
MsgBox, Press a key for orange.
Input := GetKeyPress(Keys)
MsgBox, You pressed %Input%
Hotkey, %vgreen%, orange, Off
Hotkey, %Input%, orange, On
Gui, Submit, NoHide
return
I am doing a bit of a scuffed method to update the values but blue is the only one that doesn't work, and when I set it to the correct values like vgreen with green and vred with vred it varies on which buttons work. This also happens when I split it into different "rebinds:" as well, so i'm thinking that i'm not updating a value (obviously) correctly cause it has default values that work but doing it correctly makes none of them work. Strange.