Auto Boot Throw AHK Script

Posts 115 of 71 · Page 1 of 5
Auto Boot Throw AHK Script
I've took some info from Milecar12 and hzt (Thanks both) and made a AHK boot throw for my personal use. Here is my code:

Code:
#Persistent
	Numpad2::
	Loop
	{
	Sleep, 3000
	Imagesearch, Foundx, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 c:\boot.bmp
		if errorlevel = 0
			{
			MouseClickDrag, Left, %FoundX%, %FoundY%, 779, 412
			}
	}
Download the Boot.bmp put it in the "C:\" . Create a new script in the AHK and paste this code. Get inside Trove and press NUMPAD 2 to start the script. This only works when the Trove is the window showed on screen so this doesnt work in the Background. (make sure your Inv is open all the time to throw away those nasty boots)




 
Throw Boot with the taejim last working fishing bot in the same script
#WinActivateForce

Numpad6::
WinGet, pidn, PID, A
pid := pidn
WinGet, hwnds, ID, A
Handle := hwnds
Lure := 9999
Base := getProcessBaseAddress()
WaterAddress := GetAddressWater(Base,0x009570DC)
LavaAddress := GetAddressLava(Base,0x009570DC)
ChocoAddress := GetAddressChoco(Base,0x009570DC)

LureCount := 0
Loop %Lure%
{
LureCount := LureCount +1
ControlSend, , {c down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {c up}, ahk_pid %pid%
Sleep, 500
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
PoleCheck := 40

Loop
{
If (Catch = 1)
{
break
}
else
{
If (PoleCheckN = PoleCheck)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
LureCount := 0
}
else
{
}
CaughtWater := ReadMemory(WaterAddress)
CaughtLava := ReadMemory(LavaAddress)
CaughtChoco := ReadMemory(ChocoAddress)
If (CaughtWater = 1 or CaughtLava = 1 or CaughtChoco = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
PoleCheckN := PoleCheckN +1
Sleep, 1000
}
}
Imagesearch, Foundx, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 c:\boot.bmp
if errorlevel = 0
{
MouseClickDrag, Left, %FoundX%, %FoundY%, 779, 412
}
}
}
ExitApp

Numpad7::
ExitApp

GetAddressWater(Base, Address)
{
pointerBase := base + Address
y1 := ReadMemory(pointerBase)
y2 := ReadMemory(y1 + 0x144)
y3 := ReadMemory(y2 + 0xe4)
Return WaterAddress := (y3 + 0x70)
}

GetAddressLava(Base, Address)
{
pointerBase := base + Address
y1 := ReadMemory(pointerBase)
y2 := ReadMemory(y1 + 0x144)
y3 := ReadMemory(y2 + 0xe4)
Return LavaAddress := (y3 + 0x514)
}

GetAddressChoco(Base, Address)
{
pointerBase := base + Address
y1 := ReadMemory(pointerBase)
y2 := ReadMemory(y1 + 0x144)
y3 := ReadMemory(y2 + 0xe4)
Return ChocoAddress := (y3 + 0x2c0)
}

getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}

ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle, "UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
Fishing bot outdated, I will update when a working fishing bot is released.


EDIT:

For those with problems for it to work:

Enter the game, take a screenshot of your inventory with a boot inside in your resolution/quality settings.

Edit the screenshot to be like the original boot.bmp(Take a look at the area that I took from the screenshot).

Finally save your new image with the name of boot.bmp in the C:\boot.bmp .

Your error should be because your are using a different resolution/quality.

If you do this the image that the AHK is going to search its the exact one that appears on your screen and it should be working perfectly.
boot.bmp1014 B · 839 downloads
can you upload the boot image to imgur? :3
it should be run at the same time fishing bot?
The Forum rules don't allow me to post outside links. You need to wait for the approval. Sorry
Nice work, the thing is can we fuse this with taejims bot ? like adding this code to his work ?
Quote Originally Posted by secretmars View Post
Nice work, the thing is can we fuse this with taejims bot ? like adding this code to his work ?
The fishing bot that he made works in the background and this doesnt.

Here is the code together with his last bot: (Press NUMPAD 6 inside Trove to start the bot normally, dont need to do anything else)
Code:
#WinActivateForce

Numpad6::
	WinGet, pidn, PID, A
	pid := pidn
	WinGet, hwnds, ID, A
	Handle := hwnds
	Lure := 9999
	Base := getProcessBaseAddress()
	WaterAddress := GetAddressWater(Base,0x009570DC) 
	LavaAddress := GetAddressLava(Base,0x009570DC) 
	ChocoAddress := GetAddressChoco(Base,0x009570DC) 
	
	LureCount := 0
	Loop %Lure%
	{
		LureCount := LureCount +1
		ControlSend, , {c down}, ahk_pid %pid%
		Sleep, 86
		ControlSend, , {c up}, ahk_pid %pid%
		Sleep, 500
		ControlSend, , {f down}, ahk_pid %pid%
		Sleep, 86
		ControlSend, , {f up}, ahk_pid %pid%
		Catch := 0
		PoleCheck := 40

		Loop  
		{
			If (Catch = 1)
			{	
				break
			}
			else
			{
				If (PoleCheckN = PoleCheck)
				{
					ControlSend, , {f down}, ahk_pid %pid%
					Sleep, 86
					ControlSend, , {f up}, ahk_pid %pid%
					LureCount := 0
				}
				else
				{
				}
				CaughtWater := ReadMemory(WaterAddress)
				CaughtLava := ReadMemory(LavaAddress)
				CaughtChoco := ReadMemory(ChocoAddress)
				If (CaughtWater = 1 or CaughtLava = 1 or CaughtChoco = 1)
				{
					ControlSend, , {f down}, ahk_pid %pid%
					Sleep, 86
					ControlSend, , {f up}, ahk_pid %pid%
					Random, Wait, 2000, 3500
					Sleep, %Wait%
					Catch := 1
				}
				else 
				{
					PoleCheckN := PoleCheckN +1
					Sleep, 1000
				}
			}
			Imagesearch, Foundx, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 c:\boot.bmp
				if errorlevel = 0
					{
					MouseClickDrag, Left, %FoundX%, %FoundY%, 779, 412
					}
		}
	}
ExitApp

Numpad7::
ExitApp

GetAddressWater(Base, Address)
{
    pointerBase := base + Address
    y1 := ReadMemory(pointerBase)
    y2 := ReadMemory(y1 + 0x144)
    y3 := ReadMemory(y2 + 0xe4)
    Return WaterAddress := (y3 + 0x70)   
}

GetAddressLava(Base, Address)
{
    	pointerBase := base + Address
    	y1 := ReadMemory(pointerBase)
    	y2 := ReadMemory(y1 + 0x144)
    	y3 := ReadMemory(y2 + 0xe4)
    	Return LavaAddress := (y3 + 0x514) 
}

GetAddressChoco(Base, Address)
{
    	pointerBase := base + Address
    	y1 := ReadMemory(pointerBase)
    	y2 := ReadMemory(y1 + 0x144)
    	y3 := ReadMemory(y2 + 0xe4)
    	Return ChocoAddress := (y3 + 0x2c0) 
}

getProcessBaseAddress()
{
    	Global Handle
    	return DllCall( A_PtrSize = 4
                            ? "GetWindowLong"
                            : "GetWindowLongPtr"
                        , "Ptr", Handle
                        , "Int", -6
                        , "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
     	; If DLL call fails, returned value will = 0
}   

ReadMemory(MADDRESS)
{
    	Global pid
    	VarSetCapacity(MVALUE,4,0)
    	ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
    	;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
    	DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
    	Loop 4
        	result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
    	return, result
}
Thank you very much, nice work.
Its not throwing out boots. I put the image in C:\. I'm on laptop.
doesnt work not dropping
No workyyyyyyyyyy
For those with problems for it to work:

Enter the game, take a screenshot of your inventory with a boot inside in your resolution/quality settings.

Edit the screenshot to be like the original boot.bmp(Take a look at the area that I took from the screenshot).

Finally save your new image with the name of boot.bmp in the C:\boot.bmp .

Your error should be because your are using a different resolution/quality.

If you do this the image that the AHK is going to search its the exact one that appears on your screen and it should be working perfectly.
Its working fine, im with 1680x1080 res, but its not efficent. Multiboxing isnt working and screen needs to be stay open
This works amazing on 1920x1080 "Windowed Fullscreen"
The only downside is that the curser is needed for the boot to drop so you can't Multibox..
Overall, great work OP!
Posts 115 of 71 · Page 1 of 5

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?