Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Gaming Help (v1) • Limiting a certain key press

$
0
0
Hello! I need help in creating a script that limits how often !s can be activated. I drew a pictureImage
If possible,

This is beyond my capabilities. Could you show me your solution? Thank you!

I posted the code in question below. Please let me know if you need more info.


CODE:

macro14 := []
macro14.push({key:"1",delay:40})
macro14.push({key:"s",delay:40})
macro14.push({key:"2",delay:40})
macro14.push({key:"s"})

!s Up::
ProcessMacro((m14 := !m14) ? macro14 : reverse(macro14))
return

ProcessMacro(macro) { ;a custom function to process special macro arrays
static lastIdle
lastIdle := A_TimeIdleKeyboard
for k,v in macro
{
if (v.mouse) { ;if this key event is a mouse event
mouseButton := v.mouse
if (v.x and v.y) {
x := v.x, y := v.y
click,%mouseButton%,%x%,%y% ;if this key event has x and y coordinates then use them
} else {
click,% mouseButton ;if it doesn't just click where the mouse is
}
} else {
send % v.key
}
sleep % v.delay
if (A_TimeIdleKeyboard < lastIdle) {
break
}
lastIdle := A_TimeIdleKeyboard
}
return
}

Statistics: Posted by gyrosav — 44 minutes ago



Viewing all articles
Browse latest Browse all 579

Trending Articles