Variable Decreasing Overtime

Get help with using AutoHotkey and its commands and hotkeys
sol_mn
Posts: 1
Joined: 05 Oct 2019, 23:09

Variable Decreasing Overtime

05 Oct 2019, 23:16

I'm trying to make a variable that decreases overtime and resets when left click is not held but I don't know how.
Heres my Script

Code: Select all

#NoEnv ; Cyka
; #Warn ; Blyat
SendMode Input ; Idi
SetWorkingDir %A_ScriptDir% ; Nahui
#NoEnv
SendMode, Input
SetBatchLines -1
CoordMode, Mouse, Screen

mouseXY(x, y){
DllCall("mouse_event",uint,1,int,x,int,y­,uint,0,int,0)
}

strafe(left){
moveCount := 5
sleepInterval := 1
relativeMove := 600
if(left){
key := "a"
move := -relativeMove
} else {
key := "d"
move := relativeMove
}
Send, {Blind}{%key% down}
DllCall("Sleep", "UInt", 5)
Loop, %moveCount% {
mouseXY(move, 0)
DllCall("Sleep", "UInt", sleepInterval)
}
Send, {Blind}{%key% up}
}

*LButton::
while getkeystate("LButton","P") {
strafe(false)
strafe(true)
}
return
~Home::Suspend
return
Esc::ExitApp
[Mod edit: [code][/code] tags added]
User avatar
Micromegas
Posts: 219
Joined: 28 Apr 2015, 23:02
Location: Germany

Re: Variable Decreasing Overtime

06 Oct 2019, 06:13

Have you tried SetTimer?
User avatar
flyingDman
Posts: 784
Joined: 29 Sep 2013, 19:01

Re: Variable Decreasing Overtime

06 Oct 2019, 13:15

Something like this"

Code: Select all

var = 1000000

settimer, lbl, 100
return

lbl:
if !GetKeyState("LButton")
	var = 1000000
else
	var := var - 1
tooltip,%var%
return

esc::
 exitapp

Return to “Ask For Help”

Who is online

Users browsing this forum: CarPiotr, Google [Bot] and 57 guests