Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import keyboard
- import mouse
- from threading import Thread
- from time import sleep
- from sys import exit
- TA_KEY = 'ctrl+t'
- SD_KEY = 'ctrl+y'
- UM_KEY = 'ctrl+u'
- KK_KEY = 'ctrl+i'
- globalKillFeed = False
- # Spams the reload key after left clicking to fire
- def tank_assist_mode():
- global globalKillFeed
- # Initialize & start thread
- tank_assist_agent_thread = Thread(target=tank_assist_agent)
- tank_assist_agent_thread.start()
- while True:
- # Wait for input
- keyboard.read_event()
- if keyboard.is_pressed(TA_KEY):
- # User has prompted to disable tank mode
- globalKillFeed = True
- # Thread has completed its run and has rejoined the main thread
- tank_assist_agent_thread.join()
- globalKillFeed = False
- break
- elif keyboard.is_pressed(KK_KEY):
- # Kill the program
- exit()
- # Function spams 'r' key when left mouse button has been pressed. Runs in standalone thread
- def tank_assist_agent():
- global globalKillFeed
- # Runs until globalKillFeed is made false by other thread.
- while not globalKillFeed:
- print("GKF is still false?")
- # Wait until LMB is pressed down
- mouse.wait(button='left', target_types='down')
- # Double check to make sure GKF hasn't been enabled
- if not globalKillFeed:
- # LMB has been pressed, spam the reload key 8 times
- count = 8
- while count != 0:
- keyboard.send('r')
- sleep(.2)
- count -= 1
- else:
- break
- # Spams right mouse button to empty stockpile inventories. Automatically shifts mouse over to next stack when empty
- def stockpile_drain_mode():
- # Key combination is "L-Ctrl + U"
- pass
- # Holds left mouse button down until its clicked again
- def utility_mode():
- print("Ayy")
- pass
- while True:
- # Wait for input
- keyboard.read_event()
- print("Event detected")
- print(keyboard.read_key())
- if keyboard.is_pressed(TA_KEY):
- print("TA mode active")
- # Tank mode selected
- tank_assist_mode()
- elif keyboard.is_pressed(KK_KEY):
- # Kill the program
- exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement