Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. import keyboard
  2. import mouse
  3. from threading import Thread
  4. from time import sleep
  5. from sys import exit
  6.  
  7. TA_KEY = 'ctrl+t'
  8. SD_KEY = 'ctrl+y'
  9. UM_KEY = 'ctrl+u'
  10. KK_KEY = 'ctrl+i'
  11.  
  12. globalKillFeed = False
  13.  
  14.  
  15. # Spams the reload key after left clicking to fire
  16. def tank_assist_mode():
  17. global globalKillFeed
  18. # Initialize & start thread
  19. tank_assist_agent_thread = Thread(target=tank_assist_agent)
  20. tank_assist_agent_thread.start()
  21. while True:
  22. # Wait for input
  23. keyboard.read_event()
  24. if keyboard.is_pressed(TA_KEY):
  25. # User has prompted to disable tank mode
  26. globalKillFeed = True
  27. # Thread has completed its run and has rejoined the main thread
  28. tank_assist_agent_thread.join()
  29. globalKillFeed = False
  30. break
  31. elif keyboard.is_pressed(KK_KEY):
  32. # Kill the program
  33. exit()
  34.  
  35.  
  36. # Function spams 'r' key when left mouse button has been pressed. Runs in standalone thread
  37. def tank_assist_agent():
  38. global globalKillFeed
  39. # Runs until globalKillFeed is made false by other thread.
  40. while not globalKillFeed:
  41. print("GKF is still false?")
  42. # Wait until LMB is pressed down
  43. mouse.wait(button='left', target_types='down')
  44. # Double check to make sure GKF hasn't been enabled
  45. if not globalKillFeed:
  46. # LMB has been pressed, spam the reload key 8 times
  47. count = 8
  48. while count != 0:
  49. keyboard.send('r')
  50. sleep(.2)
  51. count -= 1
  52. else:
  53. break
  54.  
  55.  
  56. # Spams right mouse button to empty stockpile inventories. Automatically shifts mouse over to next stack when empty
  57. def stockpile_drain_mode():
  58. # Key combination is "L-Ctrl + U"
  59. pass
  60.  
  61.  
  62. # Holds left mouse button down until its clicked again
  63. def utility_mode():
  64. print("Ayy")
  65. pass
  66.  
  67.  
  68. while True:
  69. # Wait for input
  70. keyboard.read_event()
  71. print("Event detected")
  72. print(keyboard.read_key())
  73. if keyboard.is_pressed(TA_KEY):
  74. print("TA mode active")
  75. # Tank mode selected
  76. tank_assist_mode()
  77. elif keyboard.is_pressed(KK_KEY):
  78. # Kill the program
  79. exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement