Created
March 27, 2017 18:12
-
-
Save Der-Eddy/998134705b4b4cf57388f92facefb93f to your computer and use it in GitHub Desktop.
OBS Death Counter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import keyboard #https://github.com/boppreh/keyboard | |
import time | |
import sys | |
import os | |
counter = 0 | |
prefixCounter = 'Death Count:' | |
file = os.path.join(sys.path[0], 'count.txt') | |
def addCounter(): | |
global counter | |
counter += 1 | |
writeCounter() | |
def decCounter(): | |
global counter | |
counter -= 1 | |
writeCounter() | |
def writeCounter(): | |
print(f'{prefixCounter} {counter}') | |
with open(file, 'w') as f: | |
f.write(f'{prefixCounter} {counter}') | |
def kill(): | |
sys.exit(1) | |
keyboard.add_hotkey(67, addCounter) #F8 | |
keyboard.add_hotkey(68, decCounter) #F9 | |
keyboard.add_hotkey(1, kill) #ESC | |
writeCounter() | |
while True: | |
time.sleep(1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment