Register for your free account! | Forgot your password?

You last visited: Today at 15:22

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Guide] Bot Functions.

Discussion on [Guide] Bot Functions. within the Mabinogi Hacks, Bots, Cheats & Exploits forum part of the Mabinogi category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
[Guide] Bot Functions.

If you cant script don't bother.

Edit for clarity: There is no file, scripts are in the code blocks. Put together your own config.ini from actually reading the code. See

This is all the functions my bot uses. Two of the functions don't work, one because of a font change and one because I haven't finished rewriting it.

File contains the folder structure for the code and some images. You will need your own images for everything else. The functions use a config.ini file and there are variables you need to set in the code.

In config.ini there are two sections. One for mobs, one for items. If you only ever use the function to attack anything the first section can be ignored. To have the itemsearch function look for items you have to add a line for each item into the ini. The format is filename=X. Where X is a 1 to turn on or 0 to turn off.

The script uses _ImageSearchArea and its included in the code so you do not need to include imagesearch in your bot.

Your mileage may vary.

Update:
Previous versions saw 59 views.
New file uploaded.

New functions:
Code:
_startUp()
_advanceSkill()
_useSkill($num,$time,$unit)
_dialogue()
_brokenCheck()
_startUp is required to use my functions more or less. All functions had a slight rename for readability. Most new functions have some comments. Haven't had time to test _brokenCheck() but it was just a port from another script. I don't think I broke anything.

Scripts are in the code blocks below.

This could be used to auto use a skill and advance it when possible, presuming you have the skill window for that skill open. Useful for afk instrument leveling.

Code:
#include <core.au3>
$result = _checkProcess()
If $result = 0 Then
	Exit(0)
EndIf
_startUp(1,0)
_setTimers(1)
While 1
	$result = _logCheck()
	Select
		Case $result = 0
			;logged in.
			$result = _advanceSkill()
			If $result Then
			Else
				_useSkill(10,45,1,0)
			EndIf
		Case $result = 1
			;disconnected.
			_exit()
	EndSelect
WEnd
Simple bot example.
Code:
#include <core.au3>
$result = _checkProcess()
If $result = 0 Then
	Exit(0)
EndIf
_startUp(1,1)
While 1
	$result = _logCheck()
	Select
		Case $result = 0
			;logged in.
			_setsearchcoords("fullscreen")
			_itemsearch()
			_attackanything()
			Sleep(1000)
		Case $result = 1
			;disconnected.
			_exit()
	EndSelect
WEnd

Core.au3, copy and paste the below code into

Code:
#include-once
#include <Constants.au3>
#include <GuiConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Global $x1,$y1,$result,$topleftcorner[2],$bottomrightcorner[2],$searchbox[4]
Global $broken,$brokenhex = 0xb20502,$variation=10
Global $box,$temparray,$count,$runonce
Global $ITEMSEARCH = 1,$MOBSEARCH = 0,$FINDGOLD = 1,$FINDITEMS = 0
;=======================================================================================
Func _advanceSkill()
	Local $delay = 2000
	_setSearchCoords("fullscreen")
	$result = _ImageSearchArea("images\buttons\advance.bmp",1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,75,"transcyan")
	If $result Then
		MouseMove($x1,$y1,1)
		MouseClick("primary")
		Sleep($delay)
		$result = _ImageSearchArea("images\buttons\advance2.bmp",1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,75,"transcyan")
		If $result Then
			MouseMove($x1,$y1,1)
			MouseClick("primary")
			Sleep($delay)
		EndIf
		$result = _ImageSearchArea("images\buttons\ok.bmp",1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,75,"transcyan")
		If $result Then
			MouseMove($x1,$y1,1)
			MouseClick("primary")
			Sleep($delay)
		EndIf
		Return(1)
	EndIf
	Return(0)
EndFunc
;=======================================================================================
Func _attackAnything()
	local $mouseorigin = MouseGetPos()
	Send("{CTRLDOWN}")
	Sleep(100)
	MouseClick("left",$mouseorigin[0],$mouseorigin[1],4,50)
	Sleep(100)
	Send("{CTRLUP}")
EndFunc
;=======================================================================================
Func _brokenCheck()
	;Quick rewrite, inventory open to view weapons in lower right, make sure "gold" below game ui.
	;script will exit if main and aux are broke.  Only show right hand.
	Local $coords
	If Not $broken Then $broken = 0
	_setSearchCoords("four")
	$coords = PixelSearch($searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$brokenhex,$variation)
	If Not @error Then
	; found broken
		Send("{ALTUP}")
		Send("{TAB}")
		$broken +=1
		Sleep(100)
		Send("{ALTDOWN}")
	EndIf
	If $broken >= 2 Then
		_exit()
	EndIf
EndFunc
;=======================================================================================
Func _checkProcess()
	If ProcessExists("Client.exe") Then
		Return 1
	Else		
		Return 0
	EndIf
EndFunc
;=======================================================================================
Func _cleanUp()
	ControlSend("", "", "", "text", 0)
    _WinAPI_UnhookWindowsHookEx($hHook)
    DllCallbackFree($hFunc)
EndFunc
;=======================================================================================
Func _ctrlTarget($x1,$y1)
	local $mouseorigin = MouseGetPos()
	Sleep(20)
	MouseMove($x1,$y1,1)
	Send("{CTRLDOWN}")
	Sleep(20)
	MouseMove($mouseorigin[0],$mouseorigin[1],1)
	Sleep(20)
	MouseClick("left",$mouseorigin[0],$mouseorigin[1],2)
	Sleep(20)
	Send("{CTRLUP}")
	Sleep(200)
EndFunc
;=======================================================================================
Func _deathCheck()
	;needs fixed.
	_setSearchCoords("fullscreen")
	$result = _ImageSearchArea("images\buttons\dead.bmp",1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,80)
	If $result = 1 Then
		$result = _ImageSearchArea("images\buttons\revivehere.bmp",1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,80)
		If $result = 1 Then
			MouseMove($x1,$y1,1)
			MouseClick("left",$x1,$y1,2)
		EndIf
		Return 1
	EndIf
	Return 0
EndFunc
;=======================================================================================
Func _dialogue()
	;Click through Trefors dialogue if you bot near him.
	Local $coords,$variation=0,$colorhex=0x896B75
	_setSearchCoords("three")
	Do 
		$coords = PixelSearch($searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$colorhex,$variation)
		If Not @error Then
			;found
			MouseMove($coords[0]+50,$coords[1],1)
			MouseClick("left")
			Sleep(500)
		EndIf
	Until @error
EndFunc
;=======================================================================================
Func _exit()
	Send("{ALTUP}")
	Send("{CTRLUP}")
	Exit(0)
EndFunc
;=======================================================================================
Func _findGold()
	$result = 0
	Do
		If $result = 1 Then
			_pickUpItem($x1,$y1)
		EndIf
		$result = _ImageSearchArea("images\items\gold.gif",1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,75,"transblack")
	Until $result = 0
EndFunc
;=======================================================================================
Func _findItems()
	Local $imagefile
	$result = 0
	For $quantity = 1 To $ITEMLISTING[0][0] Step 1
		If $ITEMLISTING[$quantity][1] = 1 Then
			$imagefile = "images\items\" & $ITEMLISTING[$quantity][0] & ".bmp"
			Do
				If $result = 1 Then
					_pickUpItem($x1,$y1)
				EndIf
				$result = _ImageSearchArea($imagefile,1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,100,"transblack")
			Until $result = 0
		EndIf
	Next
EndFunc
;=======================================================================================
Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance, $transparency)
	Local $array
	;MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
	If $tolerance>0 Then $findImage = "*" & $tolerance & " " & $findImage
	If $transparency Then $findImage = "*" & $transparency & " " & $findImage
	$result = DllCall("ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage)
	; If error exit
	If $result[0]="0" Then Return 0
	; Otherwise get the x,y location of the match and the size of the image to
	; compute the centre of search
	$array = StringSplit($result[0],"|")
	$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
EndFunc
;=======================================================================================
Func _itemSearch()
	Select
		Case $ITEMSEARCH = 0
		;Do nothing.
		Case $ITEMSEARCH = 1
			If $FINDGOLD = 1 Then
				_findGold()
			Endif
			If $FINDITEMS = 1 Then
				_findItems()
			Endif
	Endselect
EndFunc
;=======================================================================================
Func _KeyboardHook($iCode, $iwParam, $ilParam)
    Local $tKBDLLHS = DllStructCreate($tagKBDLLHOOKSTRUCT, $ilParam)
    Local $iVkCode

    If $iCode > -1 Then
        $iVkCode = DllStructGetData($tKBDLLHS, 'vkCode')
        If $iwParam = $WM_KEYUP Then
            Switch $iVkCode
                Case $VK_ESCAPE
					;Exits.
					_exit()
                Case $VK_DELETE
					;Short pause.
					Sleep(10000)
            EndSwitch
        EndIf
    EndIf    
    Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam)
EndFunc
;=======================================================================================
Func _lifeCheck()
	Local $colorhex,$variation,$percent,$lifebar[3],$damaged,$coords
	$colorhex = 0xCD398D
	$damaged = 0x630b25
	$lifebar[0] = 206 ; 206 at 113 life, 198 sub 66. 162-262 total bar.
	$lifebar[1] = 736 
	$lifebar[2] = 258
	$variation = 0
	$coords = PixelSearch($lifebar[0],$lifebar[1],$lifebar[2],$lifebar[1],0x000000,$variation)
	If Not @error Then
		$maxbar = $coords[0]
	Else
		$maxbar = $lifebar[2]
	EndIf
	$coords = PixelSearch($lifebar[0],$lifebar[1],$lifebar[2],$lifebar[1],$damaged,$variation)
	If Not @error Then
		$percent = 95 - ($maxbar - $coords[0])
		Return $percent
	ElseIf @error Then
		$percent = (100 - ($lifebar[2] - $maxbar))- 4
		Return $percent
	EndIf
EndFunc
;=======================================================================================
Func _logCheck()
	_setSearchCoords("login")
	$result = _ImageSearchArea("images\buttons\windowicon.bmp",1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,75,"transblack")
	If $result Then
		Return 1
	EndIf
	Return 0
EndFunc
;=======================================================================================
Func _login()
	;needs finished(again).
	Local $account, $password,$coords[6]
	$account	= ""
	$password	= ""
	$coords[0]	= 650	;account
	$coords[1]	= 470	;account
	$coords[2]	= 650	;password
	$coords[3]	= 505	;password
	$coords[4]	= 637	;login
	$coords[5]	= 573	;login
	;If $result Then
		MouseMove($coords[0],$coords[1],1)
		MouseClick("left",$coords[0],$coords[1],1)
		Sleep(100)
		Send($account)
		Sleep(500)
	;EndIf
	;If $result Then
		MouseMove($coords[2],$coords[3],1)
		MouseClick("left",$coords[2],$coords[3],1)
		Sleep(100)
		Send($password)
		Sleep(500)
	;EndIf
		MouseMove($coords[4],$coords[5],1)
		MouseClick("left",$coords[4],$coords[5],1)
EndFunc
;=======================================================================================
Func _mobSearch()
	Local $imagefile
	If $MOBSEARCH = 0 Then
		; Not searching for mobs.
	ElseIf $MOBSEARCH = 1 Then
		; Searching for mobs.
		$result = 0
		For $quantity = 1 To $MOBLISTING[0][0] Step 1
			If $MOBLISTING[$quantity][1] = 1 Then
				$imagefile = "images\mob\" & $MOBLISTING[$quantity][0] & ".bmp"
				Do
					If $result = 1 Then
						_ctrlTarget($x1,$y1)
						Return 1
					EndIf
					$result = _ImageSearchArea($imagefile,1,$searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$x1,$y1,110)
				Until $result = 0
			EndIf
		Next
		Return 0
	Endif
EndFunc
;=======================================================================================
Func _mover()
	;dont use, imo.
	Local $center[2]
	$randomnumber = Random(50,150,1)
	$center[0] = ($topleftcorner[0] + (($bottomrightcorner[0] - $topleftcorner[0])/2)) + $randomnumber
	$center[1] = ($topleftcorner[1] + (($bottomrightcorner[1] - $topleftcorner[1])/2)) + $randomnumber
	MouseMove($center[0],$center[1],1)
	MouseClick("left",$center[0],$center[1],1)
	Sleep(500)
	MouseMove($center[0],$center[1],1)
	MouseClick("left",$center[0],$center[1],1)
EndFunc
;=======================================================================================
Func _pickUpItem($x1,$y1)
	local $mouseorigin = MouseGetPos()
	MouseMove($x1,$y1,0)
	Sleep(100)
	MouseClick("primary",$x1,$y1,2,0)
	Sleep(400)
	MouseMove($mouseorigin[0],$mouseorigin[1],0)
	Sleep(1000)
EndFunc
;=======================================================================================
Func _setSearchCoords($box)
	; Define the coords for the search areas.
	If $box = "one" Then
		$searchbox[0] = $topleftcorner[0]
		$searchbox[1] = $topleftcorner[1]
		$searchbox[2] = $topleftcorner[0] + (($bottomrightcorner[0] - $topleftcorner[0])/2)
		$searchbox[3] = $topleftcorner[1] + (($bottomrightcorner[1] - $topleftcorner[1])/2)
	ElseIf $box = "two" Then
		$searchbox[0] = $topleftcorner[0] + (($bottomrightcorner[0] - $topleftcorner[0])/2)
		$searchbox[1] = $topleftcorner[1]
		$searchbox[2] = $bottomrightcorner[0]
		$searchbox[3] = $topleftcorner[1] + (($bottomrightcorner[1] - $topleftcorner[1])/2)
	ElseIf $box = "three" Then
		$searchbox[0] = $topleftcorner[0]
		$searchbox[1] = $topleftcorner[1] + (($bottomrightcorner[1] - $topleftcorner[1])/2)
		$searchbox[2] = $topleftcorner[0] + (($bottomrightcorner[0] - $topleftcorner[0])/2)
		$searchbox[3] = $bottomrightcorner[1]
	ElseIf $box = "four" Then
		$searchbox[0] = $topleftcorner[0] + (($bottomrightcorner[0] - $topleftcorner[0])/2)
		$searchbox[1] = $topleftcorner[1] + (($bottomrightcorner[1] - $topleftcorner[1])/2)
		$searchbox[2] = $bottomrightcorner[0]
		$searchbox[3] = $bottomrightcorner[1]
	ElseIf $box = "center" Then
		$searchbox[0] = $topleftcorner[0] + (($bottomrightcorner[0] - $topleftcorner[0])*.25)
		$searchbox[1] = $topleftcorner[1] + (($bottomrightcorner[1] - $topleftcorner[1])*.25)
		$searchbox[2] = $bottomrightcorner[0] - (($bottomrightcorner[0] - $topleftcorner[0])*.25)
		$searchbox[3] = $bottomrightcorner[1] - (($bottomrightcorner[1] - $topleftcorner[1])*.25)
	ElseIf $box = "fullscreen" Then
		$searchbox[0] = $topleftcorner[0]
		$searchbox[1] = $topleftcorner[1]
		$searchbox[2] = $bottomrightcorner[0]
		$searchbox[3] = $bottomrightcorner[1]
	ElseIf $box = "login" Then
		$searchbox[0] = 540
		$searchbox[1] = 425
		$searchbox[2] = 739
		$searchbox[3] = 604
	ElseIf $box = "connectmsg" Then
		$searchbox[0] = 522
		$searchbox[1] = 332
		$searchbox[2] = 756
		$searchbox[3] = 435
	EndIF
EndFunc
;=======================================================================================
Func _setTimers($quant)
	;Worthless function but it's how I roll.
	Global $timers[$quant]
EndFunc
;=======================================================================================
Func _splashImage()
	;for the lulz.
	Local $delay = 2000
	If Not WinActive("Mabinogi") Then WinActivate("Mabinogi")
	GuiCreate("MyCA",500,500,-1,-1,$WS_POPUP,BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
	GuiCtrlCreatePic("images\splash\splash.gif",0,0,500,500)
	GuiSetState()
	Sleep($delay)
	GuiDelete()
EndFunc
;=======================================================================================
Func _startUp($keys,$ini)
	;$keys to 1 to turn hotkeys on or 0 to turn off. More hotkeys to come.
	;$ini to 1 to turn config.ini loading/pruning on.  0 = off.
	;_startUp required to use core functions.

	If $runonce = 1 Then Return(0)
	;=======================================================================================
	;Opt("MouseCoordMode",0)										;Mouse coords by active window.
	Opt("PixelCoordMode",0)											;Pixel coords by active window.
	Opt("MustDeclareVars",1)										;Must declare variables.
	Opt("TrayOnEventMode",1)										;Tray events on.
	Opt("TrayMenuMode",1)											;No tray menu.
	Opt("OnExitFunc","_cleanUp")									;Function to call on exit.
	TraySetIcon("C:\Nexon\Mabinogi\Mabinogi.exe", -2)				;Set tray icon.
	TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE,"_exit")				;Tray function on double click.
	TraySetState()													;Turns the tray on.
	;=======================================================================================
	If $keys Then
		Global Const $VK_DELETE = 0x2E
		Global Const $VK_ESCAPE = 0x1B
		Global $hFunc,$pFunc,$hHook,$hMod,$pause

		$hFunc = DllCallbackRegister('_KeyboardHook', 'lresult', 'int;uint;uint')
		$pFunc = DllCallbackGetPtr($hFunc)

		$hMod = _WinAPI_GetModuleHandle(0)
		$hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, $pFunc, $hMod)
	EndIf
	;=======================================================================================
	If $ini Then
		$temparray = IniReadSection("config.ini","Mob List")
		If @error Then
			Exit
		EndIf
		For $quantity = 1 To $temparray[0][0] Step 1
			If $temparray[$quantity][1] = 1 Then
				$count +=1
			Endif
		Next
		Global $MOBLISTING[$count+1][2],$arrayitems
		$arrayitems = $count
		$count = 1
		$MOBLISTING[0][0] = $arrayitems
		For $quantity = 1 To $temparray[0][0] Step 1
			If $temparray[$quantity][1] = 1 Then
				$MOBLISTING[$count][0] = $temparray[$quantity][0]
				$MOBLISTING[$count][1] = $temparray[$quantity][1]
				$count +=1
			EndIf
		Next
		$temparray = ""
		$temparray = IniReadSection("config.ini","Item List")
		If @error Then
			Exit
		EndIf
		For $quantity = 1 To $temparray[0][0] Step 1
			If $temparray[$quantity][1] = 1 Then
				$count +=1
			Endif
		Next
		Global $ITEMLISTING[$count+1][2]
		$arrayitems = $count
		$count = 1
		$ITEMLISTING[0][0] = $arrayitems
		For $quantity = 1 To $temparray[0][0] Step 1
			If $temparray[$quantity][1] = 1 Then
				$ITEMLISTING[$count][0] = $temparray[$quantity][0]
				$ITEMLISTING[$count][1] = $temparray[$quantity][1]
				$count +=1
			Endif
		Next
		$temparray = ""
	EndIf
	;=======================================================================================
	If Not WinActive("Mabinogi") Then WinActivate("Mabinogi")
	$box	=	WinGetPos("[active]")
	$topleftcorner[0] = 0
	$topleftcorner[1] = 0
	$bottomrightcorner[0] = $box[2]
	$bottomrightcorner[1] = $box[3]
	$runonce = 1
	Return(1)
EndFunc
;=======================================================================================
Func _useSkill($num,$time,$unit,$spot)
	;$num = number of hotkey,$time = delay between uses, $unit is a 0 to measure in minutes and 1 to measure in seconds, $spot = timer spot
	Local $difference
	If $unit = 1 Then
		;seconds
		$time = $time * 1000
	ElseIf $unit = 0 Then
		;minutes
		$time = $time * 60000
	EndIf
	$difference = TimerDiff($timers[$spot])
	If $difference > $time Then
		Send("{F"&$num&"}")
		$timers[$spot] = TimerInit()
	EndIf
EndFunc
Didn't take time to test the bot sample, it probably works as is.
Theri is offline  
Thanks
14 Users
Old 01/27/2010, 02:15   #2
 
elite*gold: 0
Join Date: Oct 2009
Posts: 498
Received Thanks: 110
Ooh, i'll learn alot of new stuff from THIS. Thanks :3
Halfslashed is offline  
Old 01/27/2010, 07:17   #3
 
ShadowMagic's Avatar
 
elite*gold: 0
Join Date: Jan 2010
Posts: 37
Received Thanks: 0
Thank you for this. I'm sure it'll come in handy
ShadowMagic is offline  
Old 01/27/2010, 17:35   #4
 
shzukahime's Avatar
 
elite*gold: 0
Join Date: Sep 2009
Posts: 249
Received Thanks: 23
Thank ye. Something useful for once. Not like most QQ'ers.
shzukahime is offline  
Old 01/28/2010, 02:40   #5
 
elite*gold: 0
Join Date: Jun 2008
Posts: 8
Received Thanks: 0
Nice, maybe also include something i did; near trefor if you bot sometimes you click on him, make a func that checks each cycle for the images of a dialog box. Its pretty eash only need 5 pictures per cycle through. But you need for it to click twice in a row due to if you click before it's done it snaps through all of it.

If possible help me by giving me tips on how to optimize it so that it checks it quicker.

Example;
Code:
#include <Constants.au3>
#include <ImageSearch.au3>
Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE,"_exit")
TraySetState()

Global $result,$x1 = 0,$y1 = 0,$pos

MsgBox(0,"Notice","Click OK to start")
WinActivate("Mabinogi : Dragon")
sleep(1000)
While 1
	$pos= MouseGetPos()
	Send ("{ALTDOWN}{CTRLDOWN}")
	Sleep (1000)
	MouseClick ("left",$pos[0],$pos[1],4,50)
	Sleep (100)
	Send ("{CTRLUP}")
	Sleep (1000)
	$result = _ImageSearch("Step1.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		MouseClick("left",$x1,$y1,2)
		sleep(50)
	EndIf
	$result = _ImageSearch("Step2.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		MouseClick("left",$x1,$y1,2)
		sleep(50)
	EndIf
	$result = _ImageSearch("Step3.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		MouseClick("left",$x1,$y1,2)
		sleep(50)
	EndIf
	$result = _ImageSearch("Step4.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		MouseClick("left",$x1,$y1,2)
		sleep(50)
	EndIf
	$result = _ImageSearch("Step5.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		MouseClick("left",$x1,$y1,2)
		sleep(50)
	EndIf
	$result = _ImageSearch("Fomor.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		sleep(1000)
	EndIf
	$result = _ImageSearch("Gold.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		sleep(1000)
	EndIf
	Send ("{ALTUP}")
WEnd

Func _exit()
	Exit(0)
EndFunc
xsafx is offline  
Old 01/28/2010, 03:16   #6
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
Try?

Code:
For $i = 1 To 5 Step 1
	$imagefile = "Step" & $i & ".png"
	$result = _ImageSearch($imagefile,1,$x1,$y1,100)
	If $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		Sleep(50)
	EndIf
Next
The 2 in MouseClick already makes it click twice so I don't know why you would need another line to click. If you add a number, 1-100, after the 2 it will change how fast it clicks. 1 is fastest, 100 is slowest, 10 is default.

Code:
#include <Constants.au3>
#include <ImageSearch.au3>
Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1)
TraySetOnEvent($TRAY_EVENT_PRIMARYDOUBLE,"_exit")
TraySetState()

Global $result,$x1 = 0,$y1 = 0,$pos

MsgBox(0,"Notice","Click OK to start")
WinActivate("Mabinogi : Dragon")
sleep(1000)
While 1
	$pos= MouseGetPos()
	Send ("{ALTDOWN}{CTRLDOWN}")
	Sleep (1000)
	MouseClick ("left",$pos[0],$pos[1],4,50)
	Sleep (100)
	Send ("{CTRLUP}")
	Sleep (1000)
	For $i = 1 To 5 Step 1
		$imagefile = "Step" & $i & ".png"
		$result = _ImageSearch($imagefile,1,$x1,$y1,100)
		If $result Then
			MouseMove($x1,$y1)
			MouseClick("left",$x1,$y1,2)
			Sleep(50)
		EndIf
	Next
	$result = _ImageSearch("Fomor.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		sleep(1000)
	EndIf
	$result = _ImageSearch("Gold.png",1,$x1,$y1,100)
	if $result Then
		MouseMove($x1,$y1)
		MouseClick("left",$x1,$y1,2)
		sleep(1000)
	EndIf
	Send ("{ALTUP}")
WEnd

Func _exit()
	Exit(0)
EndFunc
Theri is offline  
Old 01/31/2010, 08:07   #7
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
Might post an update later this week or next depending on time and if I get some rewrites/changes in. Been working on my copy of the fossil macro.
Theri is offline  
Old 02/02/2010, 03:29   #8
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
Updated first post.
Theri is offline  
Old 02/02/2010, 23:24   #9
 
elite*gold: 0
Join Date: Feb 2010
Posts: 2
Received Thanks: 0
is there a way i could get this to cook food and get 5 stars and keep getting ingrediants.

Dont know too much bout how to set up hacks
Mabidude is offline  
Old 02/03/2010, 00:05   #10
 
elite*gold: 0
Join Date: Oct 2009
Posts: 373
Received Thanks: 115
You need to be able to script to get this to do anything. It's not a bot or the likes (with the exception of the example). Just functions used for scripting. Very useful if you know what you're doing. If you can't script, don't even bother posting in this thread anymore. Make sure you actually SEARCH for things first, don't expect people to give you a handout to a link, or make it because one person with two posts of basically the same thing wants it. Not to mention even with only 29 Dex it is NOT hard to make 5 star foods.
Blade3575 is offline  
Thanks
2 Users
Old 02/03/2010, 00:22   #11
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
Whoa. Someone read the first post.

In response to the question, tho, no this wont do that. Some of whats there could be used as a base but you would need to modify your map with way points that you could use to get to where different ingredients are, amongst other things. If you want help getting 5 star dishes, I've never cooked, but I know on mabiguru there's a post in their guides to an app with some images that gives you a percentage over a bar in the cooking window. I hear that helps a ton.
Theri is offline  
Thanks
1 User
Old 02/03/2010, 00:40   #12
 
elite*gold: 0
Join Date: Oct 2009
Posts: 373
Received Thanks: 115
Yeah, don't see many people do that, huh?

It's called Brownie. It also has cooking recipes with it.
Blade3575 is offline  
Old 02/03/2010, 01:20   #13
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
One of the functions is has a small error. I didn't read over _dialogue() and it was pulled from another script of mine I was testing it in.

anyway replace the _dialogue() function with this:
Code:
Func _dialogue()
	;Click through Trefors dialogue if you bot near him.
	Local $coords,$variation=0,$colorhex=0x896B75
	_setsearchcoords("three")
	Do 
		$coords = PixelSearch($searchbox[0],$searchbox[1],$searchbox[2],$searchbox[3],$colorhex,$variation)
		If Not @error Then
			;found
			MouseMove($coords[0]+50,$coords[1],1)
			MouseClick("left")
			Sleep(500)
		EndIf
	Until @error
EndFunc
Theri is offline  
Old 02/04/2010, 20:06   #14
 
elite*gold: 0
Join Date: Jun 2008
Posts: 8
Received Thanks: 0
;D you go that dialog func. from me man
xsafx is offline  
Old 02/09/2010, 17:30   #15
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
New file uploaded to fix some stuff I broke in the last update. Also includes the hot key code that I posted in another thread.

Did some botting this week and realized that I screwed up a couple things in the last release (thanks for telling me). Most functions should be working now.
Theri is offline  
Reply


Similar Threads Similar Threads
New UDF - Old Functions :D
07/11/2009 - GW Exploits, Hacks, Bots, Tools & Macros - 14 Replies
xxx
[Guide] Some noob Npc functions (prof, level, stats etc)
07/01/2009 - CO2 PServer Guides & Releases - 4 Replies
Ok so it's nothing fancy at all but I figured I'd give some nubs a few pointers on how to script npcs (in coemu2.0 nano) that have special functions. There are countless examples of teleporters, item givers and other such simple npc's on here so that shouldn't be any big deal but I figured I'd point out some very simple functions for accessing the database for characters. Prof Lets say you have an npc that is already giving out weapons, why not have it also give you the required prof...
GUI Functions
04/29/2009 - GW Exploits, Hacks, Bots, Tools & Macros - 2 Replies
In an effort to make the bots here less annoying to use, I've created this small proof-of-concept library. It uses the memory to read locations of GUI windows in guild wars, so no more having to specify coordinates. I've only added support for hard mode on/off and travel to/from guild hall, but you guys probably get the idea. Feel free to expand on this concept and add more functions. It would be nice if we could have a complete library for everything useful you can do with the GUI. A...



All times are GMT +2. The time now is 15:22.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.