Advertisement
kazmadan

merchantbot

Jun 10th, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. #MaxThreadsPerHotkey 7
  2.  
  3.  
  4. ^r::Reload
  5. Pause::Reload
  6. F5:: ;Hotkey to start
  7.  
  8. if D3farm ; This means an underlying thread is already running the loop below.
  9. {
  10. D3farm := false ; Signal that thread's loop to stop.
  11. return ; End this thread so that the one underneath will resume and see the change made by the line above.
  12. }
  13. ; Otherwise:
  14. D3farm := true
  15.  
  16. Loop ;main loop
  17. {
  18.  
  19.  
  20. ;ResumeSearch() ;clicking resume game
  21.  
  22.  
  23. LoadWait() ;waiting till after load screen
  24.  
  25. MouseClick, right, 1668, 1049 ;blink
  26. Sleep, 500
  27. MouseClick, left, 975, 948 ;walk
  28. Sleep, 1200
  29. MouseClick, left, 1115, 944 ;walk
  30. Sleep, 1200
  31. MouseClick, left, 1106, 795 ;walk
  32. Sleep, 1000
  33. MouseClick, left, 1072, 592 ;talk to merchant
  34. RandomSleep(1000,1500)
  35. MouseClick, left, 513, 482 ;click on rings tab
  36. RandomSleep(500,1000)
  37. MouseMove, 377, 314 ;hover ammy 1
  38. ItemSearch() ;look for item
  39. MouseMove, 159, 315 ;hover ammy 2
  40. ItemSearch() ;look for item
  41. RandomSleep(100,500)
  42. Send, {V}
  43. RandomSleep(200,600)
  44. Send, {ESC}
  45.  
  46. ;LeaveGame() ;click Leave Game
  47.  
  48. if not D3farm ;
  49. break ;
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. }
  59. D3farm := false ; Reset in preparation for the next press of this hotkey.
  60. return
  61.  
  62. ^p::Pause
  63. ResumeSearch()
  64. {
  65. Loop ;looking for Resume
  66. {
  67. Imagesearch, x,y,%x%,%y%,%a_screenwidth%,%a_screenheight%, *40 %a_desktop%/D3farm/img/Resume.png
  68. Imagesearch, x,y,31,350,464,485, *40 %a_desktop%/D3farm/img/Resume.png
  69. If Errorlevel = 0
  70. {
  71. RandomSleep(200,1000)
  72. MouseClick, Left, X+6, Y+6
  73. Break
  74. }
  75. }
  76. }
  77.  
  78. LoadWait()
  79. {
  80.  
  81. Loop ;Waiting till loaded
  82. {
  83. Imagesearch, x,y,623, 879,745, 972, *40 %a_desktop%/D3farm/img/Inn.png
  84. If Errorlevel = 0
  85. {
  86. RandomSleep(200,1000)
  87. Break
  88. }
  89. }
  90.  
  91. }
  92.  
  93. LeaveGame()
  94. {
  95.  
  96. Loop
  97. {
  98. Imagesearch, x,y,767,496,1143,684, *40 %a_desktop%/D3farm/img/LeaveGame.png ;looking for Leave Game button
  99. If Errorlevel = 0
  100. {
  101. RandomSleep(200,600)
  102. MouseClick, Left, X+6, Y+6 ;clicking Leave Game
  103. Break
  104. }
  105. }
  106.  
  107. }
  108.  
  109. RandomSleep(min,max)
  110. {
  111. Random, random, %min%, %max%
  112. Sleep %random%
  113. }
  114.  
  115.  
  116. ItemSearch()
  117. {
  118.  
  119. Loop, 7 ;Waiting till loaded
  120. {
  121. Imagesearch, x,y,%x%,%y%,1454, 443, *60 %a_desktop%/D3farm/img/TestItem.png
  122. If Errorlevel = 0
  123. {
  124. Send, {PrintScreen}
  125. RandomSleep(1000,2000)
  126. Send, {V}
  127. Idle()
  128. ;Break
  129. }
  130. }
  131.  
  132. }
  133.  
  134. Idle()
  135. {
  136. Loop
  137. {
  138. RandomSleep(5000,10000)
  139. Send 4
  140. }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement