Guest User

ahk afk SC

a guest
May 20th, 2020
1,166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Gui, Add, Tab2, x2 y-1 w480 h380 , Sand Crab|Misc
  2. Gui, Add, CheckBox, x22 y59 w120 h20 vareyoueating gareyoueatingthough, Eat?
  3. Gui, Add, ListBox, x362 y49 w60 h70 vlistfoodcolor, ; in progress
  4. Gui, Add, Button, x362 y29 w100 h20 vsetcolors gsetfoodcolor, Set Food Colors
  5. Gui, Add, GroupBox, x12 y39 w210 h130 , Food
  6. Gui, Add, Radio, x42 y89 w100 h20 veatoptionbank , Bank
  7. Gui, Add, Radio, x42 y119 w100 h20 veatoptionLogout , Logout / Alert
  8. Gui, Add, CheckBox, x12 y179 w210 h20 , Extra AntiBan
  9. Gui, Add, CheckBox, x12 y209 w210 h20 , CheckBox
  10. Gui, Add, Button, x362 y329 w100 h30 gBeginSandCrab vbeginbuttonlabel, Start
  11. Gui, Add, GroupBox, x252 y119 w210 h200 , Metrics
  12. Gui, Add, Text, x262 y139 w190 h20 vstatus, Status:Duration
  13. Gui, Add, Text, x262 y169 w190 h20 vcbtstatus, Not in combat. ;done
  14. Gui, Add, Text, x262 y199 w190 h20 vhealth, Health: ;done
  15. Gui, Add, Text, x262 y229 w190 h20 vprayer, Prayer: ;done
  16. Gui, Add, Text, x262 y259 w190 h20 veatlabel, Eating OFF
  17. Gui, Add, Text, x262 y289 w190 h20 , AntiBan
  18. Gui, Show, w479 h379, Jared
  19.  
  20. SetTitleMatchMode 2
  21. WinActivate, RuneLite
  22. WinGetPos, RSWINX1, RSWINY1, RSWINX2, RSWINY2, RuneLite
  23.  
  24.  
  25. GuiControl,Disable, setcolors
  26. GuiControl,Disable, eatandbank
  27. GuiControl,Disable, eattilllog
  28.  
  29.  
  30.  
  31. ;Variables---------------------------------
  32.  
  33. ;Combat Status---
  34. cbtlocX1=16
  35. cbtlocY1=72
  36. cbtlocX2=19
  37. cbtlocY2=85
  38. CombatAliveColor=0x33860A
  39. CbtLastAlive=
  40. CbtDead=
  41.  
  42. ;Health Check---
  43. 100hpx1=533
  44. 100hpy2=237
  45. 100hpx2=547
  46. 100hpy2=240
  47. hpdiff=25
  48. hpcolor=0x112584
  49.  
  50. ;Prayer Check---
  51. 100px1=744
  52. 100py2=237
  53. 100px2=758
  54. 100py2=240
  55. pdiff=25
  56. pcolor=0x92952F
  57.  
  58. ;Food List Array
  59. ListofFood := []
  60. foodlabelid=1
  61. foodyco=49
  62.  
  63.  
  64.  
  65.  
  66.  
  67. ;SetTimer, RuneLiteStatus, 250    ;-fix this code
  68. toggle  := 0
  69. return
  70.  
  71. Rand(x,y) {
  72. Random, rand, %x%, %y%
  73. Return rand
  74. }
  75.  
  76.  
  77. BeginSandCrab:
  78. Gui, submit, NoHide
  79. GuiControl,,beginbuttonlabel, Stop(F12)
  80. GuiControlGet, foodlistcolor,, listfoodcolor
  81.    
  82. if (toggle := !toggle) {
  83.  goto, CombatRoutine
  84. } else {
  85.     GuiControl,,beginbuttonlabel, Start
  86. }
  87. return
  88.  
  89. MoveMouse(X, Y, Speed=25) {
  90.  
  91.    T := A_MouseDelay
  92.  
  93.    SetMouseDelay, -1
  94.  
  95.    MouseGetPos, CX, CY
  96.  
  97.    Pts := Round(Sqrt((X - CX)**2 + (Y - CY)**2) / Rand(0,3) ,0)
  98.  
  99.    Loop %Pts% {
  100.  
  101.       Random, NX, % CX - ((CX - X) / Pts) * (A_Index - 1)
  102.  
  103.                 , % CX - ((CX - X) / Pts) * A_Index
  104.  
  105.       Random, NY, % CY - ((CY - Y) / Pts) * (A_Index - 1)
  106.  
  107.                 , % CY - ((CY - Y) / Pts) * A_Index
  108.  
  109.       MouseMove, % NX, % NY, % Speed
  110.  
  111.    }
  112.  
  113.    MouseMove, % X, % Y, % Speed
  114.  
  115.    SetMouseDelay, % T
  116.  
  117. }
  118.  
  119.  
  120.  
  121.  
  122.  
  123. CombatRoutine:
  124. Msgbox, The bot will begin when you click ok.
  125. CheckLocation()
  126.     SetTitleMatchMode 2
  127.     WinActivate, RuneLite
  128.         SetTimer, CombatStatus, 250
  129.         SetTimer, HealthStatus, 1000
  130.         SetTimer, PrayerStatus, 250
  131.         SetTimer, Isyoueating, 250
  132.         GuiControl,, status, Status:Ready
  133. Loop
  134. {
  135. CheckLocation()
  136. sleep, 5000  ; fix this. false positive, remove msgbox
  137. }
  138. return
  139.  
  140.  
  141. CheckLocation()
  142. {
  143.     SetTitleMatchMode 2
  144.     WinActivate, RuneLite  
  145. CenterX1=251
  146. CenterY1=190
  147. CenterX2=259
  148. CenterY2=198
  149. HomeGroundTile=0x00DFDF
  150.  
  151. PixelSearch, Xhometile, Yhometile, %CenterX1%, %CenterY1%, %CenterX2%, %CenterY2%, %HomeGroundTile%, 5, fast
  152.                     if ErrorLevel
  153.                             {
  154.                                 PixelSearch, Xhometilea, Yhometilea, 9, 33, 518, 364, %HomeGroundTile%, 5, fast
  155.                                     if ErrorLevel
  156.                                             {
  157.                                                 ;msgbox, cant find color
  158.                                             }
  159.                                             else
  160.                                             {
  161.                                                 ;Msgbox, Moving to HomeBase found color at %Xhometilea% and %Yhometilea% for %HomeGroundTile%
  162.                                                 mousemove, %Xhometilea%, Yhometilea-5, 10
  163.                                                 sleep, 300
  164.                                                 Mouseclick, Left
  165.                                                 GuiControl,, status, Status:Fighting Sand Crabs
  166.                                             }
  167.                             }
  168.                             else
  169.                             {
  170.                                 GuiControl,, status, Status:Fighting Sand Crabs
  171.                             }
  172.  
  173. }
  174. Return
  175.  
  176.  
  177. ResetAgro()
  178. {
  179. GuiControl,, status, Status:Resetting Agro
  180. SetTitleMatchMode 2
  181. WinActivate, RuneLite
  182. RSgameinx1=9
  183. RSgameiny1=33
  184. RSgameinx2=518
  185. RSgameiny2=364
  186. ;       ahkcolor-runelitecolor
  187. ;hometile=0x00FFFF-FFFFFF00
  188. ;walktile1=0x0000FF-FFFF0000
  189. ;walktile2=0xFF0026-FF2600FF  
  190. ;walktile3=0xE700FF-FFFF00E7
  191. ;walktile4=0xE7FF00-FF00FFE7
  192. ;walktile5=0xCD0093-FFB700FF
  193. ColorArrayaway := ["0x0000FF", "0xFF0026", "0xE700FF", "0xE7FF00", "0xCD0093"]
  194. ColorArrayreturn := ["0xE7FF00", "0xE700FF", "0xFF0026","0x0000FF", "0x00FFFF"]
  195.             for i, coloraway in ColorArrayaway
  196.             {
  197.             WinActivate, RuneLite
  198.            
  199.                     PixelSearch, Xwalkcolor, Ywalkcolor, %RSgameinx1%, %RSgameiny1%, %RSgameinx2%, %RSgameiny2%, coloraway, 1, fast
  200.                 if ErrorLevel
  201.                     {
  202.                         FileAppend cant find walk tile
  203.                     }
  204.                     else
  205.                     {
  206.                        
  207.                         ;msgbox, found color %i% at %Xc% and %Yc%
  208.                         FileAppend found color %coloraway% at %Xwalkcolor% and %Xwalkcolor%`n, *
  209.                         MoveMouse(Xwalkcolor-Rand(5,10), Ywalkcolor-Rand(5,10), 10)
  210.                         sleep, Rand(80,200)
  211.                         MouseClick Left
  212.                         sleep, Rand(3500,4000)
  213.                        
  214.                     }
  215.             }
  216.                         for i, colorreturn in ColorArrayreturn
  217.             {
  218.             WinActivate, RuneLite
  219.            
  220.                     PixelSearch, Xwalkcolorreturn, Ywalkcolorreturn, %RSgameinx1%, %RSgameiny1%, %RSgameinx2%, %RSgameiny2%, colorreturn, 1, fast  
  221.                 if ErrorLevel
  222.                     {
  223.                         FileAppend cant find walk tile
  224.                     }
  225.                     else
  226.                     {
  227.                         ;msgbox, found color %i% at %Xc% and %Yc%
  228.                         FileAppend found colorreturn %color% at %Xwalkcolorreturn% and %Ywalkcolorreturn%`n, *
  229.                         MoveMouse(Xwalkcolorreturn-5, Ywalkcolorreturn, 10)
  230.                         sleep, Rand(80,200)
  231.                         MouseClick Left
  232.                         sleep, Rand(3500,4500)
  233.                     }
  234.             }
  235.     GuiControl,, status, Status:Agro Reset     
  236.     sleep, 5000    
  237. }
  238.  
  239.  
  240.  
  241. Isyoueating:
  242.     Gui, submit, NoHide
  243.     If (eatoptionbank=1)
  244.     GuiControl,, eatlabel, Eating ON  Banking
  245.     Else If (eatoptionLogout=1)
  246.     GuiControl,, eatlabel, Eating ON  Logging When out
  247.     return
  248.  
  249.  
  250. RuneLiteStatus:
  251. ifWinActive, RuneLite
  252. {
  253.         SetTimer, CombatStatus, 250
  254.         SetTimer, HealthStatus, 250
  255.         SetTimer, PrayerStatus, 250
  256.         GuiControl,, status, Status:Ready
  257. }
  258.  
  259. ifWinNotActive, RuneLite
  260. {
  261.         GuiControl,, status, Status:RuneLite Client not Active
  262.         SetTimer, CombatStatus, Off
  263.         SetTimer, HealthStatus, Off
  264.         SetTimer, PrayerStatus, Off
  265. }
  266.  
  267. return
  268.  
  269.  
  270.  
  271.  
  272. ;Set food colors when eating.
  273. setfoodcolor:
  274. Msgbox, Please mouse over the food in your inventory, and press F1`n`nPLEASE SET 3 COLORS.
  275. foodlabelid=1
  276. foodyco=50
  277. return
  278.  
  279. F1::
  280. if(listoffood.MaxIndex() >= 3 )
  281. {
  282.     Msgbox, Only 3 colors are supported at this time
  283.     return
  284. }
  285. MouseGetPos, MouseX, MouseY
  286. PixelGetColor, color, %MouseX%, %MouseY%
  287. sleep, 100
  288. ;GuiControl,, listfoodcolor,%color%
  289. listoffood.push(color)
  290.                 GuiControl,, listfoodcolor,%color%
  291.                 stringmid, R, color ,3 , 2
  292.                 stringmid, G, color,5,2
  293.                 stringmid, B, color,7,2
  294.                  Gui Add, Text, vfood%foodlabelid% x425 y%foodyco% c%B%%G%%R%, ||||||||||||||||||          
  295.             foodyco:=foodyco+14
  296.             foodlabelid++
  297. sleep, 200
  298. return
  299.  
  300. areyoueatingthough:
  301. GuiControlGet, areyoueating
  302. {
  303. if (areyoueating=1)
  304.     {
  305.         GuiControl,Enable, setcolors
  306.         GuiControl,Enable, eatandbank
  307.         GuiControl,Enable, eattilllog
  308.         GuiControl,, eatlabel, Eating ON
  309.         GuiControl,,eatoptionbank, 1
  310.     }
  311. if (areyoueating=0)
  312.     {
  313.         GuiControl,Disable, setcolors
  314.         GuiControl,, eatlabel, Eating OFF
  315.         GuiControl,Disable, eatandbank
  316.         GuiControl,Disable, eattilllog
  317.     }
  318. }
  319. return
  320.  
  321.  
  322.  
  323.  
  324. ;---------------------------------------
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. CombatStatus:
  335. GuiControlGet, Cbttext,, cbtstatus
  336. newstatus=
  337. Loop, 5
  338. {
  339.     sleep,200
  340. PixelSearch, Xcbtstatus, Ycbtstatus, %cbtlocX1%, %cbtlocY1%, %cbtlocX2%, %cbtlocY2%, %CombatAliveColor%, 1, fast
  341. }
  342.                     if ErrorLevel
  343.                             {
  344.                                         CbtDead:= A_TickCount
  345.                                         {
  346.                                             if (CbtDead <= CbtLastAlive+3000)
  347.                                             {
  348.                                                 newstatus = Recently Dead Target.
  349.                                             }
  350.                                             if (CbtDead >= CbtLastAlive+3000)
  351.                                             {
  352.                                            
  353.                                                 newstatus = Not in combat.
  354.                                             }
  355.                                             if (CbtDead >= CbtLastAlive+Rand(10000,23000))
  356.                                             {
  357.                                                 CbtDead=
  358.                                                 CbtLastAlive=
  359.                                                 ResetAgro()
  360.                                             }
  361.                                         }
  362.                             }
  363.                                     else
  364.                                         {
  365.                                             CbtLastAlive:= A_TickCount
  366.                                             newstatus = Combat Detected.
  367.                                         }
  368.                         GuiControl,, cbtstatus, %newstatus%
  369.                         GuiControl,, status, Status:Fighting Sand Crabs
  370. Return
  371.  
  372.  
  373.  
  374. HealthStatus: ; Check HP Status
  375. newhpleveltocheck:= 100hpy2
  376. GuiControlGet, hptext,, health
  377. newstatushp:=hplvlnum
  378. hplvlnum:=10
  379. invx1=563
  380. invy1=235
  381. invx2=731
  382. invy2=482
  383.  
  384. PixelSearch, Xcbtstatus, Ycbtstatus, %100hpx1%, %100hpy1%, %100hpx2%, %100hpy2%, %hpcolor%, 5, fast
  385.         if ErrorLevel
  386.             {
  387.                 Loop, 10 {
  388.                             newhpleveltocheck:= newhpleveltocheck+hpdiff
  389.                             PixelSearch, Xcbtstatus, Ycbtstatus, %100hpx1%, %newhpleveltocheck%, %100hpx2%, newhpleveltocheck+3, %hpcolor%, 1, fast
  390.                                 if ErrorLevel
  391.                                     {
  392.                                         hplvlnum--
  393.                                     }
  394.                                 else
  395.                                     {
  396.                                         hplvlnum--
  397.                                         break  
  398.                                     }
  399.                             }
  400.             }
  401.                            
  402.         else
  403.             {
  404.                 newstatushp = 100`%
  405.             }                      
  406. GuiControlGet, hptext,, health 
  407.                     If (newstatushp != hplvlnum)       
  408.                     {
  409.                         newhp:= hplvlnum*10
  410.                         GuiControl,, health, %newhp%`%
  411.                     }
  412.     If(hplvlnum<6)
  413.     {
  414.         sleep, Rand(2100,5100)
  415.         Lookingfood :=true
  416.         GuiControl,, status, Status:Eating
  417.         for i, foods in listoffood
  418.             {
  419.             WinActivate, RuneLite
  420.                         While Lookingfood
  421.                         {
  422.                     PixelSearch, XFoodcolor, YFoodcolor, %invx1%, %invy1%, %invx2%, %invx2%, foods, 1, fast
  423.                 if ErrorLevel
  424.                     {
  425.                         FileAppend Out of food
  426.                     }
  427.                     else
  428.                     {
  429.                         ;msgbox, found color %i% at %Xc% and %Yc%
  430.                         FileAppend found food %foods% at %XFoodcolor% and %YFoodcolor%`n, *
  431.                         MoveMouse(XFoodcolor, YFoodcolor+Rand(5,10), 10)
  432.                         sleep, Rand(80,200)
  433.                         MouseClick Left
  434.                         Lookingfood :=False
  435.                     }
  436.                 }
  437.     }
  438. }
  439. return
  440.  
  441.  
  442.  
  443.  
  444. PrayerStatus: ; Check Prayer Status
  445. newpleveltocheck:= 100py2
  446. GuiControlGet, ptext,, prayer
  447. newstatusp:=plvlnum
  448. plvlnum:=10
  449. PixelSearch, Xpstatus, Ypstatus, %100px1%, %100py1%, %100px2%, %100py2%, %pcolor%, 5, fast
  450.                         if ErrorLevel
  451.                             {
  452.                                 Loop, 10 {
  453.                                     newpleveltocheck:= newpleveltocheck+pdiff
  454.                                     PixelSearch, Xcbtstatus, Ycbtstatus, %100px1%, %newpleveltocheck%, %100px2%, newpleveltocheck+3, %pcolor%, 1, fast
  455.                                    
  456.                                         if ErrorLevel
  457.                                             {
  458.                                                 plvlnum--
  459.                                             }
  460.                                             else
  461.                                             {
  462.                                             plvlnum--
  463.                                             break  
  464.                                             }
  465.                                         }
  466.                             }
  467.                            
  468.                         else
  469.                             {
  470.                                 newstatusp = 100`%
  471.                             }
  472.                        
  473. GuiControlGet, ptext,, health  
  474.                     If (newstatusp != plvlnum)     
  475.                     {
  476.                         newp:= plvlnum*10
  477.                         GuiControl,, prayer, %newp%`%
  478.                     }
  479. return
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488. GuiClose:
  489. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment