Advertisement
Guest User

xisumavoid afk fishing but it's mcgame2014 version

a guest
Feb 28th, 2020
4,214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Great Thank to xisumavoid to help me know about this program
  2. ;==================================================================================================
  3. ; AHK setting
  4. #NoEnv
  5. SetBatchLines -1
  6. SetTitleMatchMode 2
  7. #SingleInstance Force
  8. SetWorkingDir %A_ScriptDir%
  9. ;==================================================================================================
  10. ; Globle values
  11. wintitle := Minecraft X-AHK V0.4 mcgame2014 version
  12. targettitle := none
  13. targetwinclass := GLFW30 ;This is the Class of a Java program used to check we have a Minecraft prog
  14. ModeText := Empty
  15. id := 0
  16.  
  17. ProgState := 0
  18. ;===================================================================================================
  19. ;List of ProgState's
  20. ;
  21. ; 0: Start          - Program called for first time and setting default state. Hotkeys set, menu
  22. ;                       configured and default welcome GUI
  23. ; 1: Selected       - User has selected the target window to send key/mouse activity too
  24. ;                       will use option Menu to slect mode. Note that JumpFlying is only
  25. ;                       avalible while in this state!
  26. ; 2: FishingMode    - Enter Fishing Mode
  27. ; 3: ConcreteMode   - Enter Concrete Mode
  28. ; 4: MobGrindMode   - Enter Mob Grinder Mode
  29. ; 5: MinerGa - Enter Afk Skyblock Mode
  30.  
  31. ;===================================================================================================
  32. ;Shortcuts
  33. ;===================================================================================================
  34. Hotkey  !^f,    Fishing         ; Pressing ctrl + alt + f will start fishing
  35. Hotkey  !^e,    JumpFly         ; Pressing ctrl + alt + e will dubble hit space and fire a rockct in
  36.                                 ; main hand
  37. Hotkey  !^c,    Concrete        ; Pressing ctrl + alt + c will start concrete farming
  38. Hotkey  !^m,    MobGrind        ; Pressing ctrl + alt + m will start mob grinding
  39. Hotkey  !^s,    Stop            ; Pressing ctrl + alt + s will stop it
  40. Hotkey  !^v,    Miner               ;
  41. Hotkey  !^w,    SelectWindow    ;Allows user to select window to control by hovering mouse over it and
  42.                                 ;Pressing ctrl + alt + w
  43.  
  44. ;===================================================================================================
  45. ;Menu
  46. ;===================================================================================================
  47. Menu, FileMenu, Add, Open, MenuFileOpen
  48. Menu, FileMenu, Add, Exit, MenuHandler
  49. Menu, HelpMenu, Add, About, MenuHandler
  50. Menu, OptionsMenu, Add, Fishing, MenuFishing
  51. Menu, OptionsMenu, Add, AFK Mob, MenuAFK
  52. Menu, OptionsMenu, Add, Concrete, MenuConcrete
  53. Menu, OptionsMenu, Add, JumpFlying, MenuJumpFly
  54. Menu, OptionsMenu, Add, MinerGa, MenuMinerGa
  55. Menu, ClickerMenu, Add, File, :FileMenu
  56. Menu, ClickerMenu, Add, Help, :HelpMenu
  57. Menu, ClickerMenu, Add, Options, :OptionsMenu
  58.  
  59. ;===================================================================================================
  60. ;GUI-Default Welcome Screen
  61. ; Start screen asking user to select the target window to send keys to
  62. ;===================================================================================================
  63. if %ProgState% != 0
  64.     Return
  65.  
  66. Gui, Show, w300 h300, Shortcuts
  67. Gui, Add, Pic, w280 h290 vpic_get, welcomepic.png
  68. Gui, Show,, Minecraft X-AHK V0.4 mcgame2014 version
  69. return
  70. ;===================================================================================================
  71. ; Called when Ctrl+Alt+W is pressed and captures target window information, checks its a java prog
  72. ;and then creates the first window.
  73.  
  74. SelectWindow:
  75. {
  76.     ;Get mouse pos on screen and grab details of program
  77.     MouseGetPos, , , id, control
  78.     WinGetTitle, targettitle, ahk_id %id%
  79.     WinGetClass, targetclass, ahk_id %id%
  80.     ;MsgBox, ahk_id %id%`nahk_class %targetclass%`n%targettitle%`nControl: %control%
  81.  
  82.     ;Check is Class of program is a Minecraft Java Class
  83.     if InStr(targetclass, targetwinclass)
  84.     {
  85.         ;Target window found, swop to next screen
  86.         ProgState = 1
  87.         Gui, Destroy
  88.         Gui, Show, w500 h500, Temp
  89.         Gui, Menu, ClickerMenu
  90.         Gui, Add, Text,, Target Window Title : %targettitle%
  91.         Gui, Add, Text,, Windows HWIND is : %id%
  92.         Gui, Add, Text,, To change mode of opperation please select from Option menu.
  93.         Gui, Add, Text,, MODE:
  94.         Gui, Add, Text, vMode w30, None
  95.         Gui, Show,, Minecraft X-AHK V0.4 W
  96.         ;clear mouse clicks to target by sending UP to the keys
  97.         ControlClick, , ahk_id %id%, ,Right, , NAU
  98.         ControlClick, , ahk_id %id%, ,Left, ,NAU
  99.         sleep 500
  100.     }
  101.     Else
  102.     {
  103.         ;Class of target program not a match so give warning message
  104.         MsgBox, You do not seem to have selected a Minecraft window. Please check before you continue.
  105.     }
  106.     Return
  107. }
  108. ;===================================================================================================
  109. ;Menu Functions
  110. ; Place holder - will allow users to load saved values
  111. ;===================================================================================================
  112. MenuFileOpen:
  113. {
  114.     ModeText := JumpFlying
  115.     GuiControl,,Mode, %ModeText%
  116.     Return
  117. }
  118. ;===================================================================================================
  119. MenuMinerGa:
  120. {
  121.  ; Stop and current active AHK process
  122.     BreakLoop := 1
  123.  
  124.         Gui, Destroy
  125.     Gui, Show, w500 h500, Temp
  126.     Gui, Menu, ClickerMenu
  127.     Gui, Add, Text,, Target Window Title : %targettitle%
  128.     Gui, Add, Text,, Windows HWIND is : %id%
  129.     Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
  130.     Gui, Add, Text,, o- Pressing ctrl + alt + v will start MinerGa farming
  131.     Gui, Add, Text,, o- Pressing ctrl + alt + s will stop any AutoKey funtion above
  132.     Gui, Show,, Minecraft X-AHK V0.4 W
  133.  
  134.     ProgState := 5
  135. Return
  136. }
  137. MenuHandler:
  138. {
  139.     Return
  140. }
  141. ;===================================================================================================
  142. ; Switch to Fishing mode and update window
  143. MenuFishing:
  144. {
  145.     ; Stop and current active AHK process
  146.     BreakLoop := 1
  147.  
  148.         Gui, Destroy
  149.         Gui, Show, w500 h500, Temp
  150.         Gui, Menu, ClickerMenu
  151.         Gui, Add, Text,, Target Window Title : %targettitle%
  152.         Gui, Add, Text,, Windows HWIND is : %id%
  153.         Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
  154.         Gui, Add, Text,, o- Pressing ctrl + alt + f will start fishing
  155.         Gui, Add, Text,, o- Pressing ctrl + alt + s will stop any AutoKey funtion above
  156.         Gui, Add, Text,,
  157.         Gui, Add, Slider, vMySlider w200 ToolTip Range0-1000 TickInterval 1000, 1000
  158.         Gui, Show,, Minecraft X-AHK V0.4 W
  159.  
  160.     ProgState := 2
  161.     Return
  162. }
  163. ;===================================================================================================
  164. ; Switch to AFK mode and update window
  165. MenuAFK:
  166. {
  167.     ; Stop and current active AHK process
  168.     BreakLoop := 1
  169.  
  170.     Gui, Destroy
  171.     Gui, Show, w500 h500, Temp
  172.     Gui, Menu, ClickerMenu
  173.     Gui, Add, Text,, Target Window Title : %targettitle%
  174.     Gui, Add, Text,, Windows HWIND is : %id%
  175.     Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
  176.     Gui, Add, Text,, o- Pressing ctrl + alt + m will start Mod Grinding
  177.     Gui, Add, Text,, o- Pressing ctrl + alt + s will stop any AutoKey funtion above
  178.     Gui, Show,, Minecraft X-AHK V0.4 W
  179.  
  180.     ProgState := 4
  181.     Return
  182. }
  183. ;===================================================================================================
  184. ; Switch to Concrete mode and update window
  185. MenuConcrete:
  186. {
  187.     ; Stop and current active AHK process
  188.     BreakLoop := 1
  189.  
  190.     Gui, Destroy
  191.     Gui, Show, w500 h500, Temp
  192.     Gui, Menu, ClickerMenu
  193.     Gui, Add, Text,, Target Window Title : %targettitle%
  194.     Gui, Add, Text,, Windows HWIND is : %id%
  195.     Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
  196.     Gui, Add, Text,, o- Pressing ctrl + alt + c will start concrete farming
  197.     Gui, Add, Text,, o- Pressing ctrl + alt + s will stop any AutoKey funtion above
  198.     Gui, Show,, Minecraft X-AHK V0.4 W
  199.  
  200.     ProgState := 3
  201.     Return
  202. }
  203. ;===================================================================================================
  204. ; Switch to Flying mode and update window
  205. MenuJumpFly:
  206. {
  207.     ; Stop and current active AHK process
  208.     BreakLoop := 1
  209.  
  210.     Gui, Destroy
  211.     Gui, Show, w500 h500, Temp
  212.     Gui, Menu, ClickerMenu
  213.     Gui, Add, Text,, Target Window Title : %targettitle%
  214.     Gui, Add, Text,, Windows HWIND is : %id%
  215.     Gui, Add, Text,, CURRENT AVALIBLE OPTIONS:
  216.     Gui, Add, Text,, o- Pressing ctrl + alt + e will dubble hit space and fire a rocket in main hand
  217.     Gui, Show,, Minecraft X-AHK V0.4 W
  218.  
  219.     ProgState := 1
  220.     Return
  221. }
  222. ;===================================================================================================
  223. ; Called when Ctrl+Alt+V is pressed.
  224. Miner:
  225. {
  226.    if (ProgState != 5)
  227.         Return
  228.  
  229.     BreakLoop := 0
  230.  
  231.     ControlClick, , ahk_id %id%, ,Right, , NAD
  232.     Sleep 500
  233.  
  234.     While (BreakLoop = 0)
  235.     {
  236.        ControlClick, , ahk_id %id%, ,Left, , NAD
  237.  
  238.       ControlSend,,{a down}, ahk_id %id%,,NA
  239.       Sleep 1000
  240.       ControlSend,,{a up}, ahk_id %id%,,NA
  241.       Sleep 500
  242.      if BreakLoop = 1)
  243.         {
  244.             sleep 10
  245.         }
  246.      ControlSend,,{d down}, ahk_id %id%,,NA
  247.       Sleep 1000
  248.       ControlSend,,{d up}, ahk_id %id%,,NA
  249.       Sleep 500
  250.  
  251.         ControlClick, , ahk_id %id%, ,Left, , NAU
  252.        ControlClick, , ahk_id %id%, ,Left, , NA
  253. sleep 10
  254.     }
  255.     ControlClick, , ahk_id %id%, ,Left, , NAU
  256.     Sleep 100
  257.     ControlClick, , ahk_id %id%, ,Right, , NAU
  258.     Return
  259. }
  260. ;===================================================================================================
  261. ; Called when Ctrl+Alt+E is pressed.
  262. ; NOTE: Target window MUST be in focus for this to work
  263. JumpFly:
  264. {
  265.     if (ProgState != 1)
  266.         Return
  267.  
  268.     Sleep 500
  269.     Send {Space down}
  270.     Sleep 75
  271.     Send {Space up}
  272.     Sleep 200
  273.     Send {Space down}
  274.     Sleep 75
  275.     Send {Space up}
  276.     Sleep 50
  277.     ControlClick, , ahk_id %id%, ,Right, , NAD
  278.     Sleep 100
  279.     ControlClick, , ahk_id %id%, ,Right, , NAU
  280.     Return
  281. }
  282. ;===================================================================================================
  283. ; Called when Ctrl+Alt+C is pressed. Hold both RIGHT and LEFT click down.
  284. Concrete:
  285. {
  286.     if (ProgState != 3)
  287.         Return
  288.  
  289.     BreakLoop := 0
  290.  
  291.     ControlClick, , ahk_id %id%, ,Right, , NAD
  292.     Sleep 500
  293.  
  294.     While (BreakLoop = 0)
  295.     {
  296.        ControlClick, , ahk_id %id%, ,Left, , NAD
  297.     sleep 1500
  298.         if BreakLoop = 1)
  299.         {
  300.             sleep 10
  301.         }
  302.         ControlClick, , ahk_id %id%, ,Left, , NAU
  303.        ControlClick, , ahk_id %id%, ,Left, , NA
  304. sleep 10
  305.     }
  306.     ControlClick, , ahk_id %id%, ,Left, , NAU
  307.     Sleep 100
  308.     ControlClick, , ahk_id %id%, ,Right, , NAU
  309.     Return
  310. }
  311. ;===================================================================================================
  312. ; Called when Ctrl+Alt+F is pressed and continuly clicks RIGHT mouse key
  313. Fishing:
  314. {
  315.     if (ProgState != 2)
  316.         Return
  317.  
  318.     BreakLoop := 0
  319.         Loop
  320.         {
  321.             if (BreakLoop = 1)
  322.             {
  323.                 BreakLoop := 0
  324.                 break
  325.             }
  326.  
  327.              sleep 3000
  328.             ControlClick, , ahk_id %id%, ,Right, ,NAD
  329.             Sleep 10
  330.             ControlClick, , ahk_id %id%, ,Right, ,NAU
  331.  
  332.         }
  333.     Return
  334. }
  335. ;==================================================================================================
  336. ; Called when Ctrl+Alt+M is pressed
  337. MobGrind:
  338. {
  339.     if (ProgState != 4)
  340.         Return
  341.  
  342.     BreakLoop := 0
  343.     Delay := 0
  344.     Sleep 500
  345.     While (BreakLoop = 0)
  346.     {
  347.         ;on each loop send RIGHT key down as it can be lost when switching focus
  348.         ControlClick, , ahk_id %id%, ,Right, , NAD
  349.  
  350.         if (BreakLoop = 1)
  351.         {
  352.             ; On Ctrl+Alt+S detected forces a RIGHT mouse key UP
  353.             ControlClick, , ahk_id %id%, ,Right, , NAU
  354.             Return
  355.         }
  356.  
  357.         Sleep 100 ;100 ms
  358.         ;Delay between LEFT clicks is controled by sleep delay above * value tested here (ie 12)
  359.         ; Example = 100ms * 12 = 1.2 seconds
  360.         ;This method allows AHK to better exit this mode and respond quicker to Stop command
  361.         if (Delay >= 12)
  362.         {
  363.             ; If delay counter reached, reset counter and send a LEFT click
  364.             Delay := 0
  365.             sleep 50
  366.             ControlClick, , ahk_id %id%, ,Left, ,NAD
  367.             Sleep 50
  368.             ControlClick, , ahk_id %id%, ,Left, ,NAU
  369.         }
  370.         else
  371.             Delay++ ;Increase delay counter by 1
  372.  
  373.     }
  374.     Sleep 100
  375.     ;Force mouse keys UP at exit
  376.     ControlClick, , ahk_id %id%, ,Right, , NAU
  377.     ControlClick, , ahk_id %id%, ,Left, ,NAU
  378.     Return
  379. }
  380. ;==================================================================================================
  381. ; Called when Ctrl+Alt+S is pressed at ANYTIME
  382. ; By setting the globle value of 'BreakLoop' to 1 this causes any running mode to exit under its own
  383. ;control without leaving key states in correctly. Due to Mouse loss of focus STOP will also force
  384. ;mouse keys UP.
  385. Stop:
  386. {
  387.     BreakLoop := 1
  388.     ControlClick, , ahk_id %id%, ,Right, , NAU
  389.     ControlClick, , ahk_id %id%, ,Left, ,NAU
  390.     ControlSend, , {a up}, ahk_id %id%
  391.     ControlSend, , {d up}, ahk_id %id%
  392.     sleep 500
  393.     return
  394. }
  395.  
  396. ;===================================================================================================
  397. ESC:
  398. GuiClose:
  399. GuiEscape:
  400. ExitApp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement