For context-sensitive hotkeys, use #-directives:
Code: Select all
MButton::
Toggle := !Toggle
if Toggle
SetMouseDelay, 250
else
SetMouseDelay, 10 ; reset to default
return
#if toggle ; context-sensisitive hotkeys start here
WheelUp::MouseClick, Left,,,1
WheelDown::MouseClick, Left,,,1
#if ; turn off context-sensitivity
For randomization, you could use the
Random command. Are you trying to to do this?
Code: Select all
MButton::
Toggle := !Toggle
if Toggle
{
Random, ms , 150, 250 ; create number between 150 and 250
SetMouseDelay, % ms
}
else
SetMouseDelay, 10 ; set to default
return
I have no experience in automating games and no idea if
SetMouseDelay is the right kind of approach here. It might be better to modify
Wheelup and
Wheeldown to multiline hotkeys and add a
Sleep instead - but it is just a guess:
Code: Select all
MButton::
Toggle := !Toggle
Return
#if Toggle
WheelUp:: ; you can stack hotkeys that should do the same
WheelDown::
MouseClick, Left,,,1
Random, ms , 150, 250 ; create number between 150 and 250
Sleep % ms
Return
#if
I am sure, our gaming experts can tell you the best way to go.