Minecraft: Simple 2x4 Miner [Block Recognition]

Post gaming related scripts
Ceruleancerise
Posts: 4
Joined: 26 Sep 2017, 19:10

Minecraft: Simple 2x4 Miner [Block Recognition]

02 Dec 2018, 22:33

Hi,

this is a small project I worked on about a year ago but never finished, I am by no means an expert AHK scripter and the approach used by this script is very hacky/highlevel

i hope this can be referenced for anybody looking to do something similar in the future?

Requirements:
Minecraft Forge, with HWYLA (Here's What You're Looking At) and WAWLA (What Are We Looking At)
FindText library (FindText.ahk), with functions by Joe Glines included -- include this in the same directory as the main script 'mine.ahk'
Skrommel's 'Captain' program -- to change WinTitles (https://www.dcmembers.com/skrommel/download/captain/)
Patience, you'll likely have to replace the ASCII strings that recognize whats what due to monitor changes -- See the FindText original (https://autohotkey.com/boards/viewtopic.php?t=17834) on how to generate those strings yourself.

mine.ahk: https://pastebin.com/Rvzc7sgV
Modified FindText library: https://pastebin.com/RCZzbihX

Additionally I wrote a small manager script incase the bot/player encountered lava.
manager.ahk: https://pastebin.com/wafrR5BF

Limitations:
Ghost blocks, if one occurs the script will be unable to detect or handle this
Caves/Empty blocks, the script will not be able to recover from irregularities such as these
Gravel/Sand, the script will not be able to recover from irregularities such as these

Please ask if you have any questions! I really enjoyed working on this, even if it doesn't work quite as well as I hoped. I don't really see any better being possible without lower level solutions, such as game hooks.
feiyue
Posts: 349
Joined: 08 Aug 2014, 04:08

Re: Minecraft: Simple 2x4 Miner [Block Recognition]

03 Feb 2019, 09:25

Because the latest FindText() function makes some changes to the returned object, Joe Glines'code should be modified:

Code: Select all


;***********Left click*******************
FindText_Left_Click(Obj,X_Adj=0,Y_Adj=0,Move_Back=0){
CoordMode, Mouse
MouseGetPos,Orig_X,Orig_Y
x:=(obj.1.1+obj.1.3//2)+X_Adj
y:=(obj.1.2+obj.1.4//2)+Y_Adj
Click, %X%,%Y%
if (Move_Back){
  Sleep, 30
  MouseMove, %Orig_X%,%Orig_Y%
}
Return
}
 
;***********Right click*******************
FindText_Right_Click(Obj,X_Adj=0,Y_Adj=0,Move_Back=0){
CoordMode, Mouse
MouseGetPos,Orig_X,Orig_Y
x:=(obj.1.1+obj.1.3//2)+X_Adj
y:=(obj.1.2+obj.1.4//2)+Y_Adj
Click Right, %X%,%Y%
if (Move_Back){
  Sleep, 30
  MouseMove, %Orig_X%,%Orig_Y%
}
Return
}
 
;***********Double click*******************
FindText_Double_Click(Obj,X_Adj=0,Y_Adj=0,Move_Back=0){
CoordMode, Mouse
MouseGetPos,Orig_X,Orig_Y
x:=(obj.1.1+obj.1.3//2)+X_Adj
y:=(obj.1.2+obj.1.4//2)+Y_Adj
MouseMove, %X%,%Y%
Click 2
if (Move_Back){
  Sleep, 30
  MouseMove, %Orig_X%,%Orig_Y%
}
}
 
;***********Move mouse to location*******************
FindText_Move_Mouse(Obj,X_Adj=0,Y_Adj=0){
  CoordMode, Mouse
x:=(obj.1.1+obj.1.3//2)+X_Adj
y:=(obj.1.2+obj.1.4//2)+Y_Adj
MouseMove, %X%,%Y%
}
 
;***********Send text to location*******************
FindText_Send_Text(Obj,Text,Enter=0,X_Adj=0,Y_Adj=0,Move_Back=0){
CoordMode, Mouse
MouseGetPos,Orig_X,Orig_Y
x:=(obj.1.1+obj.1.3//2)+X_Adj
y:=(obj.1.2+obj.1.4//2)+Y_Adj
MouseMove, %X%,%Y%
Sleep 30
Click, %X%,%Y%
Sleep 30
SendInput , %Text%
if (Enter=1)
  SendInput , {Enter}
if (Move_Back){
  Sleep, 30
  MouseMove, %Orig_X%,%Orig_Y%
}
}


Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 21 guests