Instructional: Autohotkey

Free forum for everything around the classic server not falling under other categories.
Post Reply
User avatar
Stop_Sign
SupOP
Offline
Posts: 33
Joined: May 27th, 2011, 7:09 pm

Instructional: Autohotkey

Post by Stop_Sign »

Yo guys! As some of you know, I was the first to bring autohotkey to this server all those months ago, and I'm going to make it standard for all veterans+ again! Here's why its useful:

* Really fast commands (such as copy/paste)
* Fast patrolling
* Easy speeches
* Useful real world applications
* Fun trolling friends

So now that you realize that you can't live without it, how do you get it? Simple!
Go to this link and click the installer for autohotkey_L. It'll download fast, and just run the installer. After you run the installer, load up the program from your start menu. You should see a green box next in your toolbar next to your block with an H on it. That means the script is currently running.

It should also prompt you with a "Do you want to create an example script". Say yes. It'll load notepad. This is where you can put the code for the actual script. If you don't get that, then right click on the green box and press "Edit" and it'll give you a notepad file as well.

Depending on how much of a programmer you are, you can use this program for anything from simple tasks to extremely powerful and important tools to ruthlessly trolling your friends. I'll start you off with a demo program. You should delete everything in the text file it auto-created for you, and put this in (I'll explain it too):

Code: Select all

^p::
IfWinActive, Minecraft
{
SendEvent t
sleep, 50
SendEvent /pat{Enter}
}
return
In this code, the ^p:: is like saying "When I press control and then p", so this code is designated to run when you press ctrl-p.
It will only run this if the window title says minecraft as well, so no messing with hotkeys elsewhere! (thanks to Hafnium)
It will then send the t letter, to open your chat log, and then wait a bit for the client to catch up (50 milliseconds). After that, it'll use the open text box to type /pat and then press the enter key.
The purpose of this macro is to make patrolling easier. Rather than type t/pat yourself, all you have to do is press ctrl-p. You can change the ctrl-p to anything you want. I also use the grave key (the ` key) to patrol. If you wanted to do that, your code would instead look like this:

Code: Select all

`::
IfWinActive, Minecraft
{
SendEvent t
sleep, 50
SendEvent /pat{Enter}
}
return
Simple, right?
So how do you run this program? After you've pasted it in the notepad, save the document and then right click your green button in the toolbar. Click the "Reload the script" option and your script will be running. After that, you can press ctrl-p to patrol any time! You can also pause the script by right clicking and choosing the "suspend hotkeys" option.

"OK, that is too simple. Where is all of the rest of the things you promised me?" You ask.

Well, here are some other useful commands of mine, which you can just plop into the text file:

Code: Select all

^c::
IfWinActive, Minecraft
{
SendEvent t
Sleep, 50
SendEvent /copy{Enter}
}
return

^z::
IfWinActive, Minecraft
{
SendEvent t
sleep, 50
SendEvent /undo{Enter}
}
return

^v::
IfWinActive, Minecraft
{
SendEvent t
sleep, 50
SendEvent /paste{Enter}
}
return

^t::
IfWinActive, Minecraft
{
SendEvent t
sleep, 50
SendEvent /c air{Enter}
}
return

^b::
IfWinActive, Minecraft
{
SendEvent t
sleep, 50
SendEvent /measure{Enter}
}
return

^i::
IfWinActive, Minecraft
{
SendEvent t
sleep, 100
SendEvent If I see see you spleefing or griefing /{Enter}
sleep, 100
SendEvent tor tunneling, /{Enter}
sleep, 100
SendEvent t I will kick you from the server.{Enter}
}
return

^o::
IfWinActive, Minecraft
{
SendEvent t
sleep, 100
SendEvent If you are being griefed, get the name /{Enter}
sleep, 100
SendEvent tof your griefer and say it in the chat /{Enter}
sleep, 100
SendEvent tand we will attend to you as soon /{Enter}
sleep, 100
SendEvent tas we can.{Enter}
}
return

XButton2::
IfWinActive, Minecraft
{
Loop, 20
SendEvent {Click}
}
return
All is fine and good, but that last one is unique to having an awesome mouse. What it'll do is to click (read: delete a block) really, really fast. This not only allows me to cheat at spleef (click with the power of a THOUSAND SUNS), but also allows me to delete anything I create really fast with minimal clicking.

This isn't laziness, its efficiency. You should learn how to do this as well!
Last edited by Stop_Sign on May 30th, 2011, 5:11 am, edited 1 time in total.

User avatar
PolakWithABlock
SupOP
Offline
Posts: 294
Joined: May 24th, 2011, 3:44 am

Re: Instructional: Autohotkey

Post by PolakWithABlock »

thanks
Aleries: What OS is your server running on?
FierceReacter: 5

User avatar
Snave2
#J
Offline
Posts: 65
Joined: May 26th, 2011, 6:32 pm

Re: Instructional: Autohotkey

Post by Snave2 »

Excellent guide, Stop_Sign! I've always been too lazy to explore macros using software since my mouse/keyboard came with a nice, friendly UI for these features. I will be sure to inform new builders curious about this to check out your guide.

A word of caution - using an auto mouse clicker is a very fun way to build and extremely satisfying to use; however, it may trigger an autokick from the server "for suspected griefing" if your rank isn't high enough. On Spa.net you had to be above the vet rank (mason, op, etc) to bypass it. I'm not sure if it's the same here.

I challenge thee to a 20 layer speed spleef duel!
You look around on Middle-Earth
as if she for no purpose bore you,
as if you were her first-born birth,
and none had lived before you.

User avatar
Hafnium
Owner
Offline
Posts: 604
Joined: May 21st, 2011, 10:51 pm

Re: Instructional: Autohotkey

Post by Hafnium »

Code: Select all

Numpad0::
IfWinActive, Minecraft
{
Send t
Sleep 100
Send /patrol{Enter}
}
return
I really like the window functionality of autohotkey. Keeps me from pasting into other chat.
The first law of thermodynamics states that you don't discuss thermodynamics.

User avatar
Allie
Offline
Posts: 329
Joined: May 24th, 2011, 1:37 am
Location: Sealand

Re: Instructional: Autohotkey

Post by Allie »

Thanks for the guide, Stop! Should be useful for a lot of people. One thing I do recommend, however, is that you use Code tags for the scripts, to make it easier to read.
Hafnium wrote:

Code: Select all

Numpad0::
IfWinActive, Minecraft
{
Send t
Sleep 100
Send /patrol{Enter}
}
return
I really like the window functionality of autohotkey. Keeps me from pasting into other chat.
Hafnium, you are a life saver.
<CMB> KingCrab72: Some mixture and contrast would be nice tbh Ollie
<Ollieboy> Some mixture and contrast of your face on my penis would also be nice

User avatar
Stop_Sign
SupOP
Offline
Posts: 33
Joined: May 27th, 2011, 7:09 pm

Re: Instructional: Autohotkey

Post by Stop_Sign »

OK. Updated with suggestions.

User avatar
Sanjar Khan
Trustee
Offline
Posts: 1766
Joined: May 24th, 2011, 1:40 pm
Location: Leiden, Zuid Holland

Re: Instructional: Autohotkey

Post by Sanjar Khan »

sticky sticky sticky this mess!
Ferrisbuler2: i will stay but i might not post cus of ollieboy

User avatar
Desosus
SupOP
Offline
Posts: 325
Joined: May 28th, 2011, 12:16 am

Re: Instructional: Autohotkey

Post by Desosus »

Sometimes when I use the autohotkey to do 1 button patrol, it just types pat in chat. Any way to fix that?
_Snivy_: is desosus a bot?

User avatar
Smokeybacon
Trustee
Offline
Posts: 371
Joined: May 24th, 2011, 12:29 am
Location: Stuttgart
Contact:

Re: Instructional: Autohotkey

Post by Smokeybacon »

Desosus wrote:Sometimes when I use the autohotkey to do 1 button patrol, it just types pat in chat. Any way to fix that?
Try increasing the sleep time.
[02:27] <+FCB2> MainTrain97: my dad is an arkansas goveren
[02:27] <+FCB2> MainTrain97: and iwe are suing skittles
[02:29] <+FCB2> MainTrain97: and we may file a lawsuit against fcraft

prototypedesign
SupOP
Offline
Posts: 173
Joined: May 23rd, 2011, 11:46 pm

Re: Instructional: Autohotkey

Post by prototypedesign »

It's based on which WoM version you're using. At least with 1.6.3 all you need to do is put a sleep between the "t" and the "/patrol", but if you're using later versions they may have changed that. Try putting a "Sleep 10" between each letter.

User avatar
Stop_Sign
SupOP
Offline
Posts: 33
Joined: May 27th, 2011, 7:09 pm

Re: Instructional: Autohotkey

Post by Stop_Sign »

prototypedesign wrote:It's based on which WoM version you're using. At least with 1.6.3 all you need to do is put a sleep between the "t" and the "/patrol", but if you're using later versions they may have changed that. Try putting a "Sleep 10" between each letter.
Yea. With 1.6.3 I didn't need any sleep time and it worked just fine. The sleep time here is to fix the problem Desosus is describing. If you're still having the problem, maybe your computer is slower than mine and you need more sleep time. No big deal.

User avatar
Desosus
SupOP
Offline
Posts: 325
Joined: May 28th, 2011, 12:16 am

Re: Instructional: Autohotkey

Post by Desosus »

Yeah, I fixed it a while ago. Works fine now.
_Snivy_: is desosus a bot?

Shurtugal_Morzan
Offline
Posts: 2
Joined: June 9th, 2011, 9:02 pm

Re: Instructional: Autohotkey

Post by Shurtugal_Morzan »

Nice guide. I used Autohotkey before too, and to all: in that manner u can use autohotkey for nearly everything with just i few lines of code. the helpfile of AHK is also really helpfull if u want to write more scripts.

but now i have my logitech G11 with specials keys for exact this porpous :D

User avatar
Stop_Sign
SupOP
Offline
Posts: 33
Joined: May 27th, 2011, 7:09 pm

Re: Instructional: Autohotkey

Post by Stop_Sign »

Shurtugal_Morzan wrote:Nice guide. I used Autohotkey before too, and to all: in that manner u can use autohotkey for nearly everything with just i few lines of code. the helpfile of AHK is also really helpfull if u want to write more scripts.
Yea I like to use it for messing with online games as well. For example, in this game, you have to just type all the numbers (1, 2, 3, 4, ...) to a hundred. Instead of that, I wrote a script that beats the game in 2 seconds. I use it at work as well to auto-type my password I have to type every time I load my program. Efficiency!

Code: Select all

!3::
SendEvent {Click}
x = 1
loop, 100
{ 
SendEvent %x%
x++ 
}

User avatar
capi
OP
Offline
Posts: 89
Joined: June 27th, 2011, 3:44 am

Re: Instructional: Autohotkey

Post by capi »

Stop_Sign wrote:
Shurtugal_Morzan wrote:Nice guide. I used Autohotkey before too, and to all: in that manner u can use autohotkey for nearly everything with just i few lines of code. the helpfile of AHK is also really helpfull if u want to write more scripts.
Yea I like to use it for messing with online games as well. For example, in this game, you have to just type all the numbers (1, 2, 3, 4, ...) to a hundred. Instead of that, I wrote a script that beats the game in 2 seconds. I use it at work as well to auto-type my password I have to type every time I load my program. Efficiency Security!

Code: Select all

!3::
SendEvent {Click}
x = 1
loop, 100
{ 
SendEvent %x%
x++ 
}
>l>

User avatar
200419110
OP
Offline
Posts: 63
Joined: June 1st, 2011, 2:50 pm
Location: Georgia, USA

Re: Instructional: Autohotkey

Post by 200419110 »

Ummm i didnt know vets could patrol
+Fricksion: What if...
+Fricksion: What if Grant works for the NSA
+Fricksion: Do not trust Grant
200419110: D:
+Fricksion: Agent 200419110, do not make me say your real codename.
+Fricksion: Agent hotbabe69ladiesdude, please report.
200419110: omg

beeriebeer
SupOP
Offline
Posts: 348
Joined: June 3rd, 2011, 6:53 pm

Re: Instructional: Autohotkey

Post by beeriebeer »

Just added a fast few things, please say if it doesn't or if it is grammatical wrong. It helps with teaching builders, very usefull.
^h::
IfWinActive, Minecraft
{
SendEvent t
sleep, 100
SendEvent Welcome, as builder you need to /{Enter}
sleep, 100
SendEvent tknow the rules, you can find /{Enter}
sleep, 100
SendEvent tthe rules on forum.fcraft.net /{Enter}
sleep, 100
SendEvent tplease look at it later.{Enter}
}
return

^e::
IfWinActive, Minecraft
{
SendEvent t
sleep, 100
SendEvent Now i gonna learn you a few /{Enter}
sleep, 100
SendEvent tcommands, never abuse them /{Enter}
sleep, 100
SendEvent tthen you will get a demotion /{Enter}
sleep, 100
SendEvent tor even a ban.{Enter}
}
return

^l::
IfWinActive, Minecraft
{
SendEvent t
sleep, 100
SendEvent First command is /c, type this /{Enter}
sleep, 100
SendEvent tafter that (right)click on /{Enter}
sleep, 100
SendEvent tthe two red blocks .{Enter}
}
return

^p::
IfWinActive, Minecraft
{
SendEvent t
sleep, 100
SendEvent The commands you learned are /{Enter}
sleep, 100
SendEvent tforbidden in main and guest /{Enter}
sleep, 100
SendEvent tonly use them if you help /{Enter}
sleep, 100
SendEvent ta guest. {Enter}
}
return

^i::
IfWinActive, Minecraft
{
SendEvent t
sleep, 100
SendEvent Now i will learn you the /{Enter}
sleep, 100
SendEvent tkick command, only /{Enter}
sleep, 100
SendEvent tuse this command if /{Enter}
sleep, 100
SendEvent tthere is no veteran+. {Enter}
}
return

^n::
IfWinActive, Minecraft
{
SendEvent t
sleep, 100
SendEvent Now you are free to go. /{Enter}
sleep, 100
SendEvent t as builder you can /{Enter}
sleep, 100
SendEvent tbuild in builder worlds /{Enter}
sleep, 100
SendEvent t(type /worlds to see worlds) {Enter}
}
return

User avatar
LiamRayStanley
OP
Offline
Posts: 151
Joined: February 9th, 2012, 2:09 pm
Contact:

.

Post by LiamRayStanley »

Be that way.
Last edited by LiamRayStanley on February 26th, 2012, 10:28 pm, edited 1 time in total.
<+FCB>Arvarna: i think your banhammer needs a downgrade

User avatar
PyroPyro
Offline
Posts: 381
Joined: May 25th, 2011, 4:00 pm
Location: #fCraft
Contact:

Re: Instructional: Autohotkey

Post by PyroPyro »

LiamRayStanley wrote:

Code: Select all

...
SendEvent tSpamming, or Tunneling, we will KICK U /{Enter}
SendEvent tOr even BAN U from our Server.{Enter}
...
SendEvent /me said GTFO, or We'll Troll You.{Enter}
...
SendEvent That was just amazing...{Enter}
...
SendEvent /me Smacks his face on his keyboard...{Enter} 
...
That is more of a spam script..

User avatar
Ninjacat101
Trustee
Offline
Posts: 218
Joined: December 17th, 2011, 12:27 am
Location: UK

Re: Instructional: Autohotkey

Post by Ninjacat101 »

Places a block around you in mid air when you type '/.place'. Doesn't work if you move while it's executing the commands which could only be fixed with a smaller sleep which I can't seam to get working.

Code: Select all

::.place::
IfWinActive Minecraft  Coords
{
sleep 50
send c {enter}
sleep 50
send t
sleep 50
send /m {enter}
sleep 50
send t
sleep 50
send /m {enter}
}
else
send .place
return
Last edited by Ninjacat101 on June 19th, 2012, 11:06 am, edited 2 times in total.
["hip","hip"]

User avatar
Wundsalz
Trustee
Offline
Posts: 290
Joined: July 26th, 2011, 11:34 pm

Re: Instructional: Autohotkey

Post by Wundsalz »

Ninjacat101 wrote:Doesn't work if you move while it's executing the commands which could only be fixed with a smaller sleep which I can't seam to get working.
Minecraft calculates with 20ticks/seconds internally. I doubt you can lower the delay time any further.
I'm not familiar with AHK scripting, but isn't it possible to replace
sleep 50
send /
sleep 50
send m
sleep 50
send {enter}
with
sleep 50
send /m {enter}
or something alike?
The man in black fled across the desert, and the gunslinger followed.

User avatar
Ninjacat101
Trustee
Offline
Posts: 218
Joined: December 17th, 2011, 12:27 am
Location: UK

Re: Instructional: Autohotkey

Post by Ninjacat101 »

Wundsalz wrote:
Ninjacat101 wrote:Doesn't work if you move while it's executing the commands which could only be fixed with a smaller sleep which I can't seam to get working.
Minecraft calculates with 20ticks/seconds internally. I doubt you can lower the delay time any further.
I'm not familiar with AHK scripting, but isn't it possible to replace
sleep 50
send /
sleep 50
send m
sleep 50
send {enter}
with
sleep 50
send /m {enter}
or something alike?
Updated previous post :P It does work, although I added those sleeps when I had an issue with it doing things too quickly for minecraft to keep up.
["hip","hip"]

Post Reply