Skip to content

Instantly share code, notes, and snippets.

@yeahunter
Created September 6, 2016 17:01
Show Gist options
  • Select an option

  • Save yeahunter/52de109ee559861812f2e07639517e5c to your computer and use it in GitHub Desktop.

Select an option

Save yeahunter/52de109ee559861812f2e07639517e5c to your computer and use it in GitHub Desktop.
DEATHCOUNTER
;Enter your TXT file path .
filePath = E:\Users\Peti\Stream\AHK\deaths.txt
FileReadLine, deathVar, %filePath%, 1
;When you press F12 it will increment and update the death counter in the .txt
F12::
;Creates txt file if it doesn't exist.
IfNotExist, %filePath%
FileAppend,0, %filePath%
;Created a file.
;Inputs number of deaths in deathVar variable.
FileReadLine, deathVar, %filePath%, 1
Var := ++deathVar
FileDelete, %filePath%
FileAppend,%deathVar%, %filePath%
return
;When you press F11 it will decrement and update the death counter in the .txt
F11::
;Creates txt file if it doesn't exist.
IfNotExist, %filePath%
FileAppend,0, %filePath%
;Created a file.
;Inputs number of deaths in deathVar variable.
FileReadLine, deathVar, %filePath%, 1
if deathVar = 0
return
Var := --deathVar
FileDelete, %filePath%
FileAppend,%deathVar%, %filePath%
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment