Hey all. I started a Minecraft script today to do 3 common things that hurt my fingers:
- Hold down left click continuously
- Double tap W, and during the second tap, keep holding it continuously
- Rapid spam left click
Thanks to some googling, I got the first case working. I am stuck on the second and third case though. Can you guys take a look and suggest code improvements?
; Mine - Holds down left click until F8 is pressed again F8:: Send % "{Click " . ( GetKeyState("LButton") ? "Up}" : "Down}" ) return ; Sprint - Double tap W, not releasing the W key, until F9 is pressed again ; TODO: this script works for walking (single tap) but not running (double tap). maybe the timing is off? F9:: send w send {w down} return ; Attack - Spams left click rapidly until F12 is pressed again ; TODO: get this to work F12:: return
In fact, I don't even like that first code too much. I'd rather expand it out and make it more readable so that I know how it works and I can eventually become fluent in this language.
What is the best way to do a toggle key? Should I set a variable to track if F8, F9, and F12 are on their first or second press, then have a conditional? Should I use a getState function like this guy did with his F8 code? If you guys could demonstrate your style for coding toggle keys that'd be awesome.
Thanks in advance for your help.