Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Mabinogi
You last visited: Today at 19:51

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

Advertisement



Autoit3 -> AHK?

Discussion on Autoit3 -> AHK? within the Mabinogi forum part of the MMORPGs category.

Closed Thread
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2009
Posts: 44
Received Thanks: 7
Autoit3 -> AHK?

I've noticed more people use Autoit3 for scripting, but I personally prefer AHK. But does Autoit3 scripting work the same way as AHK?

I've seen some useful scripts here, especially for weaving (which is what I need) but I really don't like the fact that I can't pause the script (even if I press the pausing hotkey, it just doesn't stop for some reason).

Let's say I'm using this Autoit3 script to weave my cobwebs:

Would this work for AHK as well, or do I need to make some changes for it to work for AHK? Any help is appreciated, thanks.
Jacqueline is offline  
Old 02/05/2010, 03:56   #2
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
The syntax is different for ahk, do a google search on converting au3 to ahk, pretty sure there's a really simple utility to do it for you.

imo au3 syntax is much nicer and better to work with than ahk but that's neither here nor there.

Why would you sleep for 999999 <.<
Theri is offline  
Old 02/05/2010, 04:11   #3
 
elite*gold: 0
Join Date: Nov 2009
Posts: 44
Received Thanks: 7
Actually, I'll give Autoit3 one more try. But my current issue is that I get an error when trying to start the script above:

AutoIt Error
"Line 16 (file blah blah blah blah\auto_weave.au3):

HotKeySet("{PAUSE},"TogglePause")

Error: Unknown function name.

^What's wrong with that? I don't see errors in the script. Besides, I have the other pickup cobweb script with the same hotkey line, yet it runs perfectly?
Jacqueline is offline  
Old 02/05/2010, 04:16   #4
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
Code:
HotKeySet("{PAUSE},"TogglePause")
Errors because you didn't create a function called TogglePause.
Theri is offline  
Old 02/05/2010, 04:28   #5
 
elite*gold: 0
Join Date: Nov 2009
Posts: 44
Received Thanks: 7
Thanks, I never noticed that, I only noticed to put a function called Stop.

Now I got it to run, but the script doesn't help me in anyway I don't know whether I need to make new coordinates to have it work on my resolution or not, but I've also noticed that it doesn't seem to click properly either. I fail at scripting.

Edit: I'm using PNG as the image files, could that be a problem to this?
Jacqueline is offline  
Old 02/05/2010, 04:35   #6
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
Not really sure how its behaving versus what you are expecting to be able to help you.
Theri is offline  
Old 02/05/2010, 04:43   #7
 
elite*gold: 0
Join Date: Nov 2009
Posts: 44
Received Thanks: 7
I don't know, but for some reason the scripts don't work properly when I use a transparented background image, whereas if I use a normal one (with background), it works better :s I changed the transparented backgrounds from PNG to GIF now, still doesn't work as well as the JPG.

And I still can't pause/stop the script even if I press ESC, I have to stop the script manually which is really annoying.
Jacqueline is offline  
Old 02/05/2010, 05:02   #8
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
You should stick to bmp or gif file formats, jpg are ok. Don't use anything else. Alpha transparency doesn't work as far as I can tell.. Read the imagesearch documentation for ahk, its the same for autoit. If for instance you want to match a word you could paint the non font areas to a solid color, like black, and set transparency to transblack in the imagesearch function call. (This is the only form of "transparency" I've noticed to work through my testing).

See my post in the sub forum or the imagesearch documentation.

The code you posted only has one hotkey and that is esc which is calling a function called stop. I'm not sure if that is the hotkey that isn't working, try setting it to use a-z instead. I set a hotkey to x and it works fine.

Edit:
HotKeySet("!{ESC}", "Stop") is incorrect.

Take out the !.
Theri is offline  
Old 02/05/2010, 05:09   #9
 
elite*gold: 0
Join Date: Nov 2009
Posts: 44
Received Thanks: 7
Hm, I just tried using X as my hotkey, still doesn't stop the script. I think that's mainly the problem for me right now, since if I were to reduce sleeping time to 1000 or less, it'd be almost impossible to stop the script manually.

What I've noticed though is that while running the script, it disables my keyboard (Can't type, can't use any mabi hotkeys, etc). What could be the problem :s?
Jacqueline is offline  
Old 02/05/2010, 05:29   #10
 
elite*gold: 0
Join Date: Nov 2009
Posts: 44
Received Thanks: 7
Quote:
Originally Posted by Theri View Post
Edit:
HotKeySet("!{ESC}", "Stop") is incorrect.

Take out the !.
As much as I hoped for that to work, it didn't T_T Looks like I'll have to manually stop the script all the time. Gosh, Autoit3 hates me.

I greatly appreciate the help though, thanks.
Jacqueline is offline  
Old 02/05/2010, 06:39   #11
 
elite*gold: 0
Join Date: Dec 2009
Posts: 333
Received Thanks: 47
Quote:
Originally Posted by Jacqueline View Post
I've noticed more people use Autoit3 for scripting, but I personally prefer AHK. But does Autoit3 scripting work the same way as AHK?

I've seen some useful scripts here, especially for weaving (which is what I need) but I really don't like the fact that I can't pause the script (even if I press the pausing hotkey, it just doesn't stop for some reason).

Let's say I'm using this Autoit3 script to weave my cobwebs:

Would this work for AHK as well, or do I need to make some changes for it to work for AHK? Any help is appreciated, thanks.
Do you actually use this script or was that just an example?
Infylos is offline  
Old 02/05/2010, 18:58   #12
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
Partial placeholder, I'll post code to resolve the pause issue when I've had a time to grab lunch and work it out.

Update:

Looks like you have two options. You can either include misc.au3 in your scripts and use the _IsPressed function to check for the key presses and then run the proper code. This could probably work out ok depending on the script.

The other involves setting up like a virtual keyboard and then works in the expected way. Ill update again in a bit.

Update 2:

Here's the examples I found of how to do this. First is u sing misc.au3 and its _IsPressed() function and the second sort of hooks into the keyboard. I'm not sure why hotkeys work as expected in AHK and not AutoIt.

Code:
#include <Misc.au3>
$dll = DllOpen("user32.dll")

While 1
    If _IsPressed("1b", $dll) Then
        MsgBox(0,"Pressed","Esc")
        ExitLoop
    EndIf
WEnd
DllClose($dll)
Second example.
Code:
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Const $VK_DELETE = 0x2E
Global Const $VK_ESCAPE = 0x1B

Global $hFunc, $pFunc
Global $hHook
Global $hMod
Global $fPauseBot = False

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

$hMod = _WinAPI_GetModuleHandle(0)
$hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, $pFunc, $hMod)

While 1
    If $fPauseBot Then
        _UnsetHotKeys()
        While $fPauseBot
            Sleep(20)
        WEnd
        _ResetHotKeys()
    EndIf
    Sleep(20)
WEnd


Func OnAutoItExit()
    _WinAPI_UnhookWindowsHookEx($hHook)
    DllCallbackFree($hFunc)
EndFunc


Func _UnsetHotKeys()
    HotKeySet("+!d")
EndFunc


Func _ResetHotKeys()
    HotKeySet("+!d", "ShowMessage");Shift-Alt-d
EndFunc


Func ShowMessage()
    MsgBox(0x40, 'Title', 'Text')
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
                    Exit
                Case $VK_DELETE
                    $fPauseBot = Not $fPauseBot ; Was $fPauseBot = True.
            EndSwitch
        EndIf
    EndIf
    
    Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam)
EndFunc
This code is not mine, both come from the AutoIt forums. I will probably rewrite and include a modified version of the second in my bot functions at a later date.
Theri is offline  
Old 02/06/2010, 01:12   #13
 
elite*gold: 0
Join Date: Dec 2009
Posts: 395
Received Thanks: 94
Hate to double post but I'm sure we can deal.

Here's what you need from the 2nd example code.

Code:
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Const $VK_DELETE = 0x2E
Global Const $VK_ESCAPE = 0x1B

Global $hFunc,$pFunc,$hHook,$hMod

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

$hMod = _WinAPI_GetModuleHandle(0)
$hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, $pFunc, $hMod)

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
			; code to do on escape press
                Case $VK_DELETE
			; code to do on pause.
            EndSwitch
        EndIf
    EndIf
    
    Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam)
EndFunc
You cant do while loops but you can do whatever so you can get a sleep in to pause for whatever length, just not indefinitely.

Codes for the keys.
Theri is offline  
Closed Thread


Similar Threads Similar Threads
Autoit3
09/14/2009 - Guild Wars - 4 Replies
Hallo, hab ein paar Fragen zu Autoit. 1. Mit MsbBox öffnet man ja ein Fenster aber wie schreibe ich in das Fester(mit welchem Befehl). z.B. Wie alt bist du? Antwort: 2. Wie speichert man dieses als Variabel. Gruss artimes:handsdown:
Autoit3
05/31/2009 - Metin2 - 9 Replies
Guten Abend ich suche jemanden der mir ein bissl was über Autoit erklären kann. Ich krieg nichmal nen pickup-bot hin (*schäm*) oder bei diesen textboxen ja/nein buttons aber ein bisschen was kann ich schon auch! ICQ:453200614 MfG Peter
[AutoIt3]If und Then
04/23/2009 - AutoIt - 1 Replies
Hey habe eine frage ich habe jetzt eine Bot der über ein Internetbrowser läuft Leider hängen sich mehrere Browser immer auf... Ich arbeite mit WinActivate("xxx - Mozilla Firefox) Winactivate("xxx - Internet Explorer") und da sich ein Browser immer aufhängt würde ich gerne fragen wie das geht mit wenn unten im Fenstern steht (seitenladefehler - Mozilla Fiorefox) dass der Bot mit IF und then arbeitet könnt ihr mir bitte beschreiben wies geht?
SF - AutoIt3
08/29/2008 - Soldier Front - 2 Replies
I was wondering if anyone had any ideas about how to get AutoIt to work in-game.I've made a type of Anti-Recoil tool that works flawlessly outside of the game.Maybe someone can check it out and see whats up with it. The uploaded file comes with AutoIt v3 for those who do not have the updated version of AutoIt. Along with the .au3 script file as well as the compiled .exe for testing purposes.Any ideas would be appreciated. The way this works is you run the .exe (or the .au3 file after...
AutoIt3
04/08/2008 - Metin2 - 4 Replies
Hi,ich habe mir mal AutoIt3 instaliert und jetzt blicke ich garnichts mehr durch wie man da z.b attk speed hack erstellt oder fishing bot ich verstehe nicht wo ich dieses zeug die codes also eintragen soll und ja ich weiss einfach auch nicht wie die codes heißen ES WÄRE TOLL WEN IHR MIR HELFEN KÖNNT!!::confused::o



All times are GMT +1. The time now is 19:51.


Powered by vBulletin®
Copyright ©2000 - 2025, 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 ©2025 elitepvpers All Rights Reserved.