Auto Boot Throw AHK Script

Posts 1630 of 71 · Page 2 of 5
Quote Originally Posted by akke92 View Post
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!
Yes, it doesnt work in the Background/Multibox :|
If you want to use it for multiboxing, you can make another macro that switches windows every 3 to 5 minutes, and allow it to rotate through the windows and throw out boots for each.
I suggest u should use the simpliest resolution so everyone can fit it on the screen.

And just add after:
Code:
WinGet, pidn, PID, A
pid := pidn
this code:
Code:
WinGetPos, X1, Y1,,, ahk_pid %pid%
WinMove, ahk_pid %pid%,, X1, Y1, 800, 600
this code changes resolution of selected window to 800x600 just after pressing hotkey, so just add it and noone will have any problems

add:
and by the way, u should make some loop with pictures (imo u should make like 10-15 pictures), because NOT EVERY boot when drops looks same. (thats what i didnt know, some guy from mpgh told me that)

add2:
Quote Originally Posted by akke92 View Post
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!
to be able to multi-box (in case all troves are visible) u can add this tricky part of code, but its a bit glitchy since IF u press anything in the moment of throwing boot, u can bug something ;D

ofc add this just before boot-drop
Code:
WinGet, spidn, PID, A
spid := spidn
WinActivate, ahk_pid %pid%
and after
Code:
WinActivate, ahk_pid %spid%
So it will remember current active window and switch to the one when boot is found (ure not using coordmode so it will launch on a bot that it was found on binded window) and after boot is dropped it will switch back to the last used window.
Quote Originally Posted by konradmm View Post
I suggest u should use the simpliest resolution so everyone can fit it on the screen.

And just add after:
Code:
WinGet, pidn, PID, A
pid := pidn
this code:
Code:
WinGetPos, X1, Y1,,, ahk_pid %pid%
WinMove, ahk_pid %pid%,, X1, Y1, 800, 600
this code changes resolution of selected window to 800x600 just after pressing hotkey, so just add it and noone will have any problems

add:
and by the way, u should make some loop with pictures (imo u should make like 10-15 pictures), because NOT EVERY boot when drops looks same. (thats what i didnt know, some guy from mpgh told me that)

add2:


to be able to multi-box (in case all troves are visible) u can add this tricky part of code, but its a bit glitchy since IF u press anything in the moment of throwing boot, u can bug something ;D

ofc add this just before boot-drop
Code:
WinGet, spidn, PID, A
spid := spidn
WinActivate, ahk_pid %pid%
and after
Code:
WinActivate, ahk_pid %spid%
So it will remember current active window and switch to the one when boot is found (ure not using coordmode so it will launch on a bot that it was found on binded window) and after boot is dropped it will switch back to the last used window.
The resolution is set by the game itself and the search for the image adjusts to the screen. For better results if you create and image like the original boot.bmp in your resolution/quality settings you should have no problem at all with this script. (tutorial in the first post)

There are no differences in those boots that can make this script ignore them, Ive been running it for some time without a single problem.

There is someone else working in a throw boots with the actual code(Not the image) and with that you can use multibox. I simply dont have the time to search for it.

Like I said in the first post, this script is for my personal use and since there was no other script allowing to throw away those boots in the AHK i've decided to share with everyone. Feel free do edit the code and make anything else for everyone. Thanks for your sugestions.

- - - Updated - - -

Quote Originally Posted by die254 View Post
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.
UPDATE 22/07/15
 
Throw boots with the last fishing bot Thanks to hzt
#WinActivateForce

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

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
}
My bot isn't touching the boots off what do I do?
i have follow the instructions step by step,,, but auto throw boots still not working Any help?
Quote Originally Posted by rodrigokbx1 View Post
My bot isn't touching the boots off what do I do?
Quote Originally Posted by beebeeisadog View Post
i have follow the instructions step by step,,, but auto throw boots still not working Any help?
Please follow these:

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.

You must be inside Trove all the time, this doesn't work in the background.
works perfectly, thx
they dont work. i press crtl + numpad 6 and it dont work
I improved the code and usability a little bit (Nothing major).

Fishing will work on background, it simply wont drop boots unless trove is in focus.



Changes:
  • Ctrl + j to start the bot (Instead of numpad 6)
  • Ctrl + k to stop it (Instead of numpad 7)
  • Stopping the bot will no longer close the script, you can press ctrl + j to start it back again without having to re-run the script
  • If you stop it mid fishing, it will catch the current fish and then stop.
  • Cleaned a lot of stuff from the code.
  • All boots will be thrown out at once (Instead of 1 per iteration).



Code:
#WinActivateForce

^j::
  shouldRun = 1
  if !setupDone
  {
    WinGet, pidn, PID, A
    pid := pidn
    WinGet, hwnds, ID, A
    Handle := hwnds
    Base := getProcessBaseAddress()
    WaterAddress := GetAddressWater(Base,0x00964208) 
    LavaAddress := GetAddressLava(Base,0x00964208) 
    ChocoAddress := GetAddressChoco(Base,0x00964208) 
    setupDone = 1
  }
  Loop
  {
    if shouldRun
    {
      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

      While Catch = 0 
      {
        If (PoleCheckN = PoleCheck)
        {
          ControlSend, , {f down}, ahk_pid %pid%
          Sleep, 86
          ControlSend, , {f up}, ahk_pid %pid%
        }
        
        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
        }
        
        FindAndDropBoots()
      }
    }
    else
    {
      Return
    }
  }
Return

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
}

FindAndDropBoots()
{
  Imagesearch, Foundx, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 c:\boot.bmp
  
  While errorlevel = 0
  {
    MouseClickDrag, Left, %FoundX%, %FoundY%, 779, 412
    Imagesearch, Foundx, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 c:\boot.bmp
  }
}

^k::
  shouldRun = 0
Return
nilotaviano this code doenst work at me too. i dont know why.
Quote Originally Posted by SlaiiZ View Post
nilotaviano this code doenst work at me too. i dont know why.
Make sure you are following these steps:

  1. Paste the code to a .ahk file (Like fishing.ahk)
  2. Double click the file to run the script
  3. Focus trove's windows and press ctrl + j


That should work.
And play the game in Fullscreen or Windowed Fullscreen, on only Windowed it didn't work for me either, on Windowed Fullscreen it works like a charme.
i tried all resolutions. in windowed. fulscreen and i did it step by step. but it didnt worked
Posts 1630 of 71 · Page 2 of 5

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?