Using AutoHotkey to gain a Mortal Kombat achievement

When it comes to browser games, they are usually 100% no-brainer repetitive and can be automated to full extent. It was fun in the beginning, not so much anymore.

I’ve enjoyed playing Mortal Kombat series since childhood, always was good at it. Last thing competitive on PC was Mortal Kombat 4, first 3D game in MK series, with weird characters like Fujin instead of Kung Lao, Jarek, Tanya.

MK4 Finish Him Raiden vs. Scorpion UnconsciousGood ol’ MK4 times, collecting glitches was my hobby
Mk4 Time Is Up Raiden ScorpionMortal Kombat 4, Raiden was like the most powerful character

When Mortal Kombat Komplete Edition was released on Steam for PC, I’ve bought it immediately. This post is not place to say how bad MKKE for PC is, to say it short, it’s the worst piece of software I have ever seen. But the game is still great and it was possible to play.

Mkke King Of The Hill GlitchMKKE put glitches on entire new level!

After I was able to consistently beat all of my friends with most imbalanced character I was able to find (that’s Kenshi, friends; he is good and easy), it was time to get some achievements. Some of them was fun and challenging (flawlessly beat Shang Tsung twice in a row?), but some of them was really boring. Look at this: “Luck Be A Lady: Get all MK Dragons in Test Your Luck”.

Mkke Test Your LuckWorking on Luck Be A Lady achievement. Test Your Luck mode.

To get this achievement, you must get three gold coins in a row. Row doesn’t even always have a coin in it! It would take a lot of time to do it manually.

Welcome AutoHotkey. It is a tool with it’s own easy programming language, it’s easy to automate routine tasks with it, it is built to work nicely with Windows UI, have native methods to work with mouse, keyboard, windows, hard disk, etc. Here is the script I have used to get Luck Be A Lady achievement:

As you can see, endless loop is being enabled with Ctrl+Alt+F10, disabled with F10. It will attempt to start roulette in method Loop4xTimes(), and then after enough time, it will start new Test Your Luck game using RestartMatch(). This might be not the best code, but it works, I’ve started it, went to sleep, achievement was completed when I woke up 🙂

For the later MKKE automations I have made helper methods, mk9-common.ahk:

Now AutoHotkey code for MKKE looks like this:

I encourage you to meet AutoHotkey and discover it, as it’s pretty powerful and important tool for any programmer-at-heart.