dustyroo

Untitled

Apr 4th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.63 KB | None | 0 0
  1. from time import sleep
  2. from random import uniform, randint
  3. from pyautogui import pixelMatchesColor, keyDown, keyUp, moveRel, position, click, press
  4.  
  5. fail_safe = 0
  6. shut_down = 0
  7. on_off = 0
  8. click_one = 1
  9. click_two = 1
  10. move_one = 1
  11.  
  12. def look(): #trys to see if a pixel im looking at is one of the 4 colors, moves my mouse x amount on what one it sees.
  13.     first_cord, second_cord = position()  
  14.     find_look_left_1 = pixelMatchesColor(first_cord, second_cord, (95, 95, 0), tolerance=20)
  15.     find_look_left_2 = pixelMatchesColor(first_cord, second_cord, (148, 148, 0), tolerance=30)
  16.     find_look_right_1 = pixelMatchesColor(first_cord, second_cord, (0, 89, 0), tolerance=30)
  17.     find_look_right_2 = pixelMatchesColor(first_cord, second_cord, (0, 45, 0), tolerance=30)
  18.     find_look_hard_left_1 = pixelMatchesColor(first_cord, second_cord, (46, 0, 93), tolerance=20)
  19.     find_look_hard_left_2 = pixelMatchesColor(first_cord, second_cord, (36, 0, 72), tolerance=20)
  20.     find_look_hard_right_1 = pixelMatchesColor(first_cord, second_cord, (178, 89, 0), tolerance=20)
  21.     find_look_hard_right_2 = pixelMatchesColor(first_cord, second_cord, (197, 98, 0), tolerance=20)
  22.  
  23.     if find_look_left_1 or find_look_left_2:
  24.         moveRel(-50,0, duration=0.17)
  25.     elif find_look_right_1 or find_look_right_2:
  26.         moveRel(40,0, duration=0.17)
  27.     elif find_look_hard_left_1 or find_look_hard_left_2:
  28.         moveRel(-110,0, duration=0.17)
  29.     elif find_look_hard_right_1 or find_look_hard_right_2:
  30.         moveRel(110,0, duration=0.17)
  31.     else:
  32.         return
  33.  
  34. def attack(): #trys to see if a pixel im looking attack has moves my mouse a lot or little of my mouse while clicking.
  35.     global click_one
  36.     global click_two
  37.     look_chance = 60#%
  38.     first_cord, second_cord = position()  
  39.     attack_1 = pixelMatchesColor(first_cord, second_cord, (186, 112, 186), tolerance=20)
  40.     attack_2 = pixelMatchesColor(first_cord, second_cord, (135, 81, 135), tolerance=30)
  41.  
  42.     if attack_1 or attack_2:
  43.         chance = randint(1, 100)
  44.         if chance <= look_chance:
  45.             #print('Hit Chance ='+ str(chance))
  46.             if click_two == 1: #look main
  47.                 click()
  48.                 moveRel(3,2, duration=0.1)
  49.                 click_two = 2
  50.             else:
  51.                 if click_two == 2: #look back
  52.                     click()
  53.                     moveRel(-3,-2, duration=0.1)
  54.                     click_two = 1
  55.         elif click_one == 1: #big look main
  56.             click()
  57.             moveRel(-40,3, duration=0.17)
  58.             click_one = 2
  59.         else:
  60.             if click_one == 2: #big look back
  61.                 click()
  62.                 moveRel(40,-3, duration=0.17)
  63.                 click_one = 1
  64.     else:
  65.         return
  66.  
  67. def move(): #trys to see if a pixel im looking at then has moves from side to side.
  68.     global move_one
  69.     move_chance = 50#%
  70.     first_cord, second_cord = position()  
  71.     find_move_1 = pixelMatchesColor(first_cord, second_cord, (169, 56, 93), tolerance=20)
  72.     find_move_2 = pixelMatchesColor(first_cord, second_cord, (90, 18, 90), tolerance=30)
  73.     find_move_3 = pixelMatchesColor(first_cord, second_cord, (203, 76, 127), tolerance=20)
  74.  
  75.     if find_move_1 or find_move_2 or find_move_3:
  76.         chance = randint(1, 100)
  77.         time_to_wait = uniform(0.12, 0.16)
  78.         if chance <= move_chance:
  79.             #print('Move Chance ='+ str(chance))
  80.             if move_one == 1: #main move
  81.                 keyDown('a')
  82.                 press('backspace')
  83.                 sleep(time_to_wait)
  84.                 keyUp('a')
  85.                 move_one = 2
  86.             elif move_one == 2:#move back
  87.                 keyDown('d')
  88.                 press('backspace')
  89.                 sleep(time_to_wait)
  90.                 keyUp('d')
  91.                 move_one = 1
  92.     else:
  93.         return
  94.  
  95. while fail_safe == 0:
  96.     shut_down += 1
  97.     print(shut_down)
  98.     if shut_down > 669:
  99.         fail_safe = 1
  100.     first_cord, second_cord = position()
  101.     #trys to see if a pixel im looking at is bad and stops it.
  102.     bad_pixel = pixelMatchesColor(first_cord, second_cord, (0, 0, 0), tolerance=20)
  103.     if bad_pixel:
  104.         fail_safe = 1
  105.         print('SS!')
  106.     #trys to see if a pixel im looking at then toggles on and off.
  107.     toggler = pixelMatchesColor(first_cord, second_cord, (37, 0, 18), tolerance=10)
  108.     if toggler:
  109.         if on_off == 0:
  110.             on_off = 1
  111.             print('Script toggled OFF!')
  112.             sleep(2)
  113.         elif on_off == 1:
  114.             on_off = 0
  115.             print('Script toggled back ON!')
  116.             sleep(2)
  117.     if on_off == 0:
  118.         look()
  119.         attack()
  120.         move()
Advertisement
Add Comment
Please, Sign In to add comment