lostark.sikuli 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. from time import strftime
  2. import random
  3. running = True
  4. def runHotkey(event):
  5. global running
  6. running = False
  7. Env.addHotkey(Key.F1, KeyModifier.CTRL, runHotkey)
  8. nw=switchApp('LOST ARK')
  9. print('Starting')
  10. #L=Screen(0).getBounds()
  11. #xmid=int(L.width / 2)
  12. #ymid=int(L.height / 2)
  13. Settings.MoveMouseDelay=2
  14. mouseMove()
  15. randmousedelay=5
  16. randmouse=random.randint(0,randmousedelay)
  17. attmouse = 0
  18. while nw.isRunning() and running:
  19. mouseloc = Env.getMouseLocation()
  20. print(strftime('%Y%m%d_%H%M%S ')+'Mouse is '+str(mouseloc))
  21. attmouse += 1
  22. if attmouse > randmouse:
  23. randmouse=random.randint(1,randmousedelay)
  24. movemousespeed=float(random.randint(5,20)) / 10
  25. Settings.MoveMouseDelay = movemousespeed
  26. mouseloc = Env.getMouseLocation()
  27. xs = random.randint(0,1)
  28. ys = random.randint(0,1)
  29. xmod=1
  30. ymod=1
  31. if xs==0:
  32. xmod = -1
  33. if ys==0:
  34. ymod = -1
  35. x=random.randint(50,100)*xmod
  36. y=random.randint(25,30)*ymod
  37. newmouseloc=mouseloc.offset(x,y)
  38. print(strftime('%Y%m%d_%H%M%S ')+'Moving mouse from '+str(mouseloc)+' to '+str(newmouseloc)+' in '+str(movemousespeed)+'s')
  39. # mouseMove(newmouseloc)
  40. rightClick(newmouseloc)
  41. attmouse=0
  42. mouseMove()
  43. wait(1)