[Guide] PickUp Bot

08/24/2009 20:06 argentino#16
I updated the script a little more, so the bot have the ability to move around the camera when it cant find any cobwebs, correct the values to ur own resolution (made on 1440*900).

Code:
#include <ImageSearch.au3>
MsgBox(0,"Notice","Click Ok to start. Make sure you have Mabinogi window maximized.")
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("!{ESC}", "Stop") ;script can be stopped by pressing ESC
$x1=0
$y1=0
While (1)
Send("{LALT down}")
$result = _ImageSearch("cobweb.jpg",1,$x1,$y1,100) ;change the cobweb.jpg if you want to pick up something else.
if $result=1 Then
	Tooltip("Nomnomnom cobwebs ^^...", 0, 0) ;Indicates the item is present on the screen
	MouseMove($x1,$y1,3)
	MouseClick("left",$x1,$y1,1,3)
	Sleep(3000) ;Enough time for the character to go pick up the cobweb. You can change it if you want (2000 = 2 seconds so 1000 = 1 second)
EndIf
If $result=0 Then	
		Sleep (2000)
		MouseMove (722, 445) ;The middle of your screen, x/y mouse position
		Sleep (1000)
		Tooltip("Searching for cobwebs...", 0, 0) ;Starting to rotate camera
		MouseDown("right")
		Sleep (1000)
		MouseMove (750, 455) ; The middle of your screen plus some right or left amount movement to allow camera rotation
		Sleep (1000)
		MouseUp("right")
		EndIf
WEnd
Func TogglePause()
$Paused = not $Paused
While $Paused
    ToolTip("paused")
sleep(100)
WEnd
EndFunc

Func Stop() ;to allow the script to stop
Exit ;same
EndFunc ;same
08/24/2009 20:59 Dark Raccoon#17
Quote:
Originally Posted by argentino View Post
I updated the script a little more, so the bot have the ability to move around the camera when it cant find any cobwebs, correct the values to ur own resolution (made on 1440*900).

Code:
#include <ImageSearch.au3>
MsgBox(0,"Notice","Click Ok to start. Make sure you have Mabinogi window maximized.")
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("!{ESC}", "Stop") ;script can be stopped by pressing ESC
$x1=0
$y1=0
While (1)
Send("{LALT down}")
$result = _ImageSearch("cobweb.jpg",1,$x1,$y1,100) ;change the cobweb.jpg if you want to pick up something else.
if $result=1 Then
	Tooltip("Nomnomnom cobwebs ^^...", 0, 0) ;Indicates the item is present on the screen
	MouseMove($x1,$y1,3)
	MouseClick("left",$x1,$y1,1,3)
	Sleep(3000) ;Enough time for the character to go pick up the cobweb. You can change it if you want (2000 = 2 seconds so 1000 = 1 second)
EndIf
If $result=0 Then	
		Sleep (2000)
		MouseMove (722, 445) ;The middle of your screen, x/y mouse position
		Sleep (1000)
		Tooltip("Searching for cobwebs...", 0, 0) ;Starting to rotate camera
		MouseDown("right")
		Sleep (1000)
		MouseMove (750, 455) ; The middle of your screen plus some right or left amount movement to allow camera rotation
		Sleep (1000)
		MouseUp("right")
		EndIf
WEnd
Func TogglePause()
$Paused = not $Paused
While $Paused
    ToolTip("paused")
sleep(100)
WEnd
EndFunc

Func Stop() ;to allow the script to stop
Exit ;same
EndFunc ;same
Mind if I modifiy it a bit so you can choose your resolution? ;P
08/24/2009 23:36 argentino#18
Not at all thats why i post the whole source =D lol, as you know im lazy to do these kind of stuff and too much work atm to have more than 10-15 mins dedicated to these things.
08/25/2009 18:49 n3m0k54#19
Quote:
Originally Posted by wossen View Post
$result = _ImageSearch("cobweb.jpg",1,$x1,$y1,100) can someone help me to understand this what does the 100 do or say?
Open ImageSearch.au3 file and find function _ImageSearch, there will be description.
08/26/2009 19:45 Trismic#20
Quote:
Originally Posted by wossen View Post
$result = _ImageSearch("cobweb.jpg",1,$x1,$y1,100) can someone help me to understand this what does the 100 do or say?
The 100 is the tolerance. The image the bot is searching must be 100% identical to the image you are looking for.
08/26/2009 20:46 cloudkiller2006#21
then won't you have more chance picking up the stuff you want if you set it to like 85?
08/26/2009 21:05 Dark Raccoon#22
Quote:
Originally Posted by cloudkiller2006 View Post
then won't you have more chance picking up the stuff you want if you set it to like 85?
Well, you gotta find the right Tolerance.

If you set it too high, maybe the Bot wont find it on everyones screen, if you set it too low, it could just click anything that looks familiar.
08/26/2009 23:47 cloudkiller2006#23
hehe that leaves me with one question, what if you set it to 110? XD
08/26/2009 23:50 ^FLaRe#24
Thanx
08/27/2009 01:30 Dark Raccoon#25
Quote:
Originally Posted by cloudkiller2006 View Post
hehe that leaves me with one question, what if you set it to 110? XD
Be an adventurer, find it out! :P
08/27/2009 21:12 Cloudsdabomb#26
haha cloud don't you just love Racoon's answers?
08/27/2009 21:49 Dark Raccoon#27
Quote:
Originally Posted by Cloudsdabomb View Post
haha cloud don't you just love Racoon's answers?
:P
08/28/2009 23:32 spazzzedout#28
i cant get autoit to work on my laptop, it never has, and i tried making a script for AutoHotKey.

i tried to follow the instructions and looked on google for help and came up with this, but it doesnt work, it just opens mabi and does nothing

does anyone know what i did wrong?

Quote:
WinWait, Mabinogi G7,
ifWinNotActive, Mabinogi G7, , WinActivate, Mabinogi G7,
WinWaitActive, Mabinogi G7,
Loop
{
If GetKeyState ("ESC")
Break
Send, {ALTDOWN}
ImageSearch CobwebX, CobwebY,0,0, ScreenWidth, ScreenHeight, C:\Program Files (x86)\AutoIt3\Include\cobweb.bmp
Click %CobwebX%, %CobwebY%
sleep, 2500
}
08/29/2009 12:36 cloudkiller2006#29
autohotkey uses its own "scripting" (no idea what to call it different)

for example:
the Break stops the Loop, so it will just check for the esc key once.

(directly from the help file command list: ) Loop (normal) Perform a series of commands repeatedly: either the specified number of times or until break is encountered.

that's the only error i can find atm, hope this helps

to fix: remove the break command
08/31/2009 23:47 spazzzedout#30
hmm... that didnt work, but i made a few improvements with limited succes.

Quote:
WinWait, Mabinogi G7,
ifWinNotActive, Mabinogi G7, , WinActivate, Mabinogi G7,
WinWaitActive, Mabinogi G7,
Loop
{
If GetKeyState("INS")
Break
Send, {ALTDOWN}
ImageSearch FoundX, FoundY,0,0,ScreenWidth,ScreenHeight, C:\Users\David\Pictures\gold.bmp
If ErrorLevel = 0
MouseMove, %FoundX%, %FoundY%
Send, {Click}
Click %goldX%, %goldY%
sleep, 3000
}
Now it opens up mabi, it will press but NOT hold alt, and clicks but doesnt go to the gold.
and it just does that over and over untill the gold dissapears
anymore suggestions?