12-27-2018, 07:38 PM
Thanks very much for your help but it only works partially. It saves wrong numbers and i dont know why. I already tried to solve it with wait but this doesnt help.
This is the Code im using:
This is the Code im using:
int k ;;killcounter actual match
int c ;; chickendinner counter today
int m ;; match counter
int d ;; death counter
k = 0
c = 0
m = 0
d = 0
1
rep() 0.05;
;; Count Rounds
if (ifk(CS) and ifk(m)) ;; Add +1 to Rounds if Control Shift and m is pressed (wait 0.25s to not count twice on one keypress
wait 0.25
m=m+1
out F"Rounds: {m}"
OnScreenDisplay F"Round {m}"
;; Count Kills
if (ifk(CS) and ifk(k))
wait 0.25
k=k+1
out F"Kills: {k}"
OnScreenDisplay F"Kills {k}"
;; Count Chickendinners
if (ifk(CS) and ifk(c))
wait 0.25
c=c+1
out F"Chickendinners: {c}"
OnScreenDisplay F"Chickendinners {c}"
;; Count Deaths
if (ifk(CS) and ifk(d))
wait 0.25
d=d+1
out F"Deaths: {d}"
OnScreenDisplay F"Deaths: {d}"
;; Reset all Counters with Concrol Shift r
if (ifk(CS) and ifk(r))
wait 0.25
k = 0
c = 0
m = 0
d = 0
OnScreenDisplay "Reset all counters"
ifk(F12) ret ;;end if F12 is pressed
wait 0.25
str sData sFile.expandpath("$documents$\Kills.txt")
int k2(k) c2(c) m2(m) d2(d)
if FileExists(sFile)
sData.getfile(sFile)
ARRAY(str) a
if(findrx(sData "^Matches: (\d+)[]Kills: (\d+)[]Chickendinners: (\d+)[]Deaths: (\d+)[]$" 0 0 a)<0) end "invalid file format"
m2+val(a[1]); k2+val(a[2]); c2+val(a[3]); d2+val(a[4]);
sData=F"Matches: {m2}[]Kills: {k2}[]Chickendinners: {c2}[]Deaths: {d2}[]"
sData.setfile(sFile)
goto 1
break