LightbulbNk Gems/XP Bot 1.7

Posts 1–11 of 11 · Page 1 of 1
Nk Gems/XP Bot 1.7
Nk Gems/XP Bot

What's new :
Button to change keyboard layout azerty/qwerty !
New launcher, works in any adventure world
Now working in background !
Now working on any monitor (not only primary) !

Disclaimer :
This bot is here to prove that you can do avnthing you want if you have an idea.
If you want a better gems/exp bot, you can make your own just editing my code.

Info & Tuto :
The 5th update of my adventure bot !

To make it work on a 1920x1080 : (for others, read the quick guide below)
  • Press "i" and disable everything except "Dungeons".
  • Set the game to windowed mode.
  • Maximize this window.
  • Run the GUI
  • Enter a world
  • Pick the blade direction on the GUI
  • You are done, now you can let it play in background

If this is not working (the bot is just /respawn-ing), check this tutorial :
https://www.mpgh.net/forum/showthread.php?t=1495579


Explanations :
This script will make you respawn.
Then it sends keys to move to the rally blade and use it.
Once teleported, it checks if you are in a dungeon by searching for it's logo (checking pixel color at logo location) on the top right of the screen.
If the logo is found, the script checks every 5s if this logo is still here, this during 90s or until the dungeon is completed.
If the dungeon is cleared before those 90s, the script will try to loot, add 1 to dungeons count and restart (/respawn...).
After 90s uncleared the script will timeout and respawn.

To-do :
(still) Find the dungeon pointer (that shows up the dungeon logo).
Enable multi-acc.
Adapt to different resolutions ?
Create better "random" human behavior when waiting in dungeon or respawning
Make a geode caves bot
Add auto pots script
Add automatic world switch ?

I'm opened to all of your ideas and suggestions, feel free to share them in the comments (Thanks to those who already inspired me). This is experimental, so it may not work on the first try !

AHK Script :
Code:
#SingleInstance force
#NoTrayIcon
SetWorkingDir %A_ScriptDir%
;To make it work with multiple displays
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, ToolTip, Screen
;Delay between each key (ms) to avoid some bugs while typing, increase this If "/respawn" is not typed correctly
SetKeyDelay, 40	

PauseFlag := 0
;Get previous layout or set azerty as default
If(A_Args[1]!=""){
	KeyboardLayout := A_Args[1]
}Else{
	KeyboardLayout := "az"
}
;Set the gui button with the correct layout name
If (KeyboardLayout = "az"){
	LayoutName := "Azerty"
}Else{
	LayoutName := "Qwerty"
}
Gui Add, GroupBox, h87 w250, Bot Control (arrow = blade position)
Gui Add, Button, xm+5 ym+12 w80 h23 gTopL, 🡼
Gui Add, Button, xm+85 ym+12 w80 h23 gTop, 🡹
Gui Add, Button, xm+165 ym+12 w80 h23 gTopR, 🡽 
Gui Add, Button, xm+5 ym+35 w80 h23 gLeft, 🡸
Gui Add, button, xm+85 ym+35 w80 h23 gLayoutSwitch vLayoutBtn, %LayoutName%
Gui Add, Button, xm+165 ym+35 w80 h23 gRight,  🡺
Gui Add, Button, xm+5 ym+58 w80 h23 gBotL, 🡿
Gui Add, Button, xm+85 ym+58 w80 h23 gBot,🡻
Gui Add, Button, xm+165 ym+58 w80 h23 gBotR, 🡾
Gui Add, GroupBox, h87 w90 x262 y6, Tools
Gui Add, Button, xm+257 ym+12 w80 h23 gPxChk, Pixel Checker
Gui Add, Button, xm+257 ym+35 w80 h23 gPause vToggle, Pause
Gui Add, Button, xm+257 ym+58 w80 h23 gStop, Stop
Gui Show,, Nk Bots v1.6

;Check if a direction have been clicked
If(A_Args[2]!=""){
	;get window handle
	TroveHWND := WinExist("ahk_exe Trove.exe")
	;Check if trove is running
	If(TroveHWND="0x0"||TroveHWND=""){
		MsgBox, 48, Error, No Trove window found
	}Else{
		;Setup the keys from the selected keyboard layout
		If (KeyboardLayout = "az"){
			TDirKey := "z"
			BDirKey := "s"
			LDirKey := "q"
			RDirKey := "d"
			MountKey := "w"
		}Else If (KeyboardLayout = "qw"){
			TDirKey := "w"
			BDirKey := "s"
			LDirKey := "a"
			RDirKey := "d"
			MountKey := "z"
		}

		;Retrieve the direction from args[2] and setup the keys
		dir := % A_Args[2]
		If (dir = "TopL"){
			xDirKey := LDirKey
			yDirKey := TDirKey
		}Else If (dir = "Top"){
			xDirKey := ""
			yDirKey := TDirKey
		}Else If (dir = "TopR"){
			xDirKey := RDirKey
			yDirKey := TDirKey
		}Else If (dir = "Left"){
			xDirKey := LDirKey
			yDirKey := "" 
		}Else If (dir = "Right"){
			xDirKey := RDirKey
			yDirKey := "" 
		}Else If (dir = "BotL"){
			xDirKey := LDirKey
			yDirKey := BDirKey
		}Else If (dir = "Bot"){
			xDirKey := ""
			yDirKey := BDirKey
		}Else If (dir = "BotR"){
			xDirKey := RDirKey
			yDirKey := BDirKey 
		}
			
		;Init the dungeon tracker count
		ClearedDungeons := 0
		Loop {
			;Start bot
			ToolTip, Dungeons completed : %ClearedDungeons%`nPress num1 to pause`nPress num0 to exit, 10, 34
			;Type respawn
			ControlSend,,{Enter}/respawn{Enter},ahk_id %TroveHWND%
			Sleep 800
			;Return to spawn
			ControlSend,,e,ahk_id %TroveHWND%
			Sleep 2000
			;Equip mount
			ControlSend,,%MountKey%,ahk_id %TroveHWND%
			Sleep 100
			;Go to rally blade
			ControlSend,,{%yDirKey% down},ahk_id %TroveHWND%
			ControlSend,,{%xDirKey% down},ahk_id %TroveHWND%
			Sleep 300
			ControlSend,,{%yDirKey% up},ahk_id %TroveHWND%
			Sleep 100
			ControlSend,,{%xDirKey% up},ahk_id %TroveHWND%
			Sleep 500
			;Activate it
			ControlSend,,e,ahk_id %TroveHWND%
			Sleep 2000
			TimeOut := 0
			FoundDungeon := 0
			Loop {
				;Search for dungeons
				Dungeon1 := PixelColorSimple(1560 , 122, TroveHWND)
				Dungeon2 := PixelColorSimple(1560 , 194, TroveHWND)
				Dungeon3 := PixelColorSimple(1560 , 266, TroveHWND)
				If (Dungeon1 = "0xFEF89A"||Dungeon2 = "0xFEF89A"||Dungeon3 = "0xFEF89A"){
				;Dungeon found
					FoundDungeon := 1
					;Exits after 3000ms*30=90s=1min30s in uncleared dungeon
					IfEqual, TimeOut, 30, Break
					TimeOut++
					;Fake human moves during 2500+500=3000ms=3s delay
					Sleep 500
					ControlSend,,&,ahk_id %TroveHWND%
					Sleep 2500
				}Else{
				;No dungeon found
					If (FoundDungeon = 1){
					;A dungeon was here
						ClearedDungeons++
						;Wait for the chest to be destroyed
						Sleep 5000
						;Pick everything in range
						ControlSend,,{e down},ahk_id %TroveHWND%
						Sleep 2000
						ControlSend,,{e up},ahk_id %TroveHWND%
					}
					;Restart If dungeon have been cleared or If no dungeons have been found
					Break
				}
			} ;EndDungeonLoop
		} ;EndMainLoop
	} ;EndHwndCheck
} ;EndArgCheck
Return

LayoutSwitch:
	If(KeyboardLayout="az"){
		KeyboardLayout := "qw"
		GuiControl,,LayoutBtn,Qwerty
	}Else{
		KeyboardLayout := "az"
		GuiControl,,LayoutBtn,Azerty
	}
Return

TopL:
	Run, NkAdvBot.ahk %KeyboardLayout% "TopL" 
Return

Top:
	Run, NkAdvBot.ahk %KeyboardLayout% "Top"
	ExitApp
Return

TopR:
	Run, NkAdvBot.ahk %KeyboardLayout% "TopR"
	ExitApp
Return

Left:
	Run, NkAdvBot.ahk %KeyboardLayout% "Left"
	ExitApp
Return

Right:
	Run, NkAdvBot.ahk %KeyboardLayout% "Right"
	ExitApp
Return

BotL:
	Run, NkAdvBot.ahk %KeyboardLayout% "BotL"
	ExitApp
Return

Bot:
	Run, NkAdvBot.ahk %KeyboardLayout% "Bot"
	ExitApp
Return

BotR:
	Run, NkAdvBot.ahk %KeyboardLayout% "BotR"
	ExitApp
Return

Numpad1::
Pause:
	If(PauseFlag=0){
		GuiControl,,Toggle,Resume
		ToolTip, The bot is paused `nPress num1 to resume, 10, 34
		PauseFlag := 1
	}Else{
		GuiControl,,Toggle,Pause
		ToolTip, Dungeons completed : %ClearedDungeons%`nPress num1 to pause`nPress num0 to exit, 10, 34
		PauseFlag := 0
	}
	Pause,,1 
Return

Numpad0::
Stop:
GuiClose:
	ExitApp
Return
	
PxChk:
	Run, NkPxChk.ahk
Return

;Functions :
;Thanks to Lexikos for his background pixel color script
PixelColorSimple(pc_x, pc_y, TroveHWND)
{
	SysGet, WindowTitleHeight, 4
	SysGet, WindowBorderWidth, 45
	pc_hDC := DllCall("GetDC", "UInt", TroveHWND)
	pc_fmtI := A_FormatInteger
	SetFormat, IntegerFast, Hex
	pc_c := DllCall("GetPixel", "UInt", pc_hDC, "Int", pc_x+WindowBorderWidth, "Int", pc_y-WindowTitleHeight, "UInt")
	pc_c := pc_c >> 16 & 0xff | pc_c & 0xff00 | (pc_c & 0xff) << 16
	pc_c .= ""
	SetFormat, IntegerFast, %pc_fmtI%
	DllCall("ReleaseDC", "UInt", TroveHWND, "UInt", pc_hDC)
	Return pc_c
}


Virus scans :
https://virusscan.jotti.org/filescanjob/irv9c9ggx0
https://www.virustotal.com/gui/file/...59c8/detection
NkAdvBot_mpgh.net.rar2 KB · 386 downloads Clean
How to use
Im new to trove hacks how to use this code?
pressing shift every 2 seconds
THIS IS AWESOME! I GOT 5 gen boxes in 3 minutes! however, i think there's a small drawback. is there a way to stop the bot pressing shift every 2 seconds? it is pressing shift and moving me away from the dungeon if i am outside. pls halp
can you do a youtube video please
can you do a youtube video please
setting it up
tried using your pixel checker and setting up the bot but it just keeps respawning even if there is a dungeon and ive set the pixel to the right coords. what could i be doing wrong?

edit: Gotten it working by using all three dungeons as different locations for the same 1 star and replaced the colours the code is looking for with the ones given by the pixel checker. bot still isnt perfect and the constant dodging sometimes puts you out of range of the dungeon but its functional for slowly leveling up and alt i guess...
although a battle royale bot would be better.
can you do a youtube video please
can you do a youtube video please
learn
Quote Originally Posted by dooknaja01 View Post
can you do a youtube video please
how about you try and use it, figure out what is and isnt working and then ask questions so people can help you fix it, the guide is pretty self explanatory and the code has instructions in it detailing what everything does. pretty sure any account that makes a video about this will be banned. and then people using this program will be banned as well. nobody wants that.
Thanks for this
mine just runs past the rally without clicking it
Bug ?
Heya There !

I got a bug, the bot just spam :Respawn and not /respawn, someone got a solution ? x)

Edit :

Just set you keybord on qwerty and it's good


Ty for the bot, rly nice ! <3
Posts 1–11 of 11 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us