Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

How to make AHK work in most games - The Basics


  • Please log in to reply
17 replies to this topic
Ruevil2
  • Members
  • 226 posts
  • Last active: Dec 04 2015 11:05 PM
  • Joined: 27 Mar 2012

Since this question gets asked a lot on the boards, with many many good suggestions and tips scattered everywhere, I decided to try to compile most of it in one place. I am looking forward to adding suggestions to this post so let me know what works and what doesn't! I will edit this post with notes on specific games as I see them here or from personal experience. I use AHK with most of the games that I play, anything from keybinds to full MMO grind bots. Lets compile some of our good info here.
 
Easy Steps:
First basic steps to get AHK working with the average game.

1) Make sure the script is running with Admin privilege(Right-Click on script, Run As Administrator)
     -Explanation:  Some games run at admin level and AHK does not typically run with this privilege set.
 
2) Switch the game settings from 'Full Screen' mode to 'Windowed' or (I prefer) 'Borderless Windowed' mode.
    -Explanation:  DirectX draws the screen in a manner different from Windows, this can cause things like colors
          being reported wrong, mouse jumping to the 'wrong' coords, and it can just plain prevent the game from
          registering the input at all.
 
3) A lot of times Keypresses need to be held down longer than normal for the game to fully register it.
     -Explanation:  Usually caused by DirectX(DirectInput). It 'polls' the keyboard every 15ms(varies slightly) and
           records the keys that are down, then 15ms later it takes another 'snapshot' and compares the two. This
           is how games allow you to hold two(or more) keys at the same time, but very fast(sub 10-15ms) inputs
           can fall between snapshots and the game never sees the keypress. If your script is very twitchy and seems

           to skip over some keypresses then this is likely the problem.

     -Example: (Holds key down for 10ms)

Send, {a down}
Sleep 10
Send, {a up}
         

4) Some games do not allow their keybinds to be 'hijacked'.

     -Explanation: Many games, especially DirectX driven, use driver level keyboard interaction and cannot be

          changed via AHK. You need to choose keybindings that the game is NOT using, some people have had

          success by changing the in-game keybinds so that those keys are 'free' for AHK to use.

      

 

Intermediate Steps:
If you are at this point and the script still doesn't work it is likely that you are dealing with some sort of cheat
prevention software. Don't give up hope, there are a couple fairly simple things that can still be done.
 
1) Compile the script to .exe form and rename the program to something non-threatening to the game.
     -Explanation:  Look here in the docs for how to compile, it is very well written and I will not be re-creating
         the wheel here. This method is a fairly simple workaround for most 'hackshield' type softwares.
     -Examples: Rename to something generic or the same as something legit(setup.exe, skype.exe) possibly

          just random garbage(alksjdu.exe).

 

2) Set up a second user account and run scripts as that user. Here is a link to the post with full explanation.

     -Explanation: Games run as one user do not have access to the processes run by a second user. In

          this scenario, some cheat prevention softwares lack the access level to prevent the keystrokes sent

          by the second 'user'(our AHK script)

 
 
Expert Steps: (None of these are verified or easy to use)

These are mostly theory at this point. These will be very difficult and will require in-depth knowledge to implement.

   (if you try any of these ideas with success let me know, i will update this)
 

1) Download and setup a VM(Virtual Machine), install and run the game INSIDE the VM. Run AHK on

     the OUTSIDE OS. This should prevent the game from interacting directly with AHK or 'seeing' it while

     still allowing AHK to move the mouse and click.

 

2) Simulating DirectInput. This is difficult and not supported natively in AHK in any way. Look here for a
     thread describing a couple ways to simulate DirectInput. This is theoretical and untested. Requires

     knowledge of DLL interaction.
 

 

 
Following these steps should get scripts working in the majority of games. I have found a few that I cannot
make work so far but they are few and far between. If you have some tips to add to this please let me know!

 
 
AHK Does Not Work In These Games(As far as I know, will be updated with solutions):
 
Wolfenstein: The New Order


If I helped you out and you would like to show appreciation, feel free to buy me a beer.  grin.png   btn_donateCC_LG.gif


Ruevil2
  • Members
  • 226 posts
  • Last active: Dec 04 2015 11:05 PM
  • Joined: 27 Mar 2012

Solutions for Specific Games:(this is where I will add game specific tips)

 

League of Legends

     -Riot implemented anti-cheat measures as of 5.2

     -Keyboard input is no longer recognized by AHK while in-game(this counts for all screen modes)

          Side note: Commands on timers that are begun outside of LoL will still fire, there could be a way in through this but I haven't had time to experiment.

     -Some mouse commands seem to function

          -The script for stopping screen edge-move effect still functions

          -Mouse commands translate into ingame commands

               -Xbutton1 and Xbutton2 will fire ingame commands when used with a sleep break between the up\down strokes

     -Links to great tools and examples

          RAWM v2.0 by Wickster - Up to 3 Account Auto-Login Tool (Outdated as of patch 4.15 due to new launcher)

          League Macros by Punkkapoika - Macro sets for some popular champs (OUTDATED)

          League Auto-Picker by Sanctus - Auto champ select and lane call out tool

          League MultiPress Chat Tool by Ruevil2 - Combines common chat phrases into a multitap button. (OUTDATED)


If I helped you out and you would like to show appreciation, feel free to buy me a beer.  grin.png   btn_donateCC_LG.gif


4mer
  • Members
  • 15 posts
  • Last active: Jul 10 2014 02:05 PM
  • Joined: 30 Jun 2014

Thanks you.



girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010

Except for shooters which i generally do not play. The games i've successfully scripted for using AutoHotkey are

  • Age of Conan
  • World of Warcraft
  • Rift
  • EverQuest II
  • Guild wars: Prophecies, Factions, Nightfall, Eye of the North
  • Guild Wars 2
  • Forsaken World
  • Scarlet Blade

This is not by any means a complete list tho.  The key to getting AutoHotkey to work in games like these is to start with the

simplest possible fight sequencer without the additional frills of autohealing, target acquisition, crafting or any of the frills. Just

a simple fight routine for a single character that can cycle through your fight skills until you visually determine the mob is

dead and then can pick up the loot. Even skill cooldowns can be a deterrent to success during the initial scripting attempt

at a new game. Once you have a working fight sequencer then you can begin to add the additional stuff like retargeting,

self healing, buffs and buff timers, etc. You may find that the fight sequencer by itself is enough. The worst thing you

can do when trying to script for games like these is to try to add too much too soon. The more stuff you add, the more

difficult it is to get it all working properly together.


The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


4mer
  • Members
  • 15 posts
  • Last active: Jul 10 2014 02:05 PM
  • Joined: 30 Jun 2014

Except for shooters which i generally do not play. The games i've successfully scripted for using AutoHotkey are

  • Age of Conan
  • World of Warcraft
  • Rift
  • EverQuest II
  • Guild wars: Prophecies, Factions, Nightfall, Eye of the North
  • Guild Wars 2
  • Forsaken World
  • Scarlet Blade

This is not by any means a complete list tho.  The key to getting AutoHotkey to work in games like these is to start with the

simplest possible fight sequencer without the additional frills of autohealing, target acquisition, crafting or any of the frills. Just

a simple fight routine for a single character that can cycle through your fight skills until you visually determine the mob is

dead and then can pick up the loot. Even skill cooldowns can be a deterrent to success during the initial scripting attempt

at a new game. Once you have a working fight sequencer then you can begin to add the additional stuff like retargeting,

self healing, buffs and buff timers, etc. You may find that the fight sequencer by itself is enough. The worst thing you

can do when trying to script for games like these is to try to add too much too soon. The more stuff you add, the more

difficult it is to get it all working properly together.

 

Whats i need to learn before build a script who do this:

 

Who my player Select with mouse click some objet (a mob, a npc, an item in the ground) and do some action, like press letter E & click. The most dificult part, i think, is make who the script click the objets that i wish, using it "Artificial Inteligence". For exaple, make click over objets with color #FFF000.

 

PD: In 2D games, not 3D. Sure 3D games scripts are more dificult for beginners like me.

 

I whish you understand my Spanglish :D



girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
If you want to see how a basic mmo fight routine is built take a look here.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


Ruevil2
  • Members
  • 226 posts
  • Last active: Dec 04 2015 11:05 PM
  • Joined: 27 Mar 2012

@GirlGamer

 

Could you move this topic to the Tutorial section please?


If I helped you out and you would like to show appreciation, feel free to buy me a beer.  grin.png   btn_donateCC_LG.gif


Akuta
  • Members
  • 1 posts
  • Last active: Sep 13 2014 03:54 PM
  • Joined: 11 Sep 2014

Except for shooters which i generally do not play. The games i've successfully scripted for using AutoHotkey are

  • Age of Conan
  • World of Warcraft
  • Rift
  • EverQuest II
  • Guild wars: Prophecies, Factions, Nightfall, Eye of the North
  • Guild Wars 2
  • Forsaken World
  • Scarlet Blade

This is not by any means a complete list tho.  The key to getting AutoHotkey to work in games like these is to start with the

simplest possible fight sequencer without the additional frills of autohealing, target acquisition, crafting or any of the frills. Just

a simple fight routine for a single character that can cycle through your fight skills until you visually determine the mob is

dead and then can pick up the loot. Even skill cooldowns can be a deterrent to success during the initial scripting attempt

at a new game. Once you have a working fight sequencer then you can begin to add the additional stuff like retargeting,

self healing, buffs and buff timers, etc. You may find that the fight sequencer by itself is enough. The worst thing you

can do when trying to script for games like these is to try to add too much too soon. The more stuff you add, the more

difficult it is to get it all working properly together.

 

I play Perfect world which comes from the same publisher and uses the same engine etc.

I would really appreciate it if you would send me a copy of your Forsaken World script for Autohokey, as I am having issues getting this to work with Perfect World.

email: [email protected]  Or just post it here.



girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
I'm not really sure my script will work for you. I use two separate file the script and a data ini file.
My screen resolution and UI placements are highly customized. The main script file is over 1500 lines of
pretty dense code and the the data ini file alone is 500 lines all by itself. What I can do tho is give
you an idea of how to make a script work with your own system and give you some snippets that will make
your job a bit easier. FW is a very complex game with both normal and elite mobs. and combo's and fight
conditionals that depend very much on the specific class you are playing at the time. For example playing
a bard you have to string chords together in very specific ways to get the effects you need and these
chords depend tightly on the chords that go before it in the sequence. Creating a script is doable but there
are a lot of special cases that have to be handled. My first advice is to take it in sections and try to
manage one routine at a time until you get that working the way you want. Keep it simple. Start with just
one character class and get that working first.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


hellbunny
  • Members
  • 44 posts
  • Last active: Nov 25 2014 01:11 PM
  • Joined: 14 Oct 2014

im trying to make a very basic script to run on rappelz, just wondering if u have had any dealings with webzen games before, im only making a scrip that hits keys in a continuous loop, not worrying about whats happening in game or anything like that, i might latter on try to work out a more complex script, but right now i just want to be able to use the keys, tab lets me select monsters & the 1 key lets me attack, that`s basically all i`m trying to do.

 

the game doesn't recognize the input from my autohotkey script, & something about my script is preventing me from making it into an exe file (im trying to fix that), i have the key strokes being held down for a random time between 20 & 50 microseconds to simulate a real players actions (iv`e had some limited dealings with auto-ban functions in the past) the file is called "test2.ahk" so it shouldn't be threatening, im running windows 7 & i don`t have the option to "run as admin" when i right click the file, i cant change the in-game keys, there 1 to 0, alt+ 1 to 0,shift+ 1 to 0 & ctrl + 1 to 0, ive tried to use 1 & 2, that's all, i was running the game in window mode when i tested & i haven't tried to do the 2nd used thing yet as its 1am when i found this thread.

 

any help would he appreciated, i know the game can be botted as there are a few people in-game that are well known for doing it. the game does use gameguard



girlgamer
  • Moderators
  • 3263 posts
  • Last active: Feb 01 2015 09:49 AM
  • Joined: 04 Jun 2010
The simplest rotation you can do is just basically setting up a series of keys you want to send
and sending them over and over until you do something to stop the send. For my test scripts I
generally do something like this so i can tell if the system is going to respond to my keys...
 
first I get the window ID and make sure I can read it and see it in the game. I move the window
to the upper left corner of the screen to make sure i can control it if necessary.
Spoiler

This routine does a number of important tasks. It uses a hotkey to start the routine. this allows me to
see if the program is even going to respond to hotkeys. It displays a tooltip on the screen to prompt me
when to hit the mouse button. This allows me to check if the game will allow or prevent writes over the
top of the screen when the game is running. It grabs the window Id and its title so they can be used
later in the script in if and #if statements. It produces a system message box telling me what data it
found so i can visually check if the routine did what it is supposed to do and finally it moves
the game window to position 0,0 on the computer monitor. This is a visual cue that I can directly
manipulate the window itself. There's a lot going on in here that will directly impact your ability
to send keys to the game and get the game to respond.

The universe is a wondrous place! The faster you create unbreakable code, the faster the universe creates people that can break it. All scripting follows the rule Rule Of Twos -- 1) Good, 2) Fast 3) Cheap -- pick any Two.
I guarantee absolutely nothing about any code I provide except that it works in my machine. ●
MMO Fighter   KeyLooperDemo   Key Spammer   TinyClickRecorder  GGs Password Generator.ahk
For the newest version of AutoHotkey and some killer scripts go here.
Rock-on%20kitten.gif


hellbunny
  • Members
  • 44 posts
  • Last active: Nov 25 2014 01:11 PM
  • Joined: 14 Oct 2014

gameguard sux!

 

i made the script u sugested, i used it on this window to test i knew what i was doing with it & it wont work for rappelz

 

i have already made the script i want to use with rappelz but it has the same affect, nuthing, i know its doing what its ment to because if i bring up a notepad it starts typing into it but on rappelz it has no affect. (i also have a counter on my script that brings up a window from the taskbar showing me how many times its ran threw my loop)

 

i have tried send, sendinput & sendevent. i have the script compiled into an exe file(was sugested on some other thread that it might help)

 

and while rappelz is active i cant even use the hotkey to pause my script

 

any sugestions?  because i refuse to play a magic class until i can get this working so i can auto attack like a melee class can (a mage class has to hit 1 every 1 sec & 2 every 1 sec, they need to be hit 0.5 sec apart to actualy have the class attacking like a melee class does



hellbunny
  • Members
  • 44 posts
  • Last active: Nov 25 2014 01:11 PM
  • Joined: 14 Oct 2014

just tryed controlsend & sendplay, both dont work



SnowFlake_FlowSnake
  • Members
  • 845 posts
  • Last active: Jan 24 2016 05:24 PM
  • Joined: 08 Oct 2012

Try my tool:

http://www.autohotke...click-tool-v32/


  • Download link of my scripts on Autohotkey.com 2/10/2015 [DOWNLAND]
  • Contact Info:  https://github.com/floowsnaake //  FloowSnaake(A)gmail.com
  • IF you need Help send me a PM,Email or Post on Github

  • Quote by tank  Posted 29 September 2015 - 06:14 PM

  • "Eventually i will find a way to convert the DB back to PHPBB3. but i dont have the bandwidth right now. No one that has tried has had success. It is the Only way i can keep this open is if i could successfully convert it."

Nargacuga
  • Members
  • 33 posts
  • Last active: Mar 22 2019 08:29 AM
  • Joined: 08 Jun 2014

thank you sir , i loveu