Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › MultiPlayer Game Hacks & Cheats › Other MMORPG Hacks › [Release][Alpha] PokeMMO bot

Arrow[Release][Alpha] PokeMMO bot

Posts 1–15 of 34 · Page 1 of 3
FR
franklin01
[Release][Alpha] PokeMMO bot
Regarding this message: http://www.mpgh.net/forum/247-other-...ml#post8833984
Since PokeMMO multibot is no longer supported I will try to provide another one.

First release still in work but can be used: The UglyBot !

Features:
*walk around in square/line
*fight pokemons
*can switch to train another one
*can use another attack

Bugs:
*it will not decline or accept other players invitations, make sure you are set to automatically decline things
*I don't know how it reacts to evolve and new moves learning as it didn't happen to me yet but will figure something when time comes

How to use:
Set game to 1024x768 !
At first start it will generate a setting.ini file with setings, read and edit it.
Find a grassy area and start the thing.

Note: It is a very early thing that work but can and probably will be improved. Tested on win xp x64 and win 7 x86.
I don't know what was in the PokeMMO Multibot so request features here and I will try to make it happen.
If you want to support you can throw a penny here.
LTC: LfHAabU9Lqzn6sgdYcfoLZFoZjf36PW3rf
NMC: N7P667yC5aMTUFb4h7S1UVbMzvvmfZsXjw

Virus scan:
uglybot-bin.zip MD5:bd689623ac3159ff2eeba432abc7c9b2 - VirSCAN.org 8% Scanner(s) (3/37) found malware!
https://www.virustotal.com/fr/file/9...is/1386458012/
Attachment:
*uglybot-bin_mpgh.net.zip includes everything
*pp.png and pp2.png are for people that want to build from source. If done so you will need dlls for imagesearch that can be found on google.

Source (autoit):
Code:
; note: can be improved, if so please share with the comunity
; If you want to support you can throw a penny here.
; LTC: LfHAabU9Lqzn6sgdYcfoLZFoZjf36PW3rf
; NMC: N7P667yC5aMTUFb4h7S1UVbMzvvmfZsXjw


#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#Include <Array.au3>
#Include <File.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <ScrollBarConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiComboBox.au3>
#Include <GuiListBox.au3>
#include <GuiButton.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <Math.au3>
#include <GuiListBox.au3>


Opt("WinTitleMatchMode", 1)
Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)

If Not FileExists("config.ini") Then
IniWrite("config.ini", "setting", "log", "0")
IniWrite("config.ini", "setting", "user", '"user"')
IniWrite("config.ini", "setting", "pass", '"pass"')
IniWrite("config.ini", "setting", "debug", "0")
IniWrite("config.ini", "setting", "train", "0")
IniWrite("config.ini", "setting", "square", "1")
IniWrite("config.ini", "setting", "walktime", "500")
IniWrite("config.ini", "setting", "abutton", "z")
IniWrite("config.ini", "setting", "bbutton", "x")
IniWrite("config.ini", "setting", "How to use:", "")
IniWrite("config.ini", "setting", "log = 1 enable autologin, if used make sure you have set your ids", "")
IniWrite("config.ini", "setting", 'user and pass must be in "quotation mark" in order to be used.', "")
IniWrite("config.ini", "setting", "debug enable logging so you can see where it get stuck if it does.", "")
IniWrite("config.ini", "setting", "train = 1 enable pokemon switching, used to train a low level by fighting with the second pokemon.", "")
IniWrite("config.ini", "setting", "square = 1 enable walking in square, if set to 0 then walk on a straight line up/down, if set to 2 left/right", "")
IniWrite("config.ini", "setting", "walktime = time in ms that you walk (in each direction) recomended 500 for small squares/lines or 1000 for longer trip", "")
IniWrite("config.ini", "setting", 'abutton = key set to A, must be in "quotation mark"', "")
IniWrite("config.ini", "setting", 'bbutton = key set to B, must be in "quotation mark"', "")
EndIf

Dim $abutton = IniRead("config.ini", "setting", "abutton", "z")
Dim $bbutton = IniRead("config.ini", "setting", "bbutton", "x")
Dim $square = IniRead("config.ini", "setting", "square", "1")
Dim $walktime = IniRead("config.ini", "setting", "walktime", "500")
Dim $job
Dim $Label1
Dim $Label2
Dim $Label3
Dim $Label4
Dim $Label5
Dim $info1
Dim $info2
Dim $info3
Dim $info4 = "Press [Pause] to pause / F11 to resume / F12 to quit"
Dim $info5 = "Debug enabled"
Dim $image
Dim $image2
Dim $pos
Dim $walk = 0
Dim $log = IniRead("config.ini", "setting", "log", "0")
Dim $dll = DllOpen("user32.dll")
Global $x, $y, $image
Dim $user = IniRead("config.ini", "setting", "user", "")
Dim $pass = IniRead("config.ini", "setting", "pass", "")
Dim $debug = IniRead("config.ini", "setting", "debug", "0")
Dim $change = 0
Dim $train = IniRead("config.ini", "setting", "train", "0")


$job = start()

HotKeySet("{PAUSE}", "TogglePause")

If $debug = 1 Then
	GUICreate("uglybot", 225, 300, 20, 0, BitOr($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
	$Label5 = GUICtrlCreateList("debug menu", 0, 96, 225, 200, BitOr($WS_BORDER, $WS_VSCROLL))

	GUICtrlSetLimit(-1, 200)
Else
	GUICreate("uglybot", 225, 100, 20, 0, BitOr($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
EndIf

$Label1 = GUICtrlCreateLabel("Label1", 0, 0, 225, 25)
$Label2 = GUICtrlCreateLabel("Label2", 0, 24, 225, 25)
$Label3 = GUICtrlCreateLabel("Label3", 0, 48, 225, 25)
$Label4 = GUICtrlCreateLabel("Label3", 0, 72, 225, 25)

GUISetState()

 While 1
	Sleep(100)
	If _IsPressed("7B", $dll) Then
		Exit
	EndIf
	GUICtrlSetData($Label1, $info1)
	GUICtrlSetData($Label2, $info2)
	GUICtrlSetData($label3, $info3)
	GUICtrlSetData($label4, $info4)
	If $debug = 1 Then
		$info5 = "Processing..."
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf

	Switch $job
		Case 1
			$job = start()
		Case 2
			$job = state()
		Case 3
			$job = fight()
		Case 4
			$job = walk()
		Case 5
			$job = login()
   EndSwitch
WEnd

Func fight()
		If $debug = 1 Then
		$info5 = "In fight"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
	$image = PixelSearch( 110, 395, 540, 540, 0xCFA806, 5)
	If IsArray($image) Then
		Sleep(50)
		Send($bbutton)
			If $debug = 1 Then
		$info5 = "In attack"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
		If $train = 1 And $change = 0 Then
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send($abutton)
			Sleep(500)
			$change = 1
		Else
			$info3 = "Attacking."
			GUICtrlSetData($label3, $info3)
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			$i = 0
			While $i < 3
				If $debug = 1 Then
					$info5 = "in pp check"
					_GUICtrlListBox_BeginUpdate($label5)
					_GUICtrlListBox_InsertString($Label5, $info5)
					_GUICtrlListBox_EndUpdate($Label5)
					$iIndex = _GUICtrlListBox_GetCurSel($Label5)
					$iIndex = $iIndex + 1
					_GUICtrlListBox_SetCurSel($label5, $iIndex)
				EndIf
				$info3 = "Got PP?"
				GUICtrlSetData($label3, $info3)
				Sleep(500)
				$i = $i + 1
				$image2 = _ImageSearchArea('pp2.png', 1, 100, 300, 520, 570, $x, $y, 80)
				$image = _ImageSearchArea('pp.png', 1, 110, 400, 320, 470, $x, $y, 50)
				If $image = 1 Or $image2 = 1 Then
					$info3 = "Warning no PP"
					GUICtrlSetData($label3, $info3)
					Send("{LEFT}")
					Sleep(50)
					Send("{UP}")
					Sleep(50)
					Send("{RIGHT}")
					Sleep(50)
					Send($abutton)
					Sleep(50)
					Return 1
				EndIf
			WEnd
			If $debug = 1 Then
			$info5 = "pp checked and ok"
			_GUICtrlListBox_BeginUpdate($label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Still some PP..."
			GUICtrlSetData($label3, $info3)
			$i = 0
			Send($abutton)
			Sleep(50)
		EndIf
		Return 1
	EndIf
	$image = PixelSearch( 875, 515, 895, 535, 0xFFFFFF, 5)
	If IsArray($image) Then
			If $debug = 1 Then
		$info5 = "input required"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
		$info3 = "Input needed."
		GUICtrlSetData($label3, $info3)
		Sleep(50)
		Send($bbutton)
		Sleep(50)
		Return 1
	EndIf
		If $debug = 1 Then
		$info5 = "right stick fight check"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
	Sleep(50)
	Send("{RIGHT}")
	Return 1
EndFunc


Func walk()
	$change = 0
	If $debug = 1 Then
		$info5 = "in walk"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
	If $square = 1 Then
		If $walk < 1 Then
				If $debug = 1 Then
				$info5 = "walking down"
				_GUICtrlListBox_BeginUpdate($label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Walking down."
			GUICtrlSetData($label3, $info3)
			Send("{DOWN down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{DOWN up}")
			$walk = 1
			Sleep(50)
			Return 1
		EndIf

		If $walk < 2 Then
				If $debug = 1 Then
				$info5 = "walking left"
				_GUICtrlListBox_BeginUpdate($label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Walking left."
			GUICtrlSetData($label3, $info3)
			Send("{LEFT down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{LEFT up}")
			$walk = 2
			Sleep(50)
			Return 1
		EndIf

		If $walk < 3 Then
				If $debug = 1 Then
				$info5 = "walking up"
				_GUICtrlListBox_BeginUpdate($label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Walking up."
			GUICtrlSetData($label3, $info3)
			Send("{UP down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{UP up}")
			$walk = 3
			Sleep(50)
			Return 1
		EndIf

		If $walk < 4 Then
				If $debug = 1 Then
				$info5 = "walking right"
				_GUICtrlListBox_BeginUpdate($label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Walking right."
			GUICtrlSetData($label3, $info3)
			Send("{RIGHT down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{RIGHT up}")
			$walk = 0
			Sleep(50)
			Return 1
		EndIf
	EndIf

	If $square = 0 Then
		If $walk < 1 Then
			If $debug = 1 Then
				$info5 = "walking down"
				_GUICtrlListBox_BeginUpdate($label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Walking down."
			GUICtrlSetData($label3, $info3)
			Send("{DOWN down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{DOWN up}")
			$walk = 1
			Sleep(50)
			Return 1
		EndIf

		If $walk < 2 Then
			If $debug = 1 Then
				$info5 = "walking up"
				_GUICtrlListBox_BeginUpdate($label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Walking up."
			GUICtrlSetData($label3, $info3)
			Send("{UP down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{UP up}")
			$walk = 0
			Sleep(50)
			Return 1
		EndIf
	EndIf
	If $square = 2 Then
		If $walk < 1 Then
			If $debug = 1 Then
				$info5 = "walking left"
				_GUICtrlListBox_BeginUpdate($label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Walking left."
			GUICtrlSetData($label3, $info3)
			Send("{LEFT down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{LEFT up}")
			$walk = 1
			Sleep(50)
			Return 1
		EndIf

		If $walk < 2 Then
			If $debug = 1 Then
				$info5 = "walking right"
				_GUICtrlListBox_BeginUpdate($label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($label5, $iIndex)
			EndIf
			$info3 = "Walking right."
			GUICtrlSetData($label3, $info3)
			Send("{RIGHT down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{RIGHT up}")
			$walk = 0
			Sleep(50)
			Return 1
		EndIf
	EndIf
Return 1
EndFunc

Func login();return 3 -OK
		If $debug = 1 Then
		$info5 = "in login"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
	  If $log = 1 Then
		  	If $debug = 1 Then
		$info5 = "loggin in"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
		$info3 = "Loggin in..."
		GUICtrlSetData($label3, $info3)
		 Sleep(500)
		 MouseClick("left", 582, 351, 2, 0);login
		 Sleep(50)
		 Send("{BS down}")
		 Sleep(1700)
		 Send("{BS up}")
		 Sleep(50)
		 Send("{DEL down}")
		 Sleep(1700)
		 Send("{DEL up}")
		 Sleep(50)
		 Send($user)
		 Sleep(50)
		 MouseClick("left", 590, 382, 2, 0);pass
		 Sleep(50)
		 Send("{BS down}")
		 Sleep(1500)
		 Send("{BS up}")
		 Sleep(50)
		 Send("{DEL down}")
		 Sleep(1500)
		 Send("{DEL up}")
		 Sleep(50)
		 Send($pass)
		 Sleep(50)
		 MouseClick("left", 574, 414, 2, 0);pass
		 Sleep(3000)
		 MouseClick("left", 598, 288, 2, 0);pass
		 Sleep(3000)
		 MouseClick("left", 504, 368, 2, 0);pass
		 Sleep(3000)
		$info3 = "Logged in."
		GUICtrlSetData($label3, $info3)
		 Return 1;start
	 Else
		 	If $debug = 1 Then
		$info5 = "autolog set to no"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
		$info3 = "Autologin not enabled, please login."
		GUICtrlSetData($label3, $info3)
		Return 1;start
	  EndIf
EndFunc


Func state()
		If $debug = 1 Then
		$info5 = "in state"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
	$image = PixelSearch( 200, 400, 700, 420, 0x1D415D, 3)
	If IsArray($image) Then
			If $debug = 1 Then
		$info5 = "fight found"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
		$info2 = "Player is fighting."
		GUICtrlSetData($label2, $info2)
		Sleep(50)
		Return 3
	EndIf
	$image = PixelSearch( 500, 85, 520, 95, 0xF3EA6D, 3)
	If IsArray($image) Then
			If $debug = 1 Then
		$info5 = "login found"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
		$info2 = "Player is at login."
		GUICtrlSetData($label2, $info2)
		Sleep(50)
		Return 5
	EndIf
		If $debug = 1 Then
		$info5 = "nothing found"
		_GUICtrlListBox_BeginUpdate($label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($label5, $iIndex)
	EndIf
	$info2 = "Player is looking for pokemon."
	GUICtrlSetData($label2, $info2)
	Sleep(50)
	Return 4
EndFunc


 Func start()
    If Not WinExists("[CLASS:LWJGL]") Then
		$info1 = "Window not found, waiting for game."
		GUICtrlSetData($label1, $info1)
		Sleep(50)
		Return 1
	EndIf
	WinActivate("[CLASS:LWJGL]")
	$info1 = "Window found, waiting for game focus."
	GUICtrlSetData($label1, $info1)
	Sleep(50)
	If WinActive("[CLASS:LWJGL]") Then
		$pos = WinGetPos("[CLASS:LWJGL]")
		$info1 = "Window found, focus OK."
		WinMove("[CLASS:LWJGL]", "", $pos[0], $pos[1], 1032, 795)
		GUICtrlSetData($label1, $info1)
		Sleep(50)
		Return 2
	EndIf
	Sleep(50)
	Return 1
EndFunc

Func _ImageSearchArea($FindImage, $ResultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $Tolerance)
   If $Tolerance > 0 Then $FindImage = "*" & $Tolerance & " " & $FindImage

   If  @autoItX64 Then
	  $Result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $FindImage)
   Else
	  $Result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $FindImage)
   EndIf

   If $Result = "0" Then Return 0

   $Array = StringSplit($Result[0], "|")

   If (UBound($Array) >= 4) Then
	  $x = Int(Number($Array[2]))
	  $y = Int(Number($Array[3]))

	  If $ResultPosition = 1 Then
		 $x = $x + Int(Number($Array[4]) / 2)
		 $y = $y + Int(Number($Array[5]) / 2)
	  EndIf
	  Return 1
   EndIf
EndFunc

Func TogglePause()
	While 1
		$info1 = "PAUSED PRESS F11 TO RESUME / F12 to quit"
		GUICtrlSetData($label1, $info1)
		Sleep(100)
		TrayTip("", "Paused", 500000000)
		If _IsPressed("7B", $dll) Then
			Exit
		EndIf
		If _IsPressed("7A", $dll) Then
			Return 1
		EndIf
	WEnd
EndFunc


(being bad at text formating in someone want to make this post nicer feel free to do so)
uglybot-bin_mpgh.net.zip pp2.png pp.png
#1 · edited 12y ago · 12y ago
Bernard.
Bernard
Looks alright.

#Approved
#2 · 12y ago
FR
franklin01
Update 1



Changelog:
Code:
*fixed move detection
*fixed death detection
*added fishbot
*added gui configuration
*added sound alarm for move detection
*changed hotkeys
*missing files detection
*small fixes
Note:

Things got updated.
In order to use FishBot make sure you ticked off "draw weather change" in game option otherwise it wont work at night.
Make sure you are under a Pokemon Center, strait line up/down.
Password is now kinda encrypted in setting file.
If Auto forget move is set to no, a sound alarm will be activated so you can choose the move.
Hotkeys have been changed to: F7 = pause / F8 = resume / F9 = quit
If for some reason you have low fps, turn off gui in game (F12).
You still need to be running using 1024x768 settings but it might work on other settings, not tested yet.
FishBot was not testes using FireRed only, try or use HeartGold textures.

Virus scan for uglybot + sourcev0.1.zip:
https://www.virustotal.com/fr/file/1...is/1386610666/
uglybot + sourcev0.1.zip MD5:4daee95bc11cd87a1eb7ff2965307d2b - VirSCAN.org 8% Scanner(s) (3/37) found malware!

As always tested on Win xp x64 / Win 7 x86 / Win 8 x64.

You can report bug or request features.

UglyBot v0.1 source:

Code:
; note: can be improved, if so please share with the comunity
; If you want to support you can throw a penny here.
; LTC: LfHAabU9Lqzn6sgdYcfoLZFoZjf36PW3rf
; NMC: N7P667yC5aMTUFb4h7S1UVbMzvvmfZsXjw

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <Array.au3>
#include <File.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <ScrollBarConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <GuiListBox.au3>
#include <GuiButton.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <Math.au3>
#include <GuiListBox.au3>

Opt("WinTitleMatchMode", 1)
Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)

If Not FileExists("ImageSearchDLL.dll") Then
	MsgBox(4096, "ImageSearchDLL.dll not found, some features will not be available.", 10)
EndIf
If Not FileExists("ImageSearchDLL_x64.dll") Then
	MsgBox(4096, "ImageSearchDLL_x64.dll not found, some features will not be available.", 10)
EndIf
If Not FileExists("move.png") Then
	MsgBox(4096, "move.png not found, some features will not be available.", 10)
EndIf
If Not FileExists("pp.png") Then
	MsgBox(4096, "pp.png not found, some features will not be available.", 10)
EndIf
If Not FileExists("pp.png") Then
	MsgBox(4096, "pp2.png not found, some features will not be available.", 10)
EndIf
If Not FileExists("move.wav") Then
	MsgBox(4096, "move.wav not found, some features will not be available.", 10)
EndIf

If Not FileExists("config.ini") Then
	MsgBox(4096, "config.ini not found, creating a new one.", 10)
EndIf

Dim $abutton
Dim $bbutton
Dim $square
Dim $walktime
Dim $moveforget
Dim $job
Dim $Label1
Dim $Label2
Dim $Label3
Dim $Label4
Dim $read = 0
Dim $fish
Dim $hurt = 1
Dim $canebutton = "{F5}"
Dim $Label5
dim $atk
Dim $count = 0
Dim $something = 0
Dim $info1
Dim $info2
Dim $info3
Dim $info4 = "Press [Pause] to pause / F11 to resume / F12 to quit"
Dim $info5 = "Debug enabled"
Dim $image
Dim $image2
Dim $pos
Dim $walk = 0
Dim $log
Dim $dll = DllOpen("user32.dll")
Global $x, $y, $image
Dim $user
Dim $pass
Dim $debug
Dim $change = 0
Dim $train

$job = setting()

HotKeySet("{F7}", "TogglePause")
HotKeySet("{F9}", "quit")

If $debug = 1 Then
	GUICreate("uglybot", 225, 300, 20, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
	$Label5 = GUICtrlCreateList("debug menu", 0, 96, 225, 200, BitOR($WS_BORDER, $WS_VSCROLL))

	GUICtrlSetLimit(-1, 200)
Else
	GUICreate("uglybot", 225, 100, 20, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
EndIf

$Label1 = GUICtrlCreateLabel("Label1", 0, 0, 225, 25)
$Label2 = GUICtrlCreateLabel("Label2", 0, 24, 225, 25)
$Label3 = GUICtrlCreateLabel("Label3", 0, 48, 225, 25)
$Label4 = GUICtrlCreateLabel("Label3", 0, 72, 225, 25)

GUISetState()

While 1
	Sleep(100)
	GUICtrlSetData($Label1, $info1)
	GUICtrlSetData($Label2, $info2)
	GUICtrlSetData($Label3, $info3)
	GUICtrlSetData($Label4, $info4)
	If $debug = 1 Then
		$info5 = "Processing..."
		_GUICtrlListBox_BeginUpdate($Label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf

	Switch $job
		Case 1
			$job = start()
		Case 2
			$job = state()
		Case 3
			$job = fight()
		Case 4
			$job = walk()
		Case 5
			$job = login()
		Case 5
			$job = setting()
		Case 6
			$job = fishbot()
	EndSwitch
WEnd

Func fight()
	If $something = 1 Then
		$count = $count + 1
		$something = 0
	EndIf

	If $debug = 1 Then
		$info5 = "In fight"
		_GUICtrlListBox_BeginUpdate($Label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	$image = PixelSearch(110, 395, 750, 540, 0x8DC655, 5);greenbar
	If IsArray($image) Then
		MouseClick("left", $image[0], $image[1], 1, 0)
		Sleep(50)
		Send($bbutton)
		Sleep(50)
		Return 1
	EndIf

	$image = PixelSearch(110, 395, 540, 540, 0xCFA806, 5);orange
	If IsArray($image) Then
		Sleep(50)
		Send($bbutton)
		If $debug = 1 Then
			$info5 = "In attack"
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
		If $train = 1 And $change = 0 Then
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send($abutton)
			Sleep(500)
			$change = 1
		Else
			$info3 = "Attacking."
			GUICtrlSetData($Label3, $info3)
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			$i = 0
			$atk = Random(1, 5)
			Sleep(50)
			If $atk > 4 Then
					Send("{LEFT}")
					Sleep(50)
					Send("{UP}")
					Sleep(50)
					Send("{RIGHT}")
					Sleep(50)
					Send($abutton)
					Sleep(50)
					Return 1
			EndIf
			While $i < 3
				If $debug = 1 Then
					$info5 = "in pp check"
					_GUICtrlListBox_BeginUpdate($Label5)
					_GUICtrlListBox_InsertString($Label5, $info5)
					_GUICtrlListBox_EndUpdate($Label5)
					$iIndex = _GUICtrlListBox_GetCurSel($Label5)
					$iIndex = $iIndex + 1
					_GUICtrlListBox_SetCurSel($Label5, $iIndex)
				EndIf
				$info3 = "Got PP?"
				GUICtrlSetData($Label3, $info3)
				Sleep(500)
				$i = $i + 1
				$image2 = _ImageSearchArea('pp2.png', 1, 100, 300, 520, 570, $x, $y, 80)
				$image = _ImageSearchArea('pp.png', 1, 110, 400, 320, 470, $x, $y, 50)
				If $image = 1 Or $image2 = 1 Then
					$info3 = "Warning no PP"
					GUICtrlSetData($Label3, $info3)
					Send("{LEFT}")
					Sleep(50)
					Send("{UP}")
					Sleep(50)
					Send("{RIGHT}")
					Sleep(50)
					Send($abutton)
					Sleep(50)
					Return 1
				EndIf
			WEnd
			If $debug = 1 Then
				$info5 = "pp checked and ok"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Still some PP..."
			GUICtrlSetData($Label3, $info3)
			$i = 0
			Send("{LEFT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
		EndIf
		Return 1
	EndIf
	$image = PixelSearch(875, 515, 895, 535, 0xFFFFFF, 5)
	If IsArray($image) Then
		If $debug = 1 Then
			$info5 = "input required"
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
		$info3 = "Input needed."
		GUICtrlSetData($Label3, $info3)
		Sleep(50)
		Send($bbutton)
		Sleep(50)
		Return 1
	EndIf
	If $debug = 1 Then
		$info5 = "right stick fight check"
		_GUICtrlListBox_BeginUpdate($Label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	Sleep(50)
	Send("{RIGHT}")
	Sleep(50)

	$image = PixelSearch(780, 430, 800, 450, 0x839299, 5)
	If IsArray($image) Then
		If $moveforget = 1 Then
			$info3 = "Move detected"
			GUICtrlSetData($Label3, $info3)
			Sleep(50)
			MouseClick("left", $image[0], $image[1], 1, 0)
			Sleep(50)
			MouseClick("left", 509, 377, 1, 0)
			Sleep(50)
			Return 1
		Else
			SoundPlay("move.wav", 1)
			Sleep(500)
			Return 1
		EndIf
	EndIf
	Return 1
EndFunc   ;==>fight

Func walk()
	$change = 0
	If $debug = 1 Then
		$info5 = "in walk"
		_GUICtrlListBox_BeginUpdate($Label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	If $square = 1 Then
		If $walk < 1 Then
			If $debug = 1 Then
				$info5 = "walking down"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Walking down."
			GUICtrlSetData($Label3, $info3)
			Send("{DOWN down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{DOWN up}")
			$walk = 1
			Sleep(50)
			Return 1
		EndIf

		If $walk < 2 Then
			If $debug = 1 Then
				$info5 = "walking left"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Walking left."
			GUICtrlSetData($Label3, $info3)
			Send("{LEFT down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{LEFT up}")
			$walk = 2
			Sleep(50)
			Return 1
		EndIf

		If $walk < 3 Then
			If $debug = 1 Then
				$info5 = "walking up"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Walking up."
			GUICtrlSetData($Label3, $info3)
			Send("{UP down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{UP up}")
			$walk = 3
			Sleep(50)
			Return 1
		EndIf

		If $walk < 4 Then
			If $debug = 1 Then
				$info5 = "walking right"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Walking right."
			GUICtrlSetData($Label3, $info3)
			Send("{RIGHT down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{RIGHT up}")
			$walk = 0
			Sleep(50)
			Return 1
		EndIf
	EndIf

	If $square = 0 Then
		If $walk < 1 Then
			If $debug = 1 Then
				$info5 = "walking down"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Walking down."
			GUICtrlSetData($Label3, $info3)
			Send("{DOWN down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{DOWN up}")
			$walk = 1
			Sleep(50)
			Return 1
		EndIf

		If $walk < 2 Then
			If $debug = 1 Then
				$info5 = "walking up"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Walking up."
			GUICtrlSetData($Label3, $info3)
			Send("{UP down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{UP up}")
			$walk = 0
			Sleep(50)
			Return 1
		EndIf
	EndIf
	If $square = 2 Then
		If $walk < 1 Then
			If $debug = 1 Then
				$info5 = "walking left"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Walking left."
			GUICtrlSetData($Label3, $info3)
			Send("{LEFT down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{LEFT up}")
			$walk = 1
			Sleep(50)
			Return 1
		EndIf

		If $walk < 2 Then
			If $debug = 1 Then
				$info5 = "walking right"
				_GUICtrlListBox_BeginUpdate($Label5)
				_GUICtrlListBox_InsertString($Label5, $info5)
				_GUICtrlListBox_EndUpdate($Label5)
				$iIndex = _GUICtrlListBox_GetCurSel($Label5)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label5, $iIndex)
			EndIf
			$info3 = "Walking right."
			GUICtrlSetData($Label3, $info3)
			Send("{RIGHT down}")
			Sleep(Random($walktime, $walktime + 100, 1))
			Send("{RIGHT up}")
			$walk = 0
			Sleep(50)
			Return 1
		EndIf
	EndIf
	Return 1
EndFunc   ;==>walk

Func login();return 3 -OK
	If $debug = 1 Then
		$info5 = "in login"
		_GUICtrlListBox_BeginUpdate($Label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	If $log = 1 Then
		If $debug = 1 Then
			$info5 = "loggin in"
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
		$info3 = "Loggin in..."
		GUICtrlSetData($Label3, $info3)
		Sleep(500)
		MouseClick("left", 582, 351, 2, 0);login
		Sleep(50)
		Send("{BS down}")
		Sleep(1700)
		Send("{BS up}")
		Sleep(50)
		Send("{DEL down}")
		Sleep(1700)
		Send("{DEL up}")
		Sleep(50)
		Send($user)
		Sleep(50)
		Send("{TAB}")
		Sleep(50)
		Send("{BS down}")
		Sleep(1500)
		Send("{BS up}")
		Sleep(50)
		Send("{DEL down}")
		Sleep(1500)
		Send("{DEL up}")
		Sleep(50)
		Send($pass)
		Sleep(50)
		Send("{ENTER}")
		Sleep(3000)
		Send("{ENTER}")
		Sleep(3000)
		Send("{ENTER}")
		Sleep(3000)
		$info3 = "Logged in."
		GUICtrlSetData($Label3, $info3)
		Return 1;start
	Else
		If $debug = 1 Then
			$info5 = "autolog set to no"
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
		$info3 = "Autologin not enabled, please login."
		GUICtrlSetData($Label3, $info3)
		Return 1;start
	EndIf
EndFunc   ;==>login

Func state()
	If $debug = 1 Then
		$info5 = "in state"
		_GUICtrlListBox_BeginUpdate($Label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	$image = PixelSearch(200, 400, 700, 420, 0x1D415D, 3)
	If IsArray($image) Then
		If $debug = 1 Then
			$info5 = "fight found"
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
		$info2 = "Player is fighting."
		GUICtrlSetData($Label2, $info2)
		Sleep(50)
		Return 3
	EndIf
	$image = PixelSearch(500, 85, 520, 95, 0xF3EA6D, 3)
	If IsArray($image) Then
		If $debug = 1 Then
			$info5 = "login found"
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
		$info2 = "Player is at login."
		GUICtrlSetData($Label2, $info2)
		Sleep(50)
		Return 5
	EndIf
	If $debug = 1 Then
		$info5 = "nothing found"
		_GUICtrlListBox_BeginUpdate($Label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	$info2 = "Player is looking for pokemon."
	GUICtrlSetData($Label2, $info2)
	Sleep(50)
	If $fish = 1 Then
		Return 6
	Else
		Return 4
	EndIf
Return 1
EndFunc   ;==>state

Func start()
	$info1 = "Running..."
	GUICtrlSetData($Label1, $info1)
				If $read = 0 Then
					$log = IniRead("config.ini", "setting", "log", "0")
					If $log = 1 Then
						$user =  IniRead("config.ini", "setting", "user", "")
						$pass = BinaryToString(IniRead("config.ini", "setting", "pass", '"passdefault"'), 4)
					EndIf
					$debug = IniRead("config.ini", "setting", "debug", "0")
					$train = IniRead("config.ini", "setting", "train", "0")
					$square = IniRead("config.ini", "setting", "square", "0")
					$walktime = IniRead("config.ini", "setting", "walktime", "800")
					$abutton = IniRead("config.ini", "setting", "abutton", "z")
					$bbutton = IniRead("config.ini", "setting", "bbutton", "x")
					$moveforget = IniRead("config.ini", "setting", "moveforget", "0")
					$fish = IniRead("config.ini", "setting", "fish", "0")
					$read = 1
				EndIf

	$info4 = "F7 to pause / F8 to resume / F9 to quit"
	If Not WinExists("[CLASS:LWJGL]") Then
		$info1 = "Window not found, waiting for game."
		GUICtrlSetData($Label1, $info1)
		Sleep(50)
		Return 1
	EndIf
	If WinActive("[CLASS:LWJGL]") Then
		$pos = WinGetPos("[CLASS:LWJGL]")
		$info1 = "Window found, focus OK."
		WinMove("[CLASS:LWJGL]", "", $pos[0], $pos[1], 1032, 795)
		GUICtrlSetData($Label1, $info1)
		Sleep(50)
		Return 2
	EndIf
	WinActivate("[CLASS:LWJGL]")
	$info1 = "Window found, waiting for game focus."
	GUICtrlSetData($Label1, $info1)
	Sleep(50)
	Return 1
EndFunc   ;==>start

Func _ImageSearchArea($FindImage, $ResultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $Tolerance)
	If $Tolerance > 0 Then $FindImage = "*" & $Tolerance & " " & $FindImage

	If    @autoItX64 Then
		$Result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $FindImage)
	Else
		$Result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $FindImage)
	EndIf

	If $Result = "0" Then Return 0

	$Array = StringSplit($Result[0], "|")

	If (UBound($Array) >= 4) Then
		$x = Int(Number($Array[2]))
		$y = Int(Number($Array[3]))

		If $ResultPosition = 1 Then
			$x = $x + Int(Number($Array[4]) / 2)
			$y = $y + Int(Number($Array[5]) / 2)
		EndIf
		Return 1
	EndIf
EndFunc   ;==>_ImageSearchArea

Func TogglePause()
	While 1
		$info1 = "PAUSED PRESS F8 TO RESUME / F9 TO QUIT"
		GUICtrlSetData($Label1, $info1)
		Sleep(100)
		If _IsPressed("77", $dll) Then
			Return 1
		EndIf
	WEnd
EndFunc   ;==>TogglePause

Func quit()
		Sleep(100)
			Exit
EndFunc   ;==>TogglePause

Func setting()

	#region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\Desktop\pokemmo bot\koda\Forms\Form1.kxf
	$Form1 = GUICreate("UglyBot Setting", 466, 294, 287, 138)
	$Label1 = GUICtrlCreateLabel("Auto Login", 16, 8, 55, 17)
	$Label2 = GUICtrlCreateLabel("Username", 16, 36, 52, 17)
	$Label3 = GUICtrlCreateLabel("Password", 16, 63, 50, 17)
	$Label4 = GUICtrlCreateLabel("Debug Mode", 16, 91, 66, 17)
	$Label5 = GUICtrlCreateLabel("Training", 16, 118, 42, 17)
	$Label6 = GUICtrlCreateLabel("Walking type", 16, 146, 66, 17)
	$Label7 = GUICtrlCreateLabel("Walking time (ms)", 16, 173, 85, 17)
	$Label8 = GUICtrlCreateLabel("Button A", 16, 201, 45, 17)
	$Label9 = GUICtrlCreateLabel("Button B", 16, 228, 45, 17)
	$Button1 = GUICtrlCreateButton("Save and start", 16, 256, 89, 25)
	$Checkbox1 = GUICtrlCreateCheckbox("", 104, 8, 97, 17)
	$Checkbox2 = GUICtrlCreateCheckbox("", 104, 89, 17, 17)
	$Radio1 = GUICtrlCreateRadio("Square", 104, 143, 113, 17)
	$Radio2 = GUICtrlCreateRadio("Left/Right", 224, 144, 113, 17)
	$Radio3 = GUICtrlCreateRadio("Up/Down", 344, 144, 113, 17)
	$Input3 = GUICtrlCreateInput("500", 104, 170, 121, 21)
	$Input4 = GUICtrlCreateInput("Z", 104, 197, 121, 21)
	$Input5 = GUICtrlCreateInput("X", 104, 224, 121, 21)
	$Checkbox3 = GUICtrlCreateCheckbox("", 104, 116, 17, 17)
	$Checkbox4 = GUICtrlCreateCheckbox("Forget new Moves", 144, 116, 107, 17)
	$Checkbox5 = GUICtrlCreateCheckbox("FishBot (F5)", 144, 89, 107, 17)
	GUISetState(@SW_SHOW)
	#endregion ### END Koda GUI section ###

	If Not FileExists("config.ini") Then
		IniWrite("config.ini", "setting", "log", "0")
		IniWrite("config.ini", "setting", "user", '"user"')
		IniWrite("config.ini", "setting", "pass", '"pass"')
		IniWrite("config.ini", "setting", "debug", "0")
		IniWrite("config.ini", "setting", "train", "0")
		IniWrite("config.ini", "setting", "square", "1")
		IniWrite("config.ini", "setting", "walktime", "500")
		IniWrite("config.ini", "setting", "abutton", "z")
		IniWrite("config.ini", "setting", "bbutton", "x")
		IniWrite("config.ini", "setting", "moveforget", "0")
		IniWrite("config.ini", "setting", "fish", "0")
	EndIf


	If IniRead("config.ini", "setting", "log", "0") = 1 Then
		_GUICtrlButton_SetCheck($Checkbox1)
		$Input1 = GUICtrlCreateInput("", 104, 35, 97, 21)
		$Input2 = GUICtrlCreateInput("", 104, 62, 97, 21, $ES_PASSWORD)
		GUICtrlSetData($Input1, IniRead("config.ini", "setting", "user", '"userdefault"'))
		$pass = BinaryToString(IniRead("config.ini", "setting", "pass", '"passdefault"'), 4)
		GUICtrlSetData($Input2, $pass)
		$log = 1
	Else
		$log = 0
	EndIf
	If IniRead("config.ini", "setting", "debug", "0") = 1 Then
		_GUICtrlButton_SetCheck($Checkbox2)
		$debug = 1
	Else
		$debug = 0
	EndIf
	If IniRead("config.ini", "setting", "train", "0") = 1 Then
		_GUICtrlButton_SetCheck($Checkbox3)
		$train = 1
	Else
		$train = 0
	EndIf
	If IniRead("config.ini", "setting", "square", "1") = 0 Then
		_GUICtrlButton_SetCheck($Radio3)
		_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
		_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
		$square = 0
	EndIf
	If IniRead("config.ini", "setting", "square", "1") = 2 Then
		_GUICtrlButton_SetCheck($Radio2)
		_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
		_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
		$square = 2
	EndIf
	If IniRead("config.ini", "setting", "square", "1") = 1 Then
		_GUICtrlButton_SetCheck($Radio1)
		_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
		_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
		$square = 1
	EndIf
	If Not IniRead("config.ini", "setting", "square", "1") = 1 And Not IniRead("config.ini", "setting", "square", "1") = 0 And Not IniRead("config.ini", "setting", "square", "1") = 2 Then
		_GUICtrlButton_SetCheck($Radio3)
		_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
		_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
		$square = 0
	EndIf
	GUICtrlSetData($Input3, IniRead("config.ini", "setting", "walktime", "500"))
	GUICtrlSetData($Input4, IniRead("config.ini", "setting", "abutton", "z"))
	GUICtrlSetData($Input5, IniRead("config.ini", "setting", "bbutton", "x"))
	If IniRead("config.ini", "setting", "moveforget", "1") = 1 Then
		_GUICtrlButton_SetCheck($checkbox4)
		$moveforget = 1
	Else
		$moveforget = 0
	EndIf

	If IniRead("config.ini", "setting", "fish", "0") = 1 Then
		_GUICtrlButton_SetCheck($checkbox5)
		$fish = 1
	Else
		$fish = 0
	EndIf

	While 1
		$nMsg = GUIGetMsg()
		Sleep(50)
		If $log = 1 Then
			$user = GUICtrlRead($Input1, 1)
			$pass = GUICtrlRead($Input2, 1)
		EndIf
		$walktime = GUICtrlRead($Input3, 1)
		$abutton = GUICtrlRead($Input4, 1)
		$bbutton = GUICtrlRead($Input5, 1)

		Switch $nMsg
			Case $GUI_EVENT_CLOSE
				Exit
			Case $Button1
				IniWrite("config.ini", "setting", "log", $log)
				If $log = 1 Then
					IniWrite("config.ini", "setting", "user", $user)
					IniWrite("config.ini", "setting", "pass", StringToBinary($pass, 4))
				EndIf
				IniWrite("config.ini", "setting", "debug", $debug)
				IniWrite("config.ini", "setting", "train", $train)
				IniWrite("config.ini", "setting", "square", $square)
				IniWrite("config.ini", "setting", "walktime", $walktime)
				IniWrite("config.ini", "setting", "abutton", $abutton)
				IniWrite("config.ini", "setting", "bbutton", $bbutton)
				IniWrite("config.ini", "setting", "moveforget", $moveforget)
				IniWrite("config.ini", "setting", "fish", $fish)
				GUIDelete($Form1)
				Return 1
			Case $Checkbox1
				If _GUICtrlButton_GetCheck($Checkbox1) Then
					$log = 1
					$Input1 = GUICtrlCreateInput("", 104, 35, 97, 21)
					$Input2 = GUICtrlCreateInput("", 104, 62, 97, 21, $ES_PASSWORD)
				Else
					$log = 0
					GUICtrlDelete($Input1)
					GUICtrlDelete($Input2)
				EndIf
			Case $Radio1
				If _GUICtrlButton_GetCheck($Radio1) Then
					$square = 1
					_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
					_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
				EndIf
			Case $Radio2
				If _GUICtrlButton_GetCheck($Radio2) Then
					$square = 2
					_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
					_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
				EndIf
			Case $Radio3
				If _GUICtrlButton_GetCheck($Radio3) Then
					$square = 0
					_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
					_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
				EndIf
			Case $Checkbox2
				If _GUICtrlButton_GetCheck($Checkbox2) Then
					$debug = 1
				Else
					$debug = 0
				EndIf

			Case $Checkbox3
				If _GUICtrlButton_GetCheck($Checkbox3) Then
					$train = 1
				Else
					$train = 0
				EndIf
			Case $checkbox4
				If _GUICtrlButton_GetCheck($checkbox4) Then
					$moveforget = 1
				Else
					$moveforget = 0
				EndIf
			Case $checkbox5
				If _GUICtrlButton_GetCheck($checkbox5) Then
					$fish = 1
				Else
					$fish = 0
				EndIf
		EndSwitch
	WEnd

EndFunc   ;==>setting

Func fishbot()
	$change = 0
	If $count = 20 Then
		$hurt = 1
		$count = 0
	EndIf

	$image = PixelSearch(500, 170, 510, 180, 0xE08098, 1)
	If IsArray($image) And $hurt = 1 Then
		Send("{UP up}")
		Sleep(2000)
		Send($abutton);talk nurse
		Sleep(2000)
		Send($abutton); say hi
		Sleep(2000)
		Send($abutton);heal
		Sleep(2000)
		Send($abutton);waiting
		Sleep(2000)
		Send($bbutton);thanks
		Sleep(2000)
		Send($bbutton);bye
		Sleep(2000)
		Send($bbutton);yeah love you too
		Sleep(2000)
		Send($bbutton);stop talking to me psycho
		Sleep(2000)
		Send($bbutton);im gonna call your manager!
		Sleep(2000)
		$hurt = 0
		Return 1
	EndIf

	$image = PixelSearch(500, 410, 510, 420, 0x4878D8, 1)
	If IsArray($image) And $hurt = 0 Then
		Send("{DOWN up}")
		Sleep(500)
		Send("{DOWN}");make sure you look ok
		Sleep(50)
		Send($canebutton);see water
		$something = 0
		Sleep(5000)
		Send($abutton);somenthing?
		Sleep(500)
		Send("{DOWN}")
		$something = 1
		Return 1
	EndIf

	If $hurt = 1 Then
		Send("{UP down}")
		Return 1
	EndIf

	If $hurt = 0 Then
		Send("{DOWN down}")
		Return 1
	EndIf
Return 1
EndFunc


Note to moderation: Can you put this one in first post? Thank you.
uglybot + sourcev0.1_mpgh.net.zip
#3 · edited 12y ago · 12y ago
Austin
[MPGH]Austin
approved .
#4 · 12y ago
HU
hujakt78
What would be great for this bot:
1. To select which Move use: 1 and 2 and 3, or 1, or 2 and 4. I think you get what i want to say.
2. Catch Mode.
#5 · edited 12y ago · 12y ago
FR
franklin01
At the moment, move 1 (top left) is used and 1/5 times move 2 (top right) is used. Also is move 1 has no PP then move 2 is used.
I will try to see if I can manage to make move selection work.

About catching stuff, it can be done but I am waiting to encounter a shiney pokemon as it will be the thing you want to catch and not 2856 magicarp.

But dully noted.
#6 · 12y ago
FR
franklin01
UglyBot Update v0.2
Update v0.2

Changelog:
from v0.1 to v0.2
*added move selection
*rewritted pp detection code
*rewritted attack selection
*small fixes
*catching pokemon
*pokeball detection
*added casino play

bug:
*if in pokemon selection after a death and no full health pokemon, then stuck
*if everyone dies, keep running in pokecenter.
*if catch enabled and if end up in a fight with a trainer and pokemon is not in pokedex will try to catch it.

Note:

About Casino stuff, start playing and then click the button, also I dont see the point as in my test I ended up with less coin at the end but I might be unlucky. Casino might seem slow but it is actually fast enough to not send duplicate commands.
About Fishbot, it will try to heal pokemon before going to fish. This is for you to check if the path is ok, basically any pokemon center with water below it will work.
About Move selection, at least 1 move must be selected, if none are set move 1 (top left) will be used. If pp in selected move are depleted then a random move will be selected.
About Catching Pokemon, it will attempt to capture any pokemon you do not already own. It does not detect shiney thing because I didn't find one yet to add some detection pattern. If in a fight against a trainer it will try to capture the pokemon if not owned but luckily will run out of pokeballs and fight.
About pokeballs detection, if none are left then catch will be disabled.

About background botting:
Short version, hit "windows key + P" and select "extended desktop".
Now move the PokeMMO window to the right side so it is barely visible.
Start your movie/video.
Start the bot.

Long version:
This is a pixelsearch and click bot so two things are needed, focus and visibility. Focus is not needed if you want to watch a movie/video but visibility might be an issue so here is a little trick.
Hitting winkey + p will pop out a menu for screen configuration. If you select "extended Desktop" another desktop will be added to the right side of your screen and shown on a second screen if present.
The trick is that the bot needs to be able to see what is on screen but you as a person dont need to see it.
So if you move the PokeMMO windows to this second desktop (that you won't see unless you have a second monitor), then the primary desktop (what you usually see) will be available to display all kind of things such as movies.
Because of focus and input requirement you can't use this method to browse the web or do other thing than wathcing stuff but it might be already a good thing.
This trick might work with other bots as long as they detect windows position.


New gui:


As always tested on multiple things but feel free to ask about bugs and or request it will be noted.

Feature request and bug report are appreciated so don't be shy.

Virus scan:
uglybot sourcev0.2.zip MD5:d94847b9363adcf63415fab9e9fcf48b - VirSCAN.org 3% Scanner(s) (1/37) found malware!
https://www.virustotal.com/fr/file/4...is/1386796988/

Source code:
Code:
; note: can be improved, if so please share with the comunity
; If you want to support you can throw a penny here.
; LTC: LfHAabU9Lqzn6sgdYcfoLZFoZjf36PW3rf
; NMC: N7P667yC5aMTUFb4h7S1UVbMzvvmfZsXjw

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <Array.au3>
#include <File.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <ScrollBarConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <GuiListBox.au3>
#include <GuiButton.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <Math.au3>
#include <GuiListBox.au3>

Opt("WinTitleMatchMode", 1)
Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)

If Not FileExists("ImageSearchDLL.dll") Then
MsgBox(4096, "ImageSearchDLL.dll not found, some features will not be available.", 10)
EndIf
If Not FileExists("ImageSearchDLL_x64.dll") Then
MsgBox(4096, "ImageSearchDLL_x64.dll not found, some features will not be available.", 10)
EndIf
If Not FileExists("move.png") Then
MsgBox(4096, "move.png not found, some features will not be available.", 10)
EndIf
If Not FileExists("pp.png") Then
MsgBox(4096, "pp.png not found, some features will not be available.", 10)
EndIf
If Not FileExists("pp.png") Then
MsgBox(4096, "pp2.png not found, some features will not be available.", 10)
EndIf
If Not FileExists("move.wav") Then
MsgBox(4096, "move.wav not found, some features will not be available.", 10)
EndIf

If Not FileExists("config.ini") Then
MsgBox(4096, "config.ini not found, creating a new one.", 10)
EndIf

Dim $casino = 0
Dim $abutton
Dim $bbutton
Dim $square
Dim $walktime
Dim $moveforget
Dim $catch = 0
Dim $catched = 1
Dim $job
Dim $pp1 = 1
Dim $pp2 = 1
Dim $pp3 = 1
Dim $pp4 = 1
Dim $Label1
Dim $e = -1
Dim $selectedatk[4]
Dim $pp = 1
Dim $Label2
Dim $Label3
Dim $Label4
Dim $read = 0
Dim $fish
Dim $hurt = 1
Dim $canebutton = "{F5}"
Dim $Label5
dim $atk
Dim $totalcount = 0
Dim $count = 0
Dim $something = 0
Dim $move1
Dim $move2
Dim $move3
Dim $move4
Dim $info1
Dim $info2
Dim $info3
Dim $info4 = "Press [Pause] to pause / F11 to resume / F12 to quit"
Dim $info5 = "Debug enabled"
Dim $image
Dim $image2
Dim $pos
Dim $walk = 0
Dim $log
Dim $dll = DllOpen("user32.dll")
Global $x, $y, $image
Dim $user
Dim $pass
Dim $debug
Dim $change = 0
Dim $train

$job = setting()

HotKeySet("{F7}", "TogglePause")
HotKeySet("{F9}", "quit")

If $debug = 1 Then
GUICreate("uglybot", 225, 300, 20, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$Label5 = GUICtrlCreateList("debug menu", 0, 96, 225, 200, BitOR($WS_BORDER, $WS_VSCROLL))

GUICtrlSetLimit(-1, 200)
Else
GUICreate("uglybot", 225, 100, 20, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
EndIf

$Label1 = GUICtrlCreateLabel("Label1", 0, 0, 225, 25)
$Label2 = GUICtrlCreateLabel("Label2", 0, 24, 225, 25)
$Label3 = GUICtrlCreateLabel("Label3", 0, 48, 225, 25)
$Label4 = GUICtrlCreateLabel("Label3", 0, 72, 225, 25)

GUISetState()

While 1
Sleep(100)
GUICtrlSetData($Label1, $info1)
GUICtrlSetData($Label2, $info2)
GUICtrlSetData($Label3, $info3)
GUICtrlSetData($Label4, $info4)

If $debug = 1 Then
$info5 = "Processing..."
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf

Switch $job
Case 1
$job = start()
Case 2
$job = state()
Case 3
$job = fight()
Case 4
$job = walk()
Case 5
$job = login()
Case 5
$job = setting()
Case 6
$job = fishbot()
Case 7
	$job = casinobot()
EndSwitch
WEnd

Func fight()
If $something = 1 Then
$count = $count + 1
$totalcount = $totalcount + 1
$something = 0
EndIf

If $debug = 1 Then
$info5 = "In fight"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf

$image = PixelSearch(110, 395, 750, 540, 0x8DC655, 5);greenbar
If IsArray($image) Then
MouseClick("left", $image[0], $image[1], 1, 0)
Sleep(50)
Send($bbutton)
Sleep(50)
Return 1
EndIf

$image = PixelSearch(110, 395, 540, 540, 0xCFA806, 5);orange
If IsArray($image) Then
Sleep(50)
Send($bbutton)
If $debug = 1 Then
$info5 = "In attack"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
If $catch = 1 Then
	$catched = 0
	$i = 0
	While $i < 3
		If $debug = 1 Then
			$info5 = "Checking Pokedex..."
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
	Sleep(50)
	$image = PixelSearch(160, 105, 400, 115, 0xA80000, 5);redpokeball
	$i = $i + 1
	If IsArray($image) Then
	If $debug = 1 Then
	$info5 = "Ok already in."
	_GUICtrlListBox_BeginUpdate($Label5)
	_GUICtrlListBox_InsertString($Label5, $info5)
	_GUICtrlListBox_EndUpdate($Label5)
	$iIndex = _GUICtrlListBox_GetCurSel($Label5)
	$iIndex = $iIndex + 1
	_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	$catched = 1
	EndIf
	WEnd

	If $catched = 0 Then
		If $debug = 1 Then
			$info5 = "Not Captured yet..."
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
		Sleep(50)
		Send("{RIGHT}")
		Sleep(50)
		Send("{UP}")
		Sleep(50)
		Send($abutton)
		Sleep(50)
		Send("{RIGHT}")
		Sleep(50)
		Send("{RIGHT}")
		Sleep(50)
		$i = 0
		While $i < 3
			Sleep(50)
		$image = PixelSearch(117, 443, 459, 474, 0xCFA806, 5);orange
		$i = $i + 1
		If IsArray($image) Then
			Send($abutton)
			Sleep(500)
			Return 1
		Else;no balls
		If $debug = 1 Then
			$info5 = "Warning NO balls - Catching disabled "
			_GUICtrlListBox_BeginUpdate($Label5)
			_GUICtrlListBox_InsertString($Label5, $info5)
			_GUICtrlListBox_EndUpdate($Label5)
			$iIndex = _GUICtrlListBox_GetCurSel($Label5)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label5, $iIndex)
		EndIf
		$catch = 0
		Sleep(50)
		Send($bbutton)
		Sleep(50)
		Return 1
		EndIf
		WEnd

	EndIf
	EndIf
	If $train = 1 And $change = 0 Then
	Sleep(50)
	Send("{LEFT}")
	Sleep(50)
	Send("{LEFT}")
	Sleep(50)
	Send("{DOWN}")
	Sleep(50)
	Send("{DOWN}")
	Sleep(50)
	Send($abutton)
	Sleep(50)
	Send("{RIGHT}")
	Sleep(50)
	Send($abutton)
	Sleep(500)
	$change = 1
	Else
	$info3 = "Attacking."
	GUICtrlSetData($Label3, $info3)
	Sleep(50)
	Send("{LEFT}")
	Sleep(50)
	Send("{LEFT}")
	Sleep(50)
	Send("{UP}")
	Sleep(50)
	Send("{UP}")
	Sleep(50)
	Send($abutton)
	Sleep(50)
	$pp1 = 1
	$pp2 = 1
	$pp3 = 1
	$pp4 = 1
	$i = 0
	While $i < 3
	If $debug = 1 Then
	$info5 = "in pp check"
	_GUICtrlListBox_BeginUpdate($Label5)
	_GUICtrlListBox_InsertString($Label5, $info5)
	_GUICtrlListBox_EndUpdate($Label5)
	$iIndex = _GUICtrlListBox_GetCurSel($Label5)
	$iIndex = $iIndex + 1
	_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	$info3 = "Got PP?"
	GUICtrlSetData($Label3, $info3)
	Sleep(50)
	$i = $i + 1
	$image2 = _ImageSearchArea('pp2.png', 1, $pos[0]+122, $pos[1]+453, $pos[0]+227, $pos[1]+501, $x, $y, 80)
	$image = _ImageSearchArea('pp.png', 1, $pos[0]+122, $pos[1]+453, $pos[0]+227, $pos[1]+501, $x, $y, 80)
	If $image = 1 Or $image2 = 1 Then
	$info3 = "Warning no PP"
	GUICtrlSetData($Label3, $info3)
	$pp1 = 0
	If $debug = 1 Then
	$info5 = "move 1 no pp"
	_GUICtrlListBox_BeginUpdate($Label5)
	_GUICtrlListBox_InsertString($Label5, $info5)
	_GUICtrlListBox_EndUpdate($Label5)
	$iIndex = _GUICtrlListBox_GetCurSel($Label5)
	$iIndex = $iIndex + 1
	_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	EndIf

	$image2 = _ImageSearchArea('pp2.png', 1, $pos[0] + 335, $pos[1] + 454, $pos[0] + 437, $pos[1] + 496, $x, $y, 80)
	$image = _ImageSearchArea('pp.png', 1, $pos[0] + 335, $pos[1] + 454, $pos[0] + 437, $pos[1] + 496, $x, $y, 80)
	If $image = 1 Or $image2 = 1 Then
	$info3 = "Warning no PP"
	GUICtrlSetData($Label3, $info3)
	$pp2 = 0
	If $debug = 1 Then
	$info5 = "move 2 no pp"
	_GUICtrlListBox_BeginUpdate($Label5)
	_GUICtrlListBox_InsertString($Label5, $info5)
	_GUICtrlListBox_EndUpdate($Label5)
	$iIndex = _GUICtrlListBox_GetCurSel($Label5)
	$iIndex = $iIndex + 1
	_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	EndIf

	$image2 = _ImageSearchArea('pp2.png', 1, $pos[0] + 125, $pos[1] + 507, $pos[0] + 220, $pos[1] + 555, $x, $y, 80)
	$image = _ImageSearchArea('pp.png', 1, $pos[0] + 125, $pos[1] + 507, $pos[0] + 220, $pos[1] + 555, $x, $y, 80)
	If $image = 1 Or $image2 = 1 Then
	$info3 = "Warning no PP"
	GUICtrlSetData($Label3, $info3)
	$pp3 = 0
	If $debug = 1 Then
	$info5 = "move 3 no pp"
	_GUICtrlListBox_BeginUpdate($Label5)
	_GUICtrlListBox_InsertString($Label5, $info5)
	_GUICtrlListBox_EndUpdate($Label5)
	$iIndex = _GUICtrlListBox_GetCurSel($Label5)
	$iIndex = $iIndex + 1
	_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	EndIf

	$image2 = _ImageSearchArea('pp2.png', 1, $pos[0] + 336, $pos[1] + 509, $pos[0] + 440, $pos[1] + 555, $x, $y, 80)
	$image = _ImageSearchArea('pp.png', 1, $pos[0] + 336, $pos[1] + 509, $pos[0] + 440, $pos[1] + 555, $x, $y, 80)
	If $image = 1 Or $image2 = 1 Then
	$info3 = "Warning no PP"
	GUICtrlSetData($Label3, $info3)
	$pp4 = 0
	If $debug = 1 Then
	$info5 = "move 4 no pp"
	_GUICtrlListBox_BeginUpdate($Label5)
	_GUICtrlListBox_InsertString($Label5, $info5)
	_GUICtrlListBox_EndUpdate($Label5)
	$iIndex = _GUICtrlListBox_GetCurSel($Label5)
	$iIndex = $iIndex + 1
	_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	EndIf

	WEnd

	$e = -1

	If $move1 = 1  And $pp1 = 1 Then
	$e = $e+1
	$selectedatk[$e] = "$move1"
	EndIf
	If $move2 = 1  And $pp2 = 1 Then
	$e = $e+1
	$selectedatk[$e] = "$move2"
	EndIf
	If $move3 = 1  And $pp3 = 1 Then
	$e = $e+1
	$selectedatk[$e] = "$move3"
	EndIf
	If $move4 = 1  And $pp4 = 1 Then
	$e = $e+1
	$selectedatk[$e] = "$move4"
	EndIf

	If $e = -1 Then
		$e = $e+1
		$selectedatk[$e] = "$move4"
		$e = $e+1
		$selectedatk[$e] = "$move3"
		$e = $e+1
		$selectedatk[$e] = "$move2"
		$e = $e+1
		$selectedatk[$e] = "$move1"
	EndIf


	$nothing = ""
	$empty = _ArraySearch($selectedatk, $nothing)

	If $empty > 0 Then
	_ArrayDelete($selectedatk, $empty)
	$empty = _ArraySearch($selectedatk, $nothing)
	EndIf
	If $empty > 0 Then
	_ArrayDelete($selectedatk, $empty)
	$empty = _ArraySearch($selectedatk, $nothing)
	EndIf
	If $empty > 0 Then
	_ArrayDelete($selectedatk, $empty)
	$empty = _ArraySearch($selectedatk, $nothing)
	EndIf
	If $empty > 0 Then
	_ArrayDelete($selectedatk, $empty)
	$empty = _ArraySearch($selectedatk, $nothing)
	EndIf

	$pick = Random(0,$e, 1)

	$e = -1
	If $selectedatk[$pick] = "$move1" Then
	Send("{LEFT}")
	Sleep(50)
	Send("{UP}")
	Sleep(50)
	Send($abutton)
	Sleep(50)
	Return 1
	EndIf
	If $selectedatk[$pick] = "$move2" Then
	Send("{RIGHT}")
	Sleep(50)
	Send("{UP}")
	Sleep(50)
	Send($abutton)
	Sleep(50)
	Return 1
	EndIf
	If $selectedatk[$pick] = "$move3" Then
	Send("{LEFT}")
	Sleep(50)
	Send("{DOWN}")
	Sleep(50)
	Send($abutton)
	Sleep(50)
	Return 1
	EndIf
	If $selectedatk[$pick] = "$move4" Then
	Send("{RIGHT}")
	Sleep(50)
	Send("{DOWN}")
	Sleep(50)
	Send($abutton)
	Sleep(50)
	Return 1
	EndIf

	EndIf
	Return 1
	EndIf
	$image = PixelSearch(875, 515, 895, 535, 0xFFFFFF, 5);fleche blanche
	If IsArray($image) Then
	If $debug = 1 Then
	$info5 = "input required"
	_GUICtrlListBox_BeginUpdate($Label5)
	_GUICtrlListBox_InsertString($Label5, $info5)
	_GUICtrlListBox_EndUpdate($Label5)
	$iIndex = _GUICtrlListBox_GetCurSel($Label5)
	$iIndex = $iIndex + 1
	_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	$info3 = "Input needed."
	GUICtrlSetData($Label3, $info3)
	Sleep(50)
	Send($bbutton)
	Sleep(50)
	Return 1
	EndIf
	If $debug = 1 Then
	$info5 = "right stick fight check"
	_GUICtrlListBox_BeginUpdate($Label5)
	_GUICtrlListBox_InsertString($Label5, $info5)
	_GUICtrlListBox_EndUpdate($Label5)
	$iIndex = _GUICtrlListBox_GetCurSel($Label5)
	$iIndex = $iIndex + 1
	_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	Sleep(50)
	Send("{RIGHT}");juste au cas ou on perde le focus
	Sleep(50)

	$image = PixelSearch(780, 430, 800, 450, 0x839299, 5);
	If IsArray($image) Then
	If $moveforget = 1 Then
	$info3 = "Move detected"
	GUICtrlSetData($Label3, $info3)
	Sleep(50)
	MouseClick("left", $image[0], $image[1], 1, 0)
	Sleep(50)
	MouseClick("left", 509, 377, 1, 0)
	Sleep(50)
	Return 1
	Else
	SoundPlay("move.wav", 1)
	Sleep(500)
	Return 1
	EndIf
	EndIf
;~ 	EndIf
	Return 1
EndFunc   ;==>fight

Func walk()
$something = 1
$change = 0
If $debug = 1 Then
$info5 = "in walk"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
If $square = 1 Then
If $walk < 1 Then
If $debug = 1 Then
$info5 = "walking down"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Walking down."
GUICtrlSetData($Label3, $info3)
Send("{DOWN down}")
Sleep(Random($walktime, $walktime + 100, 1))
Send("{DOWN up}")
$walk = 1
Sleep(50)
Return 1
EndIf

If $walk < 2 Then
If $debug = 1 Then
$info5 = "walking left"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Walking left."
GUICtrlSetData($Label3, $info3)
Send("{LEFT down}")
Sleep(Random($walktime, $walktime + 100, 1))
Send("{LEFT up}")
$walk = 2
Sleep(50)
Return 1
EndIf

If $walk < 3 Then
If $debug = 1 Then
$info5 = "walking up"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Walking up."
GUICtrlSetData($Label3, $info3)
Send("{UP down}")
Sleep(Random($walktime, $walktime + 100, 1))
Send("{UP up}")
$walk = 3
Sleep(50)
Return 1
EndIf

If $walk < 4 Then
If $debug = 1 Then
$info5 = "walking right"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Walking right."
GUICtrlSetData($Label3, $info3)
Send("{RIGHT down}")
Sleep(Random($walktime, $walktime + 100, 1))
Send("{RIGHT up}")
$walk = 0
Sleep(50)
Return 1
EndIf
EndIf

If $square = 0 Then
If $walk < 1 Then
If $debug = 1 Then
$info5 = "walking down"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Walking down."
GUICtrlSetData($Label3, $info3)
Send("{DOWN down}")
Sleep(Random($walktime, $walktime + 100, 1))
Send("{DOWN up}")
$walk = 1
Sleep(50)
Return 1
EndIf

If $walk < 2 Then
If $debug = 1 Then
$info5 = "walking up"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Walking up."
GUICtrlSetData($Label3, $info3)
Send("{UP down}")
Sleep(Random($walktime, $walktime + 100, 1))
Send("{UP up}")
$walk = 0
Sleep(50)
Return 1
EndIf
EndIf
If $square = 2 Then
If $walk < 1 Then
If $debug = 1 Then
$info5 = "walking left"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Walking left."
GUICtrlSetData($Label3, $info3)
Send("{LEFT down}")
Sleep(Random($walktime, $walktime + 100, 1))
Send("{LEFT up}")
$walk = 1
Sleep(50)
Return 1
EndIf

If $walk < 2 Then
If $debug = 1 Then
$info5 = "walking right"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Walking right."
GUICtrlSetData($Label3, $info3)
Send("{RIGHT down}")
Sleep(Random($walktime, $walktime + 100, 1))
Send("{RIGHT up}")
$walk = 0
Sleep(50)
Return 1
EndIf
EndIf
Return 1
EndFunc   ;==>walk

Func login();return 3 -OK
If $debug = 1 Then
$info5 = "in login"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
If $log = 1 Then
If $debug = 1 Then
$info5 = "loggin in"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Loggin in..."
GUICtrlSetData($Label3, $info3)
Sleep(500)
MouseClick("left", 582, 351, 2, 0);login
Sleep(50)
Send("{BS down}")
Sleep(1700)
Send("{BS up}")
Sleep(50)
Send("{DEL down}")
Sleep(1700)
Send("{DEL up}")
Sleep(50)
Send($user)
Sleep(50)
Send("{TAB}")
Sleep(50)
Send("{BS down}")
Sleep(1500)
Send("{BS up}")
Sleep(50)
Send("{DEL down}")
Sleep(1500)
Send("{DEL up}")
Sleep(50)
Send($pass)
Sleep(50)
Send("{ENTER}")
Sleep(3000)
Send("{ENTER}")
Sleep(3000)
Send("{ENTER}")
Sleep(3000)
$info3 = "Logged in."
GUICtrlSetData($Label3, $info3)
Return 1;start
Else
If $debug = 1 Then
$info5 = "autolog set to no"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info3 = "Autologin not enabled, please login."
GUICtrlSetData($Label3, $info3)
Return 1;start
EndIf
EndFunc   ;==>login

Func state()
If $debug = 1 Then
$info5 = "in state"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$image = PixelSearch(503, 715, 515, 720, 0x242C31, 1)
If IsArray($image) And $catch = 1 And $casino = 0 Then
Send("{F12}")
Sleep(500)
Return 1
EndIf

$image = PixelSearch(200, 400, 700, 420, 0x1D415D, 3)
If IsArray($image) Then
If $debug = 1 Then
$info5 = "fight found"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info2 = "Player is fighting."
GUICtrlSetData($Label2, $info2)
Sleep(50)
Return 3
EndIf
$image = PixelSearch(500, 85, 520, 95, 0xF3EA6D, 3)
If IsArray($image) Then
If $debug = 1 Then
$info5 = "login found"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info2 = "Player is at login."
GUICtrlSetData($Label2, $info2)
Sleep(50)
Return 5
EndIf
If $debug = 1 Then
$info5 = "nothing found"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info2 = "Player is looking for pokemon."
GUICtrlSetData($Label2, $info2)
Sleep(50)
If $fish = 1 Then
Return 6
EndIf
If $casino = 1 Then
	Return 7
EndIf
Return 4


EndFunc   ;==>state

Func start()
$info1 = "Running..."
GUICtrlSetData($Label1, $info1)
If $read = 0 Then
$log = IniRead("config.ini", "setting", "log", "0")
If $log = 1 Then
$user =  IniRead("config.ini", "setting", "user", "")
$pass = BinaryToString(IniRead("config.ini", "setting", "pass", '"passdefault"'), 4)
EndIf
$debug = IniRead("config.ini", "setting", "debug", "0")
$train = IniRead("config.ini", "setting", "train", "0")
$square = IniRead("config.ini", "setting", "square", "0")
$walktime = IniRead("config.ini", "setting", "walktime", "800")
$abutton = IniRead("config.ini", "setting", "abutton", "z")
$bbutton = IniRead("config.ini", "setting", "bbutton", "x")
$moveforget = IniRead("config.ini", "setting", "moveforget", "0")
$fish = IniRead("config.ini", "setting", "fish", "0")
$read = 1
$move1 = IniRead("config.ini", "setting", "move1", "1")
$move2 = IniRead("config.ini", "setting", "move2", "0")
$move3 = IniRead("config.ini", "setting", "move3", "0")
$move4 = IniRead("config.ini", "setting", "move4", "0")
EndIf

$info4 = "Number of Pokemon fought: "&$totalcount
If Not WinExists("[CLASS:LWJGL]") Then
$info1 = "Window not found, waiting for game."
GUICtrlSetData($Label1, $info1)
Sleep(50)
Return 1
EndIf
If WinActive("[CLASS:LWJGL]") Then
$pos = WinGetPos("[CLASS:LWJGL]")
$info1 = "Window found, focus OK."
WinMove("[CLASS:LWJGL]", "", $pos[0], $pos[1], 1032, 795)
GUICtrlSetData($Label1, $info1)
Sleep(50)
Return 2
EndIf
WinActivate("[CLASS:LWJGL]")
$info1 = "Window found, waiting for game focus."
GUICtrlSetData($Label1, $info1)
Sleep(50)
Return 1
EndFunc   ;==>start

Func _ImageSearchArea($FindImage, $ResultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $Tolerance)
If $Tolerance > 0 Then $FindImage = "*" & $Tolerance & " " & $FindImage

If  @autoItX64 Then
$Result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $FindImage)
Else
$Result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $FindImage)
EndIf

If $Result = "0" Then Return 0

$Array = StringSplit($Result[0], "|")

If (UBound($Array) >= 4) Then
$x = Int(Number($Array[2]))
$y = Int(Number($Array[3]))

If $ResultPosition = 1 Then
$x = $x + Int(Number($Array[4]) / 2)
$y = $y + Int(Number($Array[5]) / 2)
EndIf
Return 1
EndIf
EndFunc   ;==>_ImageSearchArea

Func TogglePause()
While 1
$info1 = "PAUSED PRESS F8 TO RESUME / F9 TO QUIT"
GUICtrlSetData($Label1, $info1)
Sleep(100)
If _IsPressed("77", $dll) Then
Return 1
EndIf
WEnd
EndFunc   ;==>TogglePause

Func quit()
Sleep(100)
Exit
EndFunc   ;==>TogglePause

Func setting()
#region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\Desktop\pokemmo bot\koda\Forms\Form1.kxf
$Form1 = GUICreate("UglyBot Setting", 466, 294, 287, 138)
$Label1 = GUICtrlCreateLabel("Auto Login", 16, 8, 55, 17)
$Label2 = GUICtrlCreateLabel("Username", 16, 36, 52, 17)
$Label3 = GUICtrlCreateLabel("Password", 16, 63, 50, 17)
$Label4 = GUICtrlCreateLabel("Debug Mode", 16, 91, 66, 17)
$Label5 = GUICtrlCreateLabel("Training", 16, 118, 42, 17)
$Label6 = GUICtrlCreateLabel("Walking type", 16, 146, 66, 17)
$Label7 = GUICtrlCreateLabel("Walking time (ms)", 16, 173, 85, 17)
$Label8 = GUICtrlCreateLabel("Button A", 16, 201, 45, 17)
$Label9 = GUICtrlCreateLabel("Button B", 16, 228, 45, 17)
$Button1 = GUICtrlCreateButton("Save and start", 16, 256, 89, 25)
$Checkbox1 = GUICtrlCreateCheckbox("", 104, 8, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("", 104, 89, 17, 17)
$Radio1 = GUICtrlCreateRadio("Square", 104, 143, 113, 17)
$Radio2 = GUICtrlCreateRadio("Left/Right", 224, 144, 113, 17)
$Radio3 = GUICtrlCreateRadio("Up/Down", 344, 144, 113, 17)
$Input3 = GUICtrlCreateInput("500", 104, 170, 121, 21)
$Input4 = GUICtrlCreateInput("Z", 104, 197, 121, 21)
$Input5 = GUICtrlCreateInput("X", 104, 224, 121, 21)
$Checkbox3 = GUICtrlCreateCheckbox("", 104, 116, 17, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Forget new Moves", 144, 116, 107, 17)
$Checkbox5 = GUICtrlCreateCheckbox("FishBot (F5)", 144, 89, 107, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Move 1", 224, 40, 97, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Move 3", 224, 64, 97, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Move 2", 336, 40, 97, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Move 4", 336, 64, 97, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Catch new pokemons", 336, 88, 97, 17)
$Label10 = GUICtrlCreateLabel("Move to use", 224, 16, 79, 17)
$Button2 = GUICtrlCreateButton("Casino bot", 312, 256, 73, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

If Not FileExists("config.ini") Then
IniWrite("config.ini", "setting", "log", "0")
IniWrite("config.ini", "setting", "user", '"user"')
IniWrite("config.ini", "setting", "pass", '"pass"')
IniWrite("config.ini", "setting", "debug", "0")
IniWrite("config.ini", "setting", "train", "0")
IniWrite("config.ini", "setting", "square", "1")
IniWrite("config.ini", "setting", "walktime", "500")
IniWrite("config.ini", "setting", "abutton", "z")
IniWrite("config.ini", "setting", "bbutton", "x")
IniWrite("config.ini", "setting", "moveforget", "0")
IniWrite("config.ini", "setting", "fish", "0")
IniWrite("config.ini", "setting", "move1", "1")
IniWrite("config.ini", "setting", "move2", "0")
IniWrite("config.ini", "setting", "move3", "0")
IniWrite("config.ini", "setting", "move4", "0")
IniWrite("config.ini", "setting", "catch", "0")
EndIf


If IniRead("config.ini", "setting", "log", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox1)
$Input1 = GUICtrlCreateInput("", 104, 35, 97, 21)
$Input2 = GUICtrlCreateInput("", 104, 62, 97, 21, $ES_PASSWORD)
GUICtrlSetData($Input1, IniRead("config.ini", "setting", "user", '"userdefault"'))
$pass = BinaryToString(IniRead("config.ini", "setting", "pass", '"passdefault"'), 4)
GUICtrlSetData($Input2, $pass)
$log = 1
Else
$log = 0
EndIf
If IniRead("config.ini", "setting", "debug", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox2)
$debug = 1
Else
$debug = 0
EndIf
If IniRead("config.ini", "setting", "catch", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox10)
$catch = 1
Else
$catch = 0
EndIf
If IniRead("config.ini", "setting", "train", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox3)
$train = 1
Else
$train = 0
EndIf
If IniRead("config.ini", "setting", "move1", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox6)
$move1 = 1
Else
$move1 = 0
EndIf
If IniRead("config.ini", "setting", "move2", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox7)
$move2 = 1
Else
$move2 = 0
EndIf
If IniRead("config.ini", "setting", "move3", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox8)
$move3 = 1
Else
$move3 = 0
EndIf
If IniRead("config.ini", "setting", "move4", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox9)
$move4 = 1
Else
$move4 = 0
EndIf
If $move1 = 0 And $move2 = 0 And $move3 = 0 And $move4 = 0 Then
_GUICtrlButton_SetCheck($Checkbox6)
$move1 = 1
EndIf
If IniRead("config.ini", "setting", "square", "1") = 0 Then
_GUICtrlButton_SetCheck($Radio3)
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
$square = 0
EndIf
If IniRead("config.ini", "setting", "square", "1") = 2 Then
_GUICtrlButton_SetCheck($Radio2)
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
$square = 2
EndIf
If IniRead("config.ini", "setting", "square", "1") = 1 Then
_GUICtrlButton_SetCheck($Radio1)
_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
$square = 1
EndIf
If Not IniRead("config.ini", "setting", "square", "1") = 1 And Not IniRead("config.ini", "setting", "square", "1") = 0 And Not IniRead("config.ini", "setting", "square", "1") = 2 Then
_GUICtrlButton_SetCheck($Radio3)
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
$square = 0
EndIf
GUICtrlSetData($Input3, IniRead("config.ini", "setting", "walktime", "500"))
GUICtrlSetData($Input4, IniRead("config.ini", "setting", "abutton", "z"))
GUICtrlSetData($Input5, IniRead("config.ini", "setting", "bbutton", "x"))
If IniRead("config.ini", "setting", "moveforget", "1") = 1 Then
_GUICtrlButton_SetCheck($checkbox4)
$moveforget = 1
Else
$moveforget = 0
EndIf

If IniRead("config.ini", "setting", "fish", "0") = 1 Then
_GUICtrlButton_SetCheck($checkbox5)
$fish = 1
Else
$fish = 0
EndIf

While 1
$nMsg = GUIGetMsg()
Sleep(50)
If $log = 1 Then
$user = GUICtrlRead($Input1, 1)
$pass = GUICtrlRead($Input2, 1)
EndIf
$walktime = GUICtrlRead($Input3, 1)
$abutton = GUICtrlRead($Input4, 1)
$bbutton = GUICtrlRead($Input5, 1)
If $move1 = 0 And $move2 = 0 And $move3 = 0 And $move4 = 0 Then
_GUICtrlButton_SetCheck($Checkbox6)
$move1 = 1
EndIf

Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
IniWrite("config.ini", "setting", "log", $log)
If $log = 1 Then
IniWrite("config.ini", "setting", "user", $user)
IniWrite("config.ini", "setting", "pass", StringToBinary($pass, 4))
EndIf
IniWrite("config.ini", "setting", "debug", $debug)
IniWrite("config.ini", "setting", "train", $train)
IniWrite("config.ini", "setting", "square", $square)
IniWrite("config.ini", "setting", "walktime", $walktime)
IniWrite("config.ini", "setting", "abutton", $abutton)
IniWrite("config.ini", "setting", "bbutton", $bbutton)
IniWrite("config.ini", "setting", "moveforget", $moveforget)
IniWrite("config.ini", "setting", "fish", $fish)
IniWrite("config.ini", "setting", "move1", $move1)
IniWrite("config.ini", "setting", "move2", $move2)
IniWrite("config.ini", "setting", "move3", $move3)
IniWrite("config.ini", "setting", "move4", $move4)
IniWrite("config.ini", "setting", "catch", $catch)
GUIDelete($Form1)
Return 1
Case $Button2
	GUIDelete($Form1)
	$casino = 1
	Return 1

Case $Checkbox1
If _GUICtrlButton_GetCheck($Checkbox1) Then
$log = 1
$Input1 = GUICtrlCreateInput("", 104, 35, 97, 21)
$Input2 = GUICtrlCreateInput("", 104, 62, 97, 21, $ES_PASSWORD)
Else
$log = 0
GUICtrlDelete($Input1)
GUICtrlDelete($Input2)
EndIf
Case $Radio1
If _GUICtrlButton_GetCheck($Radio1) Then
$square = 1
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
EndIf
Case $Radio2
If _GUICtrlButton_GetCheck($Radio2) Then
$square = 2
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
EndIf
Case $Radio3
If _GUICtrlButton_GetCheck($Radio3) Then
$square = 0
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
EndIf
Case $Checkbox2
If _GUICtrlButton_GetCheck($Checkbox2) Then
$debug = 1
Else
$debug = 0
EndIf

Case $Checkbox3
If _GUICtrlButton_GetCheck($Checkbox3) Then
$train = 1
Else
$train = 0
EndIf
Case $checkbox4
If _GUICtrlButton_GetCheck($checkbox4) Then
$moveforget = 1
Else
$moveforget = 0
EndIf
Case $checkbox5
If _GUICtrlButton_GetCheck($checkbox5) Then
$fish = 1
Else
$fish = 0
EndIf
Case $checkbox6
If _GUICtrlButton_GetCheck($checkbox6) Then
$move1 = 1
Else
$move1 = 0
EndIf
Case $checkbox7
If _GUICtrlButton_GetCheck($checkbox7) Then
$move2 = 1
Else
$move2 = 0
EndIf
Case $checkbox8
If _GUICtrlButton_GetCheck($checkbox8) Then
$move3 = 1
Else
$move3 = 0
EndIf
Case $checkbox9
If _GUICtrlButton_GetCheck($checkbox9) Then
$move4 = 1
Else
$move4 = 0
EndIf
Case $checkbox10
If _GUICtrlButton_GetCheck($checkbox10) Then
$catch = 1
Else
$catch = 0
EndIf
EndSwitch
WEnd

EndFunc   ;==>setting

Func casinobot()
WinActivate("[CLASS:LWJGL]")
$image = PixelSearch(700, 500, 710, 510, 0xE8A800, 1)
If IsArray($image)Then;in slot
	$info1 = "Gambling..."
	GUICtrlSetData($Label1, $info1)
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	Send("{DOWN}")
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	Send("{DOWN}")
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	Send("{DOWN}")
	Sleep(Random(500,1000,1))
	WinActivate("[CLASS:LWJGL]")
	Send("{Z}")
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	Send("{Z}")
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	Send("{Z}")
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	Send("{Z}")
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	Send("{Z}")
	Sleep(Random(3000,4500,1))
	Return 1
Else
	$info1 = "Go to casino and open menu first"
	GUICtrlSetData($Label1, $info1)
	Sleep(500)
	Return 1
EndIf
Return 1
EndFunc


Func fishbot()
$change = 0
If $count = 20 Then
$hurt = 1
$count = 0
EndIf

$image = PixelSearch(500, 170, 510, 180, 0xE08098, 1)
$image2 = PixelSearch(500, 165, 510, 180, 0xD06878, 1)
If $hurt = 1 Then
If IsArray($image) Or IsArray($image2) Then
Send("{UP up}")
Sleep(2000)
Send($abutton);talk nurse
Sleep(2000)
Send($abutton); say hi
Sleep(2000)
Send($abutton);heal
Sleep(2000)
Send($abutton);waiting
Sleep(2000)
Send($bbutton);thanks
Sleep(2000)
Send($bbutton);bye
Sleep(2000)
Send($bbutton);yeah love you too
Sleep(2000)
Send($bbutton);stop talking to me psycho
Sleep(2000)
Send($bbutton);im gonna call your manager!
Sleep(2000)
$hurt = 0
Return 1
EndIf
EndIf


$image = PixelSearch(500, 410, 510, 420, 0x4878D8, 1)
If IsArray($image) And $hurt = 0 Then
Send("{DOWN up}")
Sleep(500)
Send("{DOWN}");make sure you look ok
Sleep(50)
Send($canebutton);see water
$something = 0
Sleep(5000)
Send($abutton);somenthing?
Sleep(500)
Send("{DOWN}")
$something = 1
Return 1
EndIf

If $hurt = 1 Then
Send("{UP down}")
Return 1
EndIf

If $hurt = 0 Then
Send("{DOWN down}")
Return 1
EndIf
Return 1
EndFunc
ub02.png uglybot sourcev0.2_mpgh.net.zip
#7 · edited 12y ago · 12y ago
Austin
[MPGH]Austin
approved .
#8 · 12y ago
HU
hujakt78
No matter whats is first or second pokemon, at battle start it always select second, if second dead, then select others. If this is function, for training two, then selecting on GUI would be perfect to train One or Two pokemons.
Fishbot dont work with catch mode, its just trying to go down after pokecenter.
And when launching bot, it say that move.png is missing.

Getting error and then bot stop. Its happen after some time in fights (testes with Pikachu, Nidorino, Gloom,) and if using only Training, without Catch mode, then everything okey.
I cant post link, so this is what it write:

AutoIT Error

Line 7558 (File "C:\ZmogelisA\Desktop\uglybot sourcev0.2_mpgh.net\uglybot sourcev0.2.exe"):


Error: Array variable has incorrected number of subscripts or subscript dimension range exeeded.
#9 · 12y ago
FR
franklin01
Thanks for the report I will check that.
I will update module for training and pokemon selection when dead.

Fishbot is supposed to go down after pokemon center and find water to use the rod. If there is no water under it it will fail.

Error are known and are already fixed in 0.3 that will be released when enough work has been done.
#10 · 12y ago
christianjsp
christianjsp
Quote Originally Posted by hujakt78 View Post
No matter whats is first or second pokemon, at battle start it always select second, if second dead, then select others. If this is function, for training two, then selecting on GUI would be perfect to train One or Two pokemons.
Fishbot dont work with catch mode, its just trying to go down after pokecenter.
And when launching bot, it say that move.png is missing.

Getting error and then bot stop. Its happen after some time in fights (testes with Pikachu, Nidorino, Gloom,) and if using only Training, without Catch mode, then everything okey.
I cant post link, so this is what it write:

AutoIT Error

Line 7558 (File "C:\ZmogelisA\Desktop\uglybot sourcev0.2_mpgh.net\uglybot sourcev0.2.exe"):


Error: Array variable has incorrected number of subscripts or subscript dimension range exeeded.
me too.
I got error same like you.
#11 · 12y ago
FR
franklin01
UglyBot 0.3.2 + source
!!! Does anyone uses this thing or should I stop? !!!

UglyBot Update 0.3.2:

Changelog v0.3:
Code:
*fixed death detection
*fixed pp detection
*enable pokecenter detection + waypoint test
*small fixes
Note:
Waypoint and offscreen are in test but not finished.
Offscreen moves enables extended screen and move the window to the extended screen.
Waypoint uses waypoint.txt file to go from the outside of the pokemon center to your farm zone. Current wp is set for Pewter City.
Steps are processed so you have to disable autorun or it will be offroad.
Coding is autoit so be smart.

Virus scan:
Code:
https://www.virustotal.com/fr/file/9b7ef4ea6721c823839dcd7009532cbc8e81086abfeb27d9ea7cb8ee38c5a1d7/analysis/1387540151/
http://r.virscan.org/report/9bc5a4ded0f7c6374db4e9d1f39b1919.html
Source:
Code:
; note: can be improved, if so please share with the comunity
; If you want to support you can throw a penny here.
; LTC: LfHAabU9Lqzn6sgdYcfoLZFoZjf36PW3rf
; NMC: N7P667yC5aMTUFb4h7S1UVbMzvvmfZsXjw

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>
#include <Array.au3>
#include <File.au3>
#include <GDIPlus.au3>
#include <ScreenCapture.au3>
#include <WinAPI.au3>
#include <ScrollBarConstants.au3>
#include <WindowsConstants.au3>
#include <GuiComboBox.au3>
#include <GuiListBox.au3>
#include <GuiButton.au3>
#include <EditConstants.au3>
#include <ButtonConstants.au3>
#include <Math.au3>
#include <GuiListBox.au3>

Opt("WinTitleMatchMode", 1)
Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)

If Not FileExists("ImageSearchDLL.dll") Then
MsgBox(4096,"", "ImageSearchDLL.dll not found, some features will not be available.", 10)
EndIf
If Not FileExists("ImageSearchDLL_x64.dll") Then
MsgBox(4096,"", "ImageSearchDLL_x64.dll not found, some features will not be available.", 10)
EndIf
If Not FileExists("pp.png") Then
MsgBox(4096,"", "pp.png not found, some features will not be available.", 10)
EndIf
If Not FileExists("pp2.png") Then
MsgBox(4096,"", "pp2.png not found, some features will not be available.", 10)
EndIf
If Not FileExists("move.wav") Then
MsgBox(4096,"", "move.wav not found, some features will not be available.", 10)
EndIf
If Not FileExists("config.ini") Then
MsgBox(4096,"", "config.ini not found, creating a new one.", 10)
EndIf
If Not FileExists("hp.png") Then
MsgBox(4096,"", "hp.png not found, some features will not be available.", 10)
EndIf



Dim $casino = 0
Dim $abutton
Dim $bbutton
Dim $square
Dim $walktime
Dim $pokecenter = 0
Dim $walked = 0
Dim $moveforget
Dim $catch = 0
Dim $waypoint = 1
Dim $catched = 1
Dim $job
Dim $pp1 = 1
Dim $pp2 = 1
Dim $pp3 = 1
Dim $pp4 = 1
Dim $align = 0
Dim $Label1
Dim $check = 0
Dim $e = -1
Dim $selectedatk[10]
Dim $pp = 1
Dim $Label2
Dim $Label3
Dim $Label4
Dim $read = 0
Dim $fish
Dim $hurt = 1
Dim $canebutton = "{F5}"
Dim $Label5
dim $atk
Dim $totalcount = 0
Dim $count = 0
Dim $something = 0
Dim $move1
Dim $move2
Dim $move3
Dim $move4
Dim $info1
Dim $info2
Dim $info3
Dim $info4 = "Press [Pause] to pause / F11 to resume / F12 to quit"
Dim $info5 = "Debug enabled"
Dim $image
Dim $image2
Dim $pos
Dim $walk = 0
Dim $log
Dim $dll = DllOpen("user32.dll")
Global $x, $y, $image
Dim $user
Dim $pass
Dim $debug
Dim $change = 0
Dim $train
Dim $iIndex2
Dim $iIndex
Dim $offscreen = 0

$job = setting()

HotKeySet("{F7}", "TogglePause")
HotKeySet("{F9}", "quit")

If $debug = 1 Then
GUICreate("uglybot", 225, 300, 20, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$Label5 = GUICtrlCreateList("debug menu", 0, 96, 112, 200, BitOR($WS_BORDER, $WS_VSCROLL))
$Label6 = GUICtrlCreateList("debug menu", 112, 96, 113, 200, BitOR($WS_BORDER, $WS_VSCROLL))

GUICtrlSetLimit(-1, 200)
Else
GUICreate("uglybot", 225, 100, 20, 0, BitOR($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
EndIf

$Label1 = GUICtrlCreateLabel("Label1", 0, 0, 225, 25)
$Label2 = GUICtrlCreateLabel("Label2", 0, 24, 225, 25)
$Label3 = GUICtrlCreateLabel("Label3", 0, 48, 225, 25)
$Label4 = GUICtrlCreateLabel("Label3", 0, 72, 225, 25)

GUISetState()

While 1;100ms(50)
;~ 	Sleep(100)
Sleep(50)
$info2 = "RUNNING PRESS F7 TO PAUSE / F9 TO QUIT"
GUICtrlSetData($Label2, $info2)
If $debug = 1 Then
$info5 = "In loop"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf

GUICtrlSetData($Label1, $info1)
GUICtrlSetData($Label2, $info2)
GUICtrlSetData($Label3, $info3)
GUICtrlSetData($Label4, $info4)

Switch $job
	Case 1
		$info3 = "Function start()"
GUICtrlSetData($Label3, $info3)
$job = start()
Case 2
	$info3 = "Function state()"
GUICtrlSetData($Label3, $info3)
$job = state()
Case 3
	$info3 = "Function fight()"
GUICtrlSetData($Label3, $info3)
$job = fight()
Case 4
	$info3 = "Function walk()"
GUICtrlSetData($Label3, $info3)
$job = walk()
Case 5
	$info3 = "Function login()"
GUICtrlSetData($Label3, $info3)
$job = login()
Case 6
	$info3 = "Function fishbot()"
GUICtrlSetData($Label3, $info3)
$job = fishbot()
Case 7
	$info3 = "Function casinobot()"
GUICtrlSetData($Label3, $info3)
$job = casinobot()
Case 8
$job = setting()
EndSwitch
WEnd

Func fight();0-100ms 1/20
$check = $check + 1
If $debug = 1 Then
$info5 = "In fight"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
If $something = 1 Then
$count = $count + 1
$totalcount = $totalcount + 1
$something = 0
EndIf
;~ $image = PixelSearch(110, 395, 750, 540, 0x8DC655, 5);greenbar
;~ If IsArray($image) Then
;~ If $debug = 1 Then
;~ $info6 = "Mousclick left - greenbar"
;~ _GUICtrlListBox_BeginUpdate($Label6)
;~ _GUICtrlListBox_InsertString($Label6, $info6)
;~ _GUICtrlListBox_EndUpdate($Label6)
;~ $iIndex = _GUICtrlListBox_GetCurSel($Label6)
;~ $iIndex = $iIndex + 1
;~ _GUICtrlListBox_SetCurSel($Label6, $iIndex)
;~ EndIf
;~ MouseClick("left", $image[0], $image[1], 1, 0)
;~ Sleep(50)
;~ If $debug = 1 Then
;~ $info6 = "B button sent"
;~ _GUICtrlListBox_BeginUpdate($Label6)
;~ _GUICtrlListBox_InsertString($Label6, $info6)
;~ _GUICtrlListBox_EndUpdate($Label6)
;~ $iIndex = _GUICtrlListBox_GetCurSel($Label6)
;~ $iIndex = $iIndex + 1
;~ _GUICtrlListBox_SetCurSel($Label6, $iIndex)
;~ EndIf
;~ Send($bbutton)
;~ Sleep(50)
;~ Return 1
;~ EndIf

	$image = _ImageSearchArea('hp.png', 1, $pos[0]+129, $pos[1]+456, $pos[0]+756, $pos[1]+556, $x, $y, 80)
	If $image = 1 Then;50ms
	$info3 = "Warning one guy died"
	GUICtrlSetData($Label3, $info3)
		Sleep(50)
		$image = _ImageSearchArea('hp.png', 1, $pos[0]+129, $pos[1]+456, $pos[0]+336, $pos[1]+504, $x, $y, 80)
		If $image = 1 Then
;~ 			$poke1 = 0
		Else
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			Send($bbutton)
			Return 1
		EndIf
		$image = _ImageSearchArea('hp.png', 1, $pos[0]+337, $pos[1]+456, $pos[0]+544, $pos[1]+504, $x, $y, 80)
		If $image = 1 Then
;~ 			$poke2 = 0
		Else
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			Send($bbutton)
			Return 1
		EndIf
		$image = _ImageSearchArea('hp.png', 1, $pos[0]+551, $pos[1]+456, $pos[0]+754, $pos[1]+504, $x, $y, 80)
		If $image = 1 Then
;~ 			$poke3 = 0
		Else
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			Send($bbutton)
			Return 1
		EndIf
		$image = _ImageSearchArea('hp.png', 1, $pos[0]+129, $pos[1]+511, $pos[0]+336, $pos[1]+554, $x, $y, 80)
		If $image = 1 Then
;~ 			$poke4 = 0
		Else
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			Send($bbutton)
			Return 1
		EndIf
		$image = _ImageSearchArea('hp.png', 1, $pos[0]+337, $pos[1]+511, $pos[0]+544, $pos[1]+554, $x, $y, 80)
		If $image = 1 Then
;~ 			$poke5 = 0
		Else
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			Send($bbutton)
			Return 1
		EndIf
		$image = _ImageSearchArea('hp.png', 1, $pos[0]+551, $pos[1]+511, $pos[0]+754, $pos[1]+554, $x, $y, 80)
		If $image = 1 Then
;~ 			$poke6 = 0
		Else
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send($abutton)
			Sleep(50)
			Send($bbutton)
			Return 1
		EndIf
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Send($bbutton)
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Send($bbutton)
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{UP}")
			Sleep(50)
			Send($abutton)
			Send($bbutton)
			Sleep(50)
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send($abutton)
			Send($bbutton)
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{LEFT}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send($abutton)
			Send($bbutton)
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{RIGHT}")
			Sleep(50)
			Send("{DOWN}")
			Sleep(50)
			Send($abutton)
			Send($bbutton)
			Sleep(50)
		Return 1
	EndIf



$image = PixelSearch(110, 395, 540, 540, 0xCFA806, 5);orange
If IsArray($image) Then
Sleep(50)
If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($bbutton)
If $catch = 1 Then
	$catched = 0
	$i = 0
	While $i < 3
	Sleep(50)
	$image = PixelSearch(160, 105, 400, 115, 0xA80000, 5);redpokeball
	$i = $i + 1
	If IsArray($image) Then
	$catched = 1
	EndIf
	WEnd
	If $catched = 0 Then
		Sleep(50)
		If $debug = 1 Then
$info6 = "Right stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
		Send("{RIGHT}")
		Sleep(50)
		If $debug = 1 Then
$info6 = "Up stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
		Send("{UP}")
		Sleep(50)
		If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
		Send($abutton)
		Sleep(50)
		If $debug = 1 Then
$info6 = "Right stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
		Send("{RIGHT}")
		Sleep(50)
		If $debug = 1 Then
$info6 = "Right stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
		Send("{RIGHT}")
		Sleep(50)
		$i = 0
		While $i < 3
			Sleep(50)
		$image = PixelSearch(117, 443, 459, 474, 0xCFA806, 5);orange
		$i = $i + 1
		If IsArray($image) Then
			If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
			Send($abutton)
			Sleep(500)
			Return 1
		Else;no balls
		$catch = 0
		Sleep(50)
		If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
		Send($bbutton)
		Sleep(50)
		Return 1
		EndIf
		WEnd
	EndIf
	EndIf
	If $train = 1 And $change = 0 Then
	Sleep(50)
	If $debug = 1 Then
$info6 = "Left stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{LEFT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Left stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{LEFT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{DOWN}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{DOWN}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($abutton)
	Sleep(50)
	If $debug = 1 Then
$info6 = "Right stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{RIGHT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($abutton)
	Sleep(500)
	$change = 1
	Else
	$info3 = "Attacking."
	GUICtrlSetData($Label3, $info3)
	Sleep(50)
	If $debug = 1 Then
$info6 = "Left stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{LEFT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Left stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{LEFT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Up stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{UP}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Up stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{UP}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($abutton)
	Sleep(50)
	$pp1 = 1
	$pp2 = 1
	$pp3 = 1
	$pp4 = 1
	$i = 0
	While $i < 3
	$info3 = "Got PP?"
	GUICtrlSetData($Label3, $info3)
	Sleep(50)
	$i = $i + 1
	$image2 = _ImageSearchArea('pp2.png', 1, $pos[0]+122, $pos[1]+453, $pos[0]+227, $pos[1]+501, $x, $y, 80)
	$image = _ImageSearchArea('pp.png', 1, $pos[0]+122, $pos[1]+453, $pos[0]+227, $pos[1]+501, $x, $y, 80)
	If $image = 1 Or $image2 = 1 Then
	$info3 = "Warning no PP"
	GUICtrlSetData($Label3, $info3)
	$pp1 = 0
	EndIf

	$image2 = _ImageSearchArea('pp2.png', 1, $pos[0] + 335, $pos[1] + 454, $pos[0] + 437, $pos[1] + 496, $x, $y, 80)
	$image = _ImageSearchArea('pp.png', 1, $pos[0] + 335, $pos[1] + 454, $pos[0] + 437, $pos[1] + 496, $x, $y, 80)
	If $image = 1 Or $image2 = 1 Then
	$info3 = "Warning no PP"
	GUICtrlSetData($Label3, $info3)
	$pp2 = 0
	EndIf

	$image2 = _ImageSearchArea('pp2.png', 1, $pos[0] + 125, $pos[1] + 507, $pos[0] + 220, $pos[1] + 555, $x, $y, 80)
	$image = _ImageSearchArea('pp.png', 1, $pos[0] + 125, $pos[1] + 507, $pos[0] + 220, $pos[1] + 555, $x, $y, 80)
	If $image = 1 Or $image2 = 1 Then
	$info3 = "Warning no PP"
	GUICtrlSetData($Label3, $info3)
	$pp3 = 0
	EndIf

	$image2 = _ImageSearchArea('pp2.png', 1, $pos[0] + 336, $pos[1] + 509, $pos[0] + 440, $pos[1] + 555, $x, $y, 80)
	$image = _ImageSearchArea('pp.png', 1, $pos[0] + 336, $pos[1] + 509, $pos[0] + 440, $pos[1] + 555, $x, $y, 80)
	If $image = 1 Or $image2 = 1 Then
	$info3 = "Warning no PP"
	GUICtrlSetData($Label3, $info3)
	$pp4 = 0
	EndIf

	WEnd
	Dim $selectedatk[10]
	$e = -1

	If $move1 = 1  And $pp1 = 1 Then
	$e = $e+1
	$selectedatk[$e] = "$move1"
	EndIf
	If $move2 = 1  And $pp2 = 1 Then
	$e = $e+1
	$selectedatk[$e] = "$move2"
	EndIf
	If $move3 = 1  And $pp3 = 1 Then
	$e = $e+1
	$selectedatk[$e] = "$move3"
	EndIf
	If $move4 = 1  And $pp4 = 1 Then
	$e = $e+1
	$selectedatk[$e] = "$move4"
	EndIf

	If $e = -1 Then
		$e = $e+1
		$selectedatk[$e] = "$move4"
		$e = $e+1
		$selectedatk[$e] = "$move3"
		$e = $e+1
		$selectedatk[$e] = "$move2"
		$e = $e+1
		$selectedatk[$e] = "$move1"
	EndIf


	$nothing = ""
	$empty = _ArraySearch($selectedatk, $nothing)

	If $empty > 0 Then
	_ArrayDelete($selectedatk, $empty)
	$empty = _ArraySearch($selectedatk, $nothing)
	EndIf
	If $empty > 0 Then
	_ArrayDelete($selectedatk, $empty)
	$empty = _ArraySearch($selectedatk, $nothing)
	EndIf
	If $empty > 0 Then
	_ArrayDelete($selectedatk, $empty)
	$empty = _ArraySearch($selectedatk, $nothing)
	EndIf
	If $empty > 0 Then
	_ArrayDelete($selectedatk, $empty)
	$empty = _ArraySearch($selectedatk, $nothing)
	EndIf

	$pick = Random(0,$e, 1)

	$e = -1
	If $selectedatk[$pick] = "$move1" Then
		If $debug = 1 Then
$info6 = "Left stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{LEFT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Up stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{UP}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($abutton)
	Sleep(50)
	Return 1
	EndIf
	If $selectedatk[$pick] = "$move2" Then
		If $debug = 1 Then
$info6 = "Right stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{RIGHT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Up stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{UP}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($abutton)
	Sleep(50)
	Return 1
	EndIf
	If $selectedatk[$pick] = "$move3" Then
		If $debug = 1 Then
$info6 = "Left stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{LEFT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{DOWN}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($abutton)
	Sleep(50)
	Return 1
	EndIf
	If $selectedatk[$pick] = "$move4" Then
		If $debug = 1 Then
$info6 = "Right stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{RIGHT}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{DOWN}")
	Sleep(50)
	If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($abutton)
	Sleep(50)
	Return 1
	EndIf

	EndIf
	Return 1
	EndIf
	$image = PixelSearch(875, 515, 895, 535, 0xFFFFFF, 5);fleche blanche
	If IsArray($image) Then
	$info3 = "Input needed."
	GUICtrlSetData($Label3, $info3)
	Sleep(50)
	If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($bbutton)
	Sleep(50)
	Return 1
	EndIf

If $check > 20 Then;100ms  1/20
	Sleep(50)
	If $debug = 1 Then
		$info6 = "Right stick"
		_GUICtrlListBox_BeginUpdate($Label6)
		_GUICtrlListBox_InsertString($Label6, $info6)
		_GUICtrlListBox_EndUpdate($Label6)
		$iIndex = _GUICtrlListBox_GetCurSel($Label6)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label6, $iIndex)
	EndIf
	Send("{RIGHT}");juste au cas ou on perde le focus
	Sleep(50)
	$check = 0
EndIf


	$image = PixelSearch(780, 430, 800, 450, 0x839299, 5);b de move
	If IsArray($image) Then
		If $moveforget = 1 Then
			$info3 = "Move detected"
			GUICtrlSetData($Label3, $info3)
			Sleep(50)
			MouseClick("left", $image[0], $image[1], 1, 0)
			Sleep(50)
			MouseClick("left", 509, 377, 1, 0)
			Sleep(50)
			Return 1
		Else
			SoundPlay("move.wav", 1)
			Sleep(500)
			Return 1
		EndIf
	EndIf
	Return 1
EndFunc   ;==>fight

Func walk();0
	If $debug = 1 Then
		$info5 = "In walk"
		_GUICtrlListBox_BeginUpdate($Label5)
		_GUICtrlListBox_InsertString($Label5, $info5)
		_GUICtrlListBox_EndUpdate($Label5)
		$iIndex = _GUICtrlListBox_GetCurSel($Label5)
		$iIndex = $iIndex + 1
		_GUICtrlListBox_SetCurSel($Label5, $iIndex)
	EndIf
	if $waypoint = 1 Then
		Sleep(100)
		$image = _ImageSearchArea('poke.png', 1, $pos[0], $pos[1], $pos[2], $pos[3], $x, $y, 55)
			If $image = 1 Then;in pc but where?
			$pokecenter = 1;set waypoint for after pokecenter
			if $align = 0 Then
				If $x < $pos[0]+490 Then;perso a droite donc send gauche
					Sleep(100)
					Send("{LEFT down}")
					Sleep(100)
					Send("{LEFT up}")
					Sleep(100)
					Return 1
				EndIf
				If $x > $pos[0]+550 Then;perso a gauche donc send droite
					Sleep(100)
					Send("{RIGHT down}")
					Sleep(100)
					Send("{RIGHT up}")
					Sleep(100)
					Return 1
				EndIf
				If $y < $pos[1]+275 Then;perso en bas donc send haut
					Sleep(100)
					Send("{UP down}")
					Sleep(100)
					Send("{UP up}")
					Sleep(100)
					Return 1
				EndIf
				If $y > $pos[1]+310 Then;perso en haut (wtf?) donc send bas
					Sleep(100)
					Send("{DOWN down}")
					Sleep(100)
					Send("{DOWN up}")
					Sleep(100)
					Return 1
				EndIf
				;sinon on est aligné tout va bien on sort
				$align = 1
			EndIf
;~ 			Sleep(100)
			Send("{DOWN down}")
			Sleep(300)
			Send("{DOWN up}")
;~ 			Sleep(500)
			Return 1
		EndIf; on est dehors
		$align = 0
		;some kind of read waypoint file
		;wp for pc2
			If $pokecenter = 1 Then;here is wp 1  for pc2 if so can there be others
			Send("{DOWN down}");first step is to exit PC
			Sleep(250)
			Send("{DOWN up}")
			Sleep(2000);then wait for load
;~ 			$file = FileOpen("waypoint.txt", 0)
Sleep(250)
$File = @sCripTDir & '\waypoint.txt'
Run @autoItExe & ' /AutoIt3ExecuteScript ' & FileGetShortName($File))
Sleep(250)

;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{RIGHT down}")
;~ 			Sleep(250)
;~ 			Send("{RIGHT up}")
;~ 			Send("{RIGHT down}")
;~ 			Sleep(250)
;~ 			Send("{RIGHT up}")
;~ 			Send("{RIGHT down}")
;~ 			Sleep(250)
;~ 			Send("{RIGHT up}")
;~ 			Send("{RIGHT down}")
;~ 			Sleep(250)
;~ 			Send("{RIGHT up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Send("{DOWN down}")
;~ 			Sleep(250)
;~ 			Send("{DOWN up}")
;~ 			Sleep(250)
			$pokecenter = 0
			Return 1
		EndIf
	EndIf

$something = 1
$change = 0

If $square = 1 Then
If $walk < 1 Then
	If $walked < $walktime Then
		$info3 = "Walking down."
		GUICtrlSetData($Label3, $info3)
		If $debug = 1 Then
			$info6 = "Down stick"
			_GUICtrlListBox_BeginUpdate($Label6)
			_GUICtrlListBox_InsertString($Label6, $info6)
			_GUICtrlListBox_EndUpdate($Label6)
			$iIndex = _GUICtrlListBox_GetCurSel($Label6)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label6, $iIndex)
		EndIf
		Send("{DOWN down}")
		Sleep(250)
		Send("{DOWN up}")
;~ 		Sleep(50)
		$walked = $walked + 1
		Return 1
	EndIf
$walk = 1
$walked = 0
Return 1
EndIf
If $walk < 2 Then
	If $walked < $walktime Then
		$info3 = "Walking left."
		GUICtrlSetData($Label3, $info3)
		If $debug = 1 Then
			$info6 = "Left stick"
			_GUICtrlListBox_BeginUpdate($Label6)
			_GUICtrlListBox_InsertString($Label6, $info6)
			_GUICtrlListBox_EndUpdate($Label6)
			$iIndex = _GUICtrlListBox_GetCurSel($Label6)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label6, $iIndex)
		EndIf
		Send("{LEFT down}")
		Sleep(250)
		Send("{LEFT up}")
;~ 		Sleep(50)
		$walked = $walked + 1
		Return 1
	EndIf
$walk = 2
$walked = 0
Return 1
EndIf
If $walk < 3 Then
	If $walked < $walktime Then
		$info3 = "Walking up."
		GUICtrlSetData($Label3, $info3)
		If $debug = 1 Then
			$info6 = "Up stick"
			_GUICtrlListBox_BeginUpdate($Label6)
			_GUICtrlListBox_InsertString($Label6, $info6)
			_GUICtrlListBox_EndUpdate($Label6)
			$iIndex = _GUICtrlListBox_GetCurSel($Label6)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label6, $iIndex)
		EndIf
		Send("{UP down}")
		Sleep(250)
		Send("{UP up}")
;~ 		Sleep(50)
		$walked = $walked + 1
		Return 1
	EndIf
$walk = 3
$walked = 0
Return 1
EndIf
If $walk < 4 Then
	If $walked < $walktime Then
		$info3 = "Walking right."
		GUICtrlSetData($Label3, $info3)
		If $debug = 1 Then
			$info6 = "Right stick"
			_GUICtrlListBox_BeginUpdate($Label6)
			_GUICtrlListBox_InsertString($Label6, $info6)
			_GUICtrlListBox_EndUpdate($Label6)
			$iIndex = _GUICtrlListBox_GetCurSel($Label6)
			$iIndex = $iIndex + 1
			_GUICtrlListBox_SetCurSel($Label6, $iIndex)
		EndIf
		Send("{RIGHT down}")
		Sleep(250)
		Send("{RIGHT up}")
;~ 		Sleep(50)
		$walked = $walked + 1
		Return 1
	EndIf
$walk = 0
$walked = 0
Return 1
EndIf
Return 1
EndIf

If $square = 0 Then
	If $walk < 1 Then
		If $walked < $walktime Then
			$info3 = "Walking down."
			GUICtrlSetData($Label3, $info3)
			If $debug = 1 Then
				$info6 = "Down stick"
				_GUICtrlListBox_BeginUpdate($Label6)
				_GUICtrlListBox_InsertString($Label6, $info6)
				_GUICtrlListBox_EndUpdate($Label6)
				$iIndex = _GUICtrlListBox_GetCurSel($Label6)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label6, $iIndex)
			EndIf
			Send("{DOWN down}")
			Sleep(200)
			Send("{DOWN up}")
;~ 			Sleep(50)
			$walked = $walked + 1
			Return 1
		EndIf
		$walk = 1
		$walked = 0
		Return 1
	EndIf
	If $walk < 2 Then
		If $walked < $walktime Then
			$info3 = "Walking up."
			GUICtrlSetData($Label3, $info3)
			If $debug = 1 Then
				$info6 = "Up stick"
				_GUICtrlListBox_BeginUpdate($Label6)
				_GUICtrlListBox_InsertString($Label6, $info6)
				_GUICtrlListBox_EndUpdate($Label6)
				$iIndex = _GUICtrlListBox_GetCurSel($Label6)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label6, $iIndex)
			EndIf
			Send("{UP down}")
			Sleep(200)
			Send("{UP up}")
;~ 			Sleep(50)
			$walked = $walked + 1
			Return 1
		EndIf
		$walk = 0
		$walked = 0
		Return 1
	EndIf
	Return 1
EndIf

If $square = 2 Then
	If $walk < 1 Then
		If $walked < $walktime Then
			$info3 = "Walking left."
			GUICtrlSetData($Label3, $info3)
			If $debug = 1 Then
				$info6 = "Left stick"
				_GUICtrlListBox_BeginUpdate($Label6)
				_GUICtrlListBox_InsertString($Label6, $info6)
				_GUICtrlListBox_EndUpdate($Label6)
				$iIndex = _GUICtrlListBox_GetCurSel($Label6)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label6, $iIndex)
			EndIf
			Send("{LEFT down}")
			Sleep(200)
			Send("{LEFT up}")
;~ 			Sleep(50)
			$walked = $walked + 1
			Return 1
		EndIf
		$walk = 1
		$walked = 0
		Return 1
	EndIf

	If $walk < 2 Then
		If $walked < $walktime Then
			$info3 = "Walking right."
			GUICtrlSetData($Label3, $info3)
			If $debug = 1 Then
				$info6 = "Right stick"
				_GUICtrlListBox_BeginUpdate($Label6)
				_GUICtrlListBox_InsertString($Label6, $info6)
				_GUICtrlListBox_EndUpdate($Label6)
				$iIndex = _GUICtrlListBox_GetCurSel($Label6)
				$iIndex = $iIndex + 1
				_GUICtrlListBox_SetCurSel($Label6, $iIndex)
			EndIf
			Send("{RIGHT down}")
			Sleep(200)
			Send("{RIGHT up}")
;~ 			Sleep(50)
			$walked = $walked + 1
			Return 1
		EndIf
		$walk = 0
		$walked = 0
		Return 1
	EndIf
	Return 1
EndIf
Return 1
EndFunc   ;==>walk

Func login();
If $debug = 1 Then
$info5 = "In login"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
If $log = 1 Then
$info3 = "Loggin in..."
GUICtrlSetData($Label3, $info3)
Sleep(500)
If $debug = 1 Then
$info6 = "Mouseclick - login input"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
MouseClick("left", 582, 351, 2, 0);login
Sleep(50)
If $debug = 1 Then
$info6 = "Backspace sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{BS down}")
Sleep(1700)
Send("{BS up}")
Sleep(50)
If $debug = 1 Then
$info6 = "Delete sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{DEL down}")
Sleep(1700)
Send("{DEL up}")
Sleep(50)
If $debug = 1 Then
$info6 = "Username sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($user)
Sleep(50)
If $debug = 1 Then
$info6 = "Tabulation sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{TAB}")
Sleep(50)
If $debug = 1 Then
$info6 = "Backspace sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{BS down}")
Sleep(1500)
Send("{BS up}")
Sleep(50)
If $debug = 1 Then
$info6 = "Delete sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{DEL down}")
Sleep(1500)
Send("{DEL up}")
Sleep(50)
If $debug = 1 Then
$info6 = "Password sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($pass)
Sleep(50)
If $debug = 1 Then
$info6 = "Enter sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{ENTER}")
Sleep(3000)
If $debug = 1 Then
$info6 = "Enter sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{ENTER}")
Sleep(3000)
If $debug = 1 Then
$info6 = "Enter sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{ENTER}")
Sleep(3000)
$info3 = "Logged in."
GUICtrlSetData($Label3, $info3)
Return 1;start
Else
$info3 = "Autologin not enabled, please login."
GUICtrlSetData($Label3, $info3)
Return 1;start
EndIf
EndFunc   ;==>login

Func state();50ms + 50 (0)
If WinGetPos("uglybot", "") <> WinGetPos("[CLASS:LWJGL]") Then
	WinMove("uglybot", "", $pos[0]-225, $pos[1])
EndIf

If $debug = 1 Then
$info5 = "In state"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$image = PixelSearch(503, 715, 515, 720, 0x242C31, 1)
If IsArray($image) And $catch = 1 And $casino = 0 Then;500 only 1
Send("{F12}")
Sleep(500)
Return 1
EndIf

$image = PixelSearch(200, 400, 700, 420, 0x1D415D, 3);bleu fight 50ms
If IsArray($image) Then
;~ Sleep(50)
Return 3
EndIf
$image = PixelSearch(500, 85, 520, 95, 0xF3EA6D, 3);login mmo 50ms
If IsArray($image) Then
;~ Sleep(50)
Return 5
EndIf
;~ Sleep(50) ;50ms
If $fish = 1 Then
Return 6
EndIf
If $casino = 1 Then
	Return 7
EndIf
Return 4;walk 0ms
EndFunc   ;==>state

Func start();50ms (0)
If $debug = 1 Then
$info5 = "In start"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$info1 = "Initialising..."
GUICtrlSetData($Label1, $info1)
If $read = 0 Then
$log = IniRead("config.ini", "setting", "log", "0")
If $log = 1 Then
$user =  IniRead("config.ini", "setting", "user", "")
$pass = BinaryToString(IniRead("config.ini", "setting", "pass", '"passdefault"'), 4)
EndIf
$debug = IniRead("config.ini", "setting", "debug", "0")
$train = IniRead("config.ini", "setting", "train", "0")
$square = IniRead("config.ini", "setting", "square", "0")
$walktime = IniRead("config.ini", "setting", "walktime", "800")
$abutton = IniRead("config.ini", "setting", "abutton", "z")
$bbutton = IniRead("config.ini", "setting", "bbutton", "x")
$moveforget = IniRead("config.ini", "setting", "moveforget", "0")
$fish = IniRead("config.ini", "setting", "fish", "0")
$read = 1
$move1 = IniRead("config.ini", "setting", "move1", "1")
$move2 = IniRead("config.ini", "setting", "move2", "0")
$move3 = IniRead("config.ini", "setting", "move3", "0")
$move4 = IniRead("config.ini", "setting", "move4", "0")
EndIf

If $casino = 1 Then
$info4 = "Number of gamble: "&$totalcount
Else
$info4 = "Number of Pokemon fought: "&$totalcount
EndIf

If Not WinExists("[CLASS:LWJGL]") Then;50ms
$info1 = "Window not found, waiting for game."
GUICtrlSetData($Label1, $info1)
Sleep(50)
Return 1
EndIf
If WinActive("[CLASS:LWJGL]") Then;50ms
	if $offscreen = 1 Then
		WinMove("[CLASS:LWJGL]", "", @desktopWidth - 20, 0)
	EndIf
$pos = WinGetPos("[CLASS:LWJGL]")
$info1 = "Window found, focus OK."
WinMove("[CLASS:LWJGL]", "", $pos[0], $pos[1], 1032, 795)
GUICtrlSetData($Label1, $info1)
;~ Sleep(50); 50ms
Return 2;state
EndIf
WinActivate("[CLASS:LWJGL]")
$info1 = "Window found, waiting for game focus."
GUICtrlSetData($Label1, $info1)
;~ Sleep(50);50ms
Return 1
EndFunc   ;==>start

Func _ImageSearchArea($FindImage, $ResultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $Tolerance)
If $Tolerance > 0 Then $FindImage = "*" & $Tolerance & " " & $FindImage

If @autoItX64 Then
$Result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $FindImage)
Else
$Result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $FindImage)
EndIf

If $Result = "0" Then Return 0

$Array = StringSplit($Result[0], "|")

If (UBound($Array) >= 4) Then
$x = Int(Number($Array[2]))
$y = Int(Number($Array[3]))

If $ResultPosition = 1 Then
$x = $x + Int(Number($Array[4]) / 2)
$y = $y + Int(Number($Array[5]) / 2)
EndIf
Return 1
EndIf
EndFunc   ;==>_ImageSearchArea

Func TogglePause()
If $debug = 1 Then
$info5 = "In pause"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
While 1
$info2 = "PAUSED PRESS F8 TO RESUME / F9 TO QUIT"
GUICtrlSetData($Label2, $info2)
Sleep(100)
If _IsPressed("77", $dll) Then
Return 1
EndIf
WEnd
EndFunc   ;==>TogglePause

Func quit()
	If $offscreen = 1 Then
	WinMove("[CLASS:LWJGL]", "", 0, 0)
	EndIf
If $debug = 1 Then
$info5 = "In quit"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
Sleep(100)
Exit
EndFunc   ;==>TogglePause

Func setting()
#region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\Desktop\pokemmo bot\koda\Forms\Form1.kxf
$Form1 = GUICreate("UglyBot Setting", 466, 294, 287, 138)
$Label1 = GUICtrlCreateLabel("Auto Login", 16, 8, 55, 17)
$Label2 = GUICtrlCreateLabel("Username", 16, 36, 52, 17)
$Label3 = GUICtrlCreateLabel("Password", 16, 63, 50, 17)
$Label4 = GUICtrlCreateLabel("Debug Mode", 16, 91, 66, 17)
$Label5 = GUICtrlCreateLabel("Training", 16, 118, 42, 17)
$Label6 = GUICtrlCreateLabel("Walking type", 16, 146, 66, 17)
$Label7 = GUICtrlCreateLabel("Walking steps", 16, 173, 107, 17)
$Label8 = GUICtrlCreateLabel("Button A", 16, 201, 45, 17)
$Label9 = GUICtrlCreateLabel("Button B", 16, 228, 45, 17)
$Button1 = GUICtrlCreateButton("Save and start", 16, 256, 89, 25)
$Checkbox1 = GUICtrlCreateCheckbox("", 104, 8, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("", 104, 89, 17, 17)
$Radio1 = GUICtrlCreateRadio("Square", 104, 143, 113, 17)
$Radio2 = GUICtrlCreateRadio("Left/Right", 224, 144, 113, 17)
$Radio3 = GUICtrlCreateRadio("Up/Down", 344, 144, 113, 17)
$Input3 = GUICtrlCreateInput("500", 104, 170, 121, 21)
$Input4 = GUICtrlCreateInput("Z", 104, 197, 121, 21)
$Input5 = GUICtrlCreateInput("X", 104, 224, 121, 21)
$Checkbox3 = GUICtrlCreateCheckbox("", 104, 116, 17, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Forget new Moves", 144, 116, 107, 17)
$Checkbox5 = GUICtrlCreateCheckbox("FishBot (F5)", 144, 89, 107, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Move 1", 224, 40, 97, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Move 3", 224, 64, 97, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Move 2", 336, 40, 97, 17)
$Checkbox9 = GUICtrlCreateCheckbox("Move 4", 336, 64, 97, 17)
$Checkbox10 = GUICtrlCreateCheckbox("Catch new pokemons", 336, 88, 107, 17)
$Checkbox11 = GUICtrlCreateCheckbox("Use waypoint", 336, 112, 107, 17)
$Checkbox12 = GUICtrlCreateCheckbox("Use offscreen", 336, 196, 107, 17)
$Label10 = GUICtrlCreateLabel("Move to use", 224, 16, 79, 17)
$Button2 = GUICtrlCreateButton("Casino bot", 312, 256, 73, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

If Not FileExists("config.ini") Then
IniWrite("config.ini", "setting", "log", "0")
IniWrite("config.ini", "setting", "user", '"user"')
IniWrite("config.ini", "setting", "pass", '"pass"')
IniWrite("config.ini", "setting", "debug", "0")
IniWrite("config.ini", "setting", "train", "0")
IniWrite("config.ini", "setting", "square", "1")
IniWrite("config.ini", "setting", "walktime", "5")
IniWrite("config.ini", "setting", "abutton", "z")
IniWrite("config.ini", "setting", "bbutton", "x")
IniWrite("config.ini", "setting", "moveforget", "0")
IniWrite("config.ini", "setting", "fish", "0")
IniWrite("config.ini", "setting", "move1", "1")
IniWrite("config.ini", "setting", "move2", "0")
IniWrite("config.ini", "setting", "move3", "0")
IniWrite("config.ini", "setting", "move4", "0")
IniWrite("config.ini", "setting", "catch", "0")
IniWrite("config.ini", "setting", "waypoint", "0")
IniWrite("config.ini", "setting", "offscreen", "0")
EndIf


If IniRead("config.ini", "setting", "log", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox1)
$Input1 = GUICtrlCreateInput("", 104, 35, 97, 21)
$Input2 = GUICtrlCreateInput("", 104, 62, 97, 21, $ES_PASSWORD)
GUICtrlSetData($Input1, IniRead("config.ini", "setting", "user", '"userdefault"'))
$pass = BinaryToString(IniRead("config.ini", "setting", "pass", '"passdefault"'), 4)
GUICtrlSetData($Input2, $pass)
$log = 1
Else
$log = 0
EndIf
If IniRead("config.ini", "setting", "debug", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox2)
$debug = 1
Else
$debug = 0
EndIf
If IniRead("config.ini", "setting", "catch", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox10)
$catch = 1
Else
$catch = 0
EndIf
If IniRead("config.ini", "setting", "train", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox3)
$train = 1
Else
$train = 0
EndIf
If IniRead("config.ini", "setting", "move1", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox6)
$move1 = 1
Else
$move1 = 0
EndIf
If IniRead("config.ini", "setting", "move2", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox7)
$move2 = 1
Else
$move2 = 0
EndIf
If IniRead("config.ini", "setting", "move3", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox8)
$move3 = 1
Else
$move3 = 0
EndIf
If IniRead("config.ini", "setting", "move4", "0") = 1 Then
_GUICtrlButton_SetCheck($Checkbox9)
$move4 = 1
Else
$move4 = 0
EndIf
If $move1 = 0 And $move2 = 0 And $move3 = 0 And $move4 = 0 Then
_GUICtrlButton_SetCheck($Checkbox6)
$move1 = 1
EndIf
If IniRead("config.ini", "setting", "square", "1") = 0 Then
_GUICtrlButton_SetCheck($Radio3)
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
$square = 0
EndIf
If IniRead("config.ini", "setting", "square", "1") = 2 Then
_GUICtrlButton_SetCheck($Radio2)
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
$square = 2
EndIf
If IniRead("config.ini", "setting", "square", "1") = 1 Then
_GUICtrlButton_SetCheck($Radio1)
_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
$square = 1
EndIf
If Not IniRead("config.ini", "setting", "square", "1") = 1 And Not IniRead("config.ini", "setting", "square", "1") = 0 And Not IniRead("config.ini", "setting", "square", "1") = 2 Then
_GUICtrlButton_SetCheck($Radio3)
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
$square = 0
EndIf
GUICtrlSetData($Input3, IniRead("config.ini", "setting", "walktime", "5"))
GUICtrlSetData($Input4, IniRead("config.ini", "setting", "abutton", "z"))
GUICtrlSetData($Input5, IniRead("config.ini", "setting", "bbutton", "x"))
If IniRead("config.ini", "setting", "moveforget", "1") = 1 Then
_GUICtrlButton_SetCheck($checkbox4)
$moveforget = 1
Else
$moveforget = 0
EndIf

If IniRead("config.ini", "setting", "fish", "0") = 1 Then
_GUICtrlButton_SetCheck($checkbox5)
$fish = 1
Else
$fish = 0
EndIf

If IniRead("config.ini", "setting", "waypoint", "0") = 1 Then
_GUICtrlButton_SetCheck($checkbox11)
$waypoint = 1
Else
$waypoint = 0
EndIf

If IniRead("config.ini", "setting", "offscreen", "0") = 1 Then
_GUICtrlButton_SetCheck($checkbox12)
$offscreen = 1
Else
$offscreen = 0
EndIf

While 1
$nMsg = GUIGetMsg()
Sleep(50)
If $log = 1 Then
$user = GUICtrlRead($Input1, 1)
$pass = GUICtrlRead($Input2, 1)
EndIf
$walktime = GUICtrlRead($Input3, 1)
$abutton = GUICtrlRead($Input4, 1)
$bbutton = GUICtrlRead($Input5, 1)
If $move1 = 0 And $move2 = 0 And $move3 = 0 And $move4 = 0 Then
_GUICtrlButton_SetCheck($Checkbox6)
$move1 = 1
EndIf

Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
IniWrite("config.ini", "setting", "log", $log)
If $log = 1 Then
IniWrite("config.ini", "setting", "user", $user)
IniWrite("config.ini", "setting", "pass", StringToBinary($pass, 4))
EndIf
IniWrite("config.ini", "setting", "debug", $debug)
IniWrite("config.ini", "setting", "train", $train)
IniWrite("config.ini", "setting", "square", $square)
IniWrite("config.ini", "setting", "walktime", $walktime)
IniWrite("config.ini", "setting", "abutton", $abutton)
IniWrite("config.ini", "setting", "bbutton", $bbutton)
IniWrite("config.ini", "setting", "moveforget", $moveforget)
IniWrite("config.ini", "setting", "fish", $fish)
IniWrite("config.ini", "setting", "move1", $move1)
IniWrite("config.ini", "setting", "move2", $move2)
IniWrite("config.ini", "setting", "move3", $move3)
IniWrite("config.ini", "setting", "move4", $move4)
IniWrite("config.ini", "setting", "catch", $catch)
IniWrite("config.ini", "setting", "waypoint", $waypoint)
IniWrite("config.ini", "setting", "offscreen", $offscreen)
GUIDelete($Form1)
If $offscreen = 1 Then
	send("{LWINDOWN}")
	Sleep(1000)
	send("p")
	Sleep(1000)
	Send("p")
	Sleep(1000)
	Send("p")
	Sleep(1000)
	send("{LWINUP}")
	Sleep(1000)
EndIf

Return 1
Case $Button2
	GUIDelete($Form1)
	If $offscreen = 1 Then
	send("{LWINDOWN}")
	Sleep(1000)
	send("p")
	Sleep(1000)
	Send("p")
	Sleep(1000)
	Send("p")
	Sleep(1000)
	send("{LWINUP}")
	Sleep(1000)
EndIf
	$casino = 1
	Return 1

Case $Checkbox1
If _GUICtrlButton_GetCheck($Checkbox1) Then
$log = 1
$Input1 = GUICtrlCreateInput("", 104, 35, 97, 21)
$Input2 = GUICtrlCreateInput("", 104, 62, 97, 21, $ES_PASSWORD)
Else
$log = 0
GUICtrlDelete($Input1)
GUICtrlDelete($Input2)
EndIf
Case $Radio1
If _GUICtrlButton_GetCheck($Radio1) Then
$square = 1
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
EndIf
Case $Radio2
If _GUICtrlButton_GetCheck($Radio2) Then
$square = 2
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio3, $BST_UNCHECKED)
EndIf
Case $Radio3
If _GUICtrlButton_GetCheck($Radio3) Then
$square = 0
_GUICtrlButton_SetCheck($Radio1, $BST_UNCHECKED)
_GUICtrlButton_SetCheck($Radio2, $BST_UNCHECKED)
EndIf
Case $Checkbox2
If _GUICtrlButton_GetCheck($Checkbox2) Then
$debug = 1
Else
$debug = 0
EndIf

Case $Checkbox3
If _GUICtrlButton_GetCheck($Checkbox3) Then
$train = 1
Else
$train = 0
EndIf
Case $checkbox4
If _GUICtrlButton_GetCheck($checkbox4) Then
$moveforget = 1
Else
$moveforget = 0
EndIf
Case $checkbox5
If _GUICtrlButton_GetCheck($checkbox5) Then
$fish = 1
Else
$fish = 0
EndIf
Case $checkbox6
If _GUICtrlButton_GetCheck($checkbox6) Then
$move1 = 1
Else
$move1 = 0
EndIf
Case $checkbox7
If _GUICtrlButton_GetCheck($checkbox7) Then
$move2 = 1
Else
$move2 = 0
EndIf
Case $checkbox8
If _GUICtrlButton_GetCheck($checkbox8) Then
$move3 = 1
Else
$move3 = 0
EndIf
Case $checkbox9
If _GUICtrlButton_GetCheck($checkbox9) Then
$move4 = 1
Else
$move4 = 0
EndIf
Case $checkbox10
If _GUICtrlButton_GetCheck($checkbox10) Then
$catch = 1
Else
$catch = 0
EndIf
Case $checkbox11
If _GUICtrlButton_GetCheck($checkbox11) Then
$waypoint = 1
Else
$waypoint = 0
EndIf
Case $checkbox12
If _GUICtrlButton_GetCheck($checkbox12) Then
$offscreen = 1
Else
$offscreen = 0
EndIf

EndSwitch
WEnd

EndFunc   ;==>setting

Func casinobot()
If $debug = 1 Then
$info5 = "In casino"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
WinActivate("[CLASS:LWJGL]")
$image = PixelSearch(700, 500, 710, 510, 0xE8A800, 1)
If IsArray($image)Then;in slot
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{DOWN}")
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{DOWN}")
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send("{DOWN}")
	Sleep(Random(500,1000,1))
	WinActivate("[CLASS:LWJGL]")
	If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($bbutton)
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($bbutton)
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($bbutton)
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($bbutton)
	Sleep(Random(100,500,1))
	WinActivate("[CLASS:LWJGL]")
	If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
	Send($bbutton)
	Sleep(Random(3000,4500,1))
	Return 1
Else
	Sleep(500)
	Return 1
EndIf
Return 1
EndFunc

Func fishbot()
If $debug = 1 Then
$info5 = "In fishbot"
_GUICtrlListBox_BeginUpdate($Label5)
_GUICtrlListBox_InsertString($Label5, $info5)
_GUICtrlListBox_EndUpdate($Label5)
$iIndex = _GUICtrlListBox_GetCurSel($Label5)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label5, $iIndex)
EndIf
$change = 0
If $count = 9 Then
$hurt = 1
$count = 0
EndIf

$image = PixelSearch(500, 170, 510, 180, 0xE08098, 1)
$image2 = PixelSearch(500, 165, 510, 180, 0xD06878, 1)
If $hurt = 1 Then
If IsArray($image) Or IsArray($image2) Then
Send("{UP up}")
Sleep(2000)
If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($abutton);talk nurse
Sleep(2000)
If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($abutton); say hi
Sleep(2000)
If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($abutton);heal
Sleep(2000)
If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($abutton);waiting
Sleep(2000)
If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($bbutton);thanks
Sleep(2000)
If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($bbutton);bye
Sleep(2000)
If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($bbutton);yeah love you too
Sleep(2000)
If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($bbutton);stop talking to me psycho
Sleep(2000)
If $debug = 1 Then
$info6 = "B button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($bbutton);im gonna call your manager!
Sleep(2000)
$hurt = 0
Return 1
EndIf
EndIf


$image = PixelSearch(500, 410, 510, 420, 0x4878D8, 1)
If IsArray($image) And $hurt = 0 Then
Send("{DOWN up}")
Sleep(500)
If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{DOWN}");make sure you look ok
Sleep(50)
If $debug = 1 Then
$info6 = "Cane button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($canebutton);see water
$something = 0
Sleep(5000)
If $debug = 1 Then
$info6 = "A button sent"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send($abutton);somenthing?
Sleep(500)
If $debug = 1 Then
$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{DOWN}")
$something = 1
Return 1
EndIf

If $hurt = 1 Then
	If $debug = 1 Then
	$info6 = "Up stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{UP down}")
Return 1
EndIf

If $hurt = 0 Then
	If $debug = 1 Then
	$info6 = "Down stick"
_GUICtrlListBox_BeginUpdate($Label6)
_GUICtrlListBox_InsertString($Label6, $info6)
_GUICtrlListBox_EndUpdate($Label6)
$iIndex = _GUICtrlListBox_GetCurSel($Label6)
$iIndex = $iIndex + 1
_GUICtrlListBox_SetCurSel($Label6, $iIndex)
EndIf
Send("{DOWN down}")
Return 1
EndIf
Return 1
EndFunc
UglyBot + source 0.3.2_mpgh.net.zip
#12 · 12y ago
Austin
[MPGH]Austin
approved but not tested .
#13 · 12y ago
KY
Kyuuby
Thank you very much
its awesome! ^^
Please go on with the developing )
#14 · 12y ago
supercarz1991
supercarz1991
i'm giving it a shot now, been looking for a game like this
#15 · 12y ago
Posts 1–15 of 34 · Page 1 of 3

Post a Reply

Similar Threads

  • [Bot Release] Simple Trigger BotBy blah in Combat Arms Hacks & Cheats
    57Last post 18y ago
  • [Release]NEW LVL BOT!By Carms in Combat Arms Hacks & Cheats
    22Last post 17y ago
  • [Release]GP & Level BotBy iHazBalls in Combat Arms Europe Hacks
    18Last post 17y ago
  • Release JD09 Spam BotBy Jimmy in Combat Arms Discussions
    30Last post 17y ago
  • [First Release] Super Spam BotBy Erinador in Visual Basic Programming
    10Last post 16y ago

Tags for this Thread

#bot#pokemmo#pokemmo bot#pokemon