[Release] Cloud Bot

06/20/2010 20:37 Cloudsdabomb#1
Guys.I looked over the most simplest problem =P. run my bot as a script not an exe. Halfslashed help me haha i feel like a real idiot right now sorry guys.
Here's the script if you need it. and pictures is up to you .[Only registered and activated users can see links. Click Here To Register...]
06/20/2010 21:44 Halfslashed#2
Here's the bot with a few tweaks and comments on the bot.

Code:
#include <ImageSearch.au3>
Global $Paused
HotKeySet("{PAUSE}", "TogglePause") ; Pause the script with "Pause"
HotKeySet("{ESC}", "Stop") ; End the script with ESC
$x1=0
$y1=0
$x2=0
$y2=0
MsgBox(0,"Notice","Click OK to start")
sleep(3000)
While 1
Send ("{F3}") ; Smash Hotkey
Send ("{ALTDOWN}")
Sleep(4000)
Send ("{CTRLDOWN}")
Sleep (500)
MouseClick ("left")
Sleep (500)
MouseClick ("left")
Sleep (500)
MouseClick ("left")
Sleep (500)
MouseClick ("left")
Sleep (500)
MouseClick ("left")
Sleep (500)
Send ("{CTRLUP}")
Sleep (4000)
$result = _ImageSearch("Fomor.png",1,$x1,$y1,100)
if $result=1 Then ; If there is a fomor scroll, pick it up
MouseMove($x1,$y1,0)
sleep (250)
MouseClick("left",$x1,$y1,1,3)
sleep(1000)
EndIf
$result2 = _ImageSearch("Gold.png",1,$x2,$y2,100)
if $result2=1 Then ; If there is gold on the ground, pick it up
MouseMove($x2,$y2,0)
sleep (250)
MouseClick("left",$x3,$y3,1,3)
sleep(1000)
EndIf
Send ("{ALTUP}")
WEnd

Func TogglePause() ; Pause function
$Paused = not $Paused
While $Paused
    ToolTip("paused")
sleep(100)
WEnd
EndFunc

Func Stop() ; End function
Exit 0
EndFunc
06/23/2010 04:51 Theri#3
Code:
#include <ImageSearch.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
Global Const $VK_DELETE = 0x2E
Global Const $VK_ESCAPE = 0x1B
Global $hFunc,$pFunc,$hHook,$hMod
Global $x=0,$y=0,$result,$window="Mabinogi"
Opt("OnExitFunc","_cleanUp")

$hFunc = DllCallbackRegister('_KeyboardHook', 'lresult', 'int;uint;uint')
$pFunc = DllCallbackGetPtr($hFunc)
$hMod = _WinAPI_GetModuleHandle(0)
$hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, $pFunc, $hMod)

MsgBox(0,"Notice","Click OK to start")
If Not WinActive($window) Then WinActivate($window)
Sleep(3000)
While 1
	If WinActive($window) Then
		Send ("{F3}") ; Smash Hotkey
		Send ("{ALTDOWN}")
		Send ("{CTRLDOWN}")
		Sleep (500)
		If $x = 0 Then
			Local $pos = MouseGetPos()
			$x = $pos[0]
			$y = $pos[1]
		EndIf
		MouseClick ("primary",$x,$y,4,100)
		Sleep (500)
		Send ("{CTRLUP}")
		Sleep (4000)
		$result = _ImageSearch("Fomor.png",1,$x,$y,100)
		If $result = 1 Then ; If there is a fomor scroll, pick it up
			MouseMove($x,$y,0)
			Sleep (250)
			MouseClick("primary",$x,$y,1)
			Sleep(1000)
		EndIf
		$result = _ImageSearch("Gold.png",1,$x,$y,100)
		If $result = 1 Then ; If there is gold on the ground, pick it up
			MouseMove($x,$y,0)
			Sleep (250)
			MouseClick("primary",$x,$y,1)
			Sleep(1000)
		EndIf
		Send ("{ALTUP}")
	Else
		Sleep(1000)
	EndIf
WEnd

;Functions
Func _cleanUp()
	ControlSend("", "", "", "text", 0)
	Send("{ALTUP}")
	Send("{CTRLUP}")
    _WinAPI_UnhookWindowsHookEx($hHook)
    DllCallbackFree($hFunc)
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(0)
                Case $VK_DELETE
					;Short pause.
					Sleep(10000)
            EndSwitch
        EndIf
    EndIf    
    Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam)
EndFunc
06/23/2010 05:28 Halfslashed#4
Lol, pro'd by Theri. He's a lot better with autoit than me, because that is his primary area of expertise.
06/23/2010 05:45 Theri#5
;) I also use autoit for other projects so I probably have a ton more practice with it.

That code is not tested and that should have a working exit and pause hot key, they worked for me when I played as hotkeyset does not work with mabinogi.
06/23/2010 10:57 BitOfHope#6
The bot runs fine for a bit, but then he starts to attack a tree or signpost or something. I was wondering if there was any way to make my character stop hitting them and go back to monsters without me having to intervene?

Also, even if a monster is closer to the mouse when it clicks to attack it stays attacking the non monster. (Sorry if that doesn't make sense. =\)
06/24/2010 07:40 Cloudsdabomb#7
im guessing you're running mods?
06/24/2010 07:55 BitOfHope#8
Yeah I am, so if i remove them, he won't get stuck?

Sorry, I'm a noob with all this stuff TT~TT

Haha, gratz on the 123 post count btw. Lol

EDIT: Ok, removing the mods fixed that issue, but now I'm wondering if there is a way to stop my character from getting stuck on trees/rocks/etc.
06/26/2010 03:23 Cloudsdabomb#9
it doesnt for me... mess around with the script a little to make it work for you.
06/28/2010 20:49 boooooooy#10
I'm trying use Theri's script but I keep getting an error on the ALTUP line, flame all you want for my general lack
of know how in AutoIt but then at least point me in the right direction.

I've already searched the AutoIt section of the forums and looked at several Tutorials and Guides for AutoIt and
none of them seem to cover my error.


Here's what it looks like;
06/28/2010 21:21 Theri#11
I'm not at home now and most my scripts are on my external drive. I see you fixed the missing bracket. For the other problem I probably forgot to include a line, I'll post up when I figure out what I forgot.

edit:

Add
Code:
#include <WinAPI.au3>
to the top. The origonal code in the post has been updated to fix both errors.
06/30/2010 20:51 Brenpat#12
I get an error on line 27, it says its an unknown function name?

I used Theri's script on the first page, any suggestions?
07/01/2010 01:45 Halfslashed#13
.. Read the post above you.
07/01/2010 06:15 Cloudsdabomb#14
Lmao
07/01/2010 20:40 superwrong266#15
quick question: i've made autoit scripts for past nexon events, and was wondering how u get the hotkeys to work in mabi. i used 2 example script from the help files.

HotKeySet("{TAB}", "TogglePause")
HotKeySet("{-}", "Terminate")

they'll only work if i alt+tab outside of mabi ... feels like mabi blocks me from using hotkeys while in game??

edit: any good idea on how to get bot to buy more fireworks after they fired them all.

currently i have to manually buy 6 stacks everytime, so i afk only 3 hours...ish...before they run outta fireworks