Page 1 of 1

Instructional: Autohotkey

Posted: May 29th, 2011, 6:15 am
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!

Re: Instructional: Autohotkey

Posted: May 29th, 2011, 8:38 am
by PolakWithABlock
thanks

Re: Instructional: Autohotkey

Posted: May 29th, 2011, 8:41 am
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!

Re: Instructional: Autohotkey

Posted: May 29th, 2011, 3:15 pm
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.

Re: Instructional: Autohotkey

Posted: May 29th, 2011, 5:37 pm
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.

Re: Instructional: Autohotkey

Posted: May 30th, 2011, 5:11 am
by Stop_Sign
OK. Updated with suggestions.

Re: Instructional: Autohotkey

Posted: June 4th, 2011, 9:06 am
by Sanjar Khan
sticky sticky sticky this mess!

Re: Instructional: Autohotkey

Posted: June 6th, 2011, 6:27 pm
by Desosus
Sometimes when I use the autohotkey to do 1 button patrol, it just types pat in chat. Any way to fix that?

Re: Instructional: Autohotkey

Posted: June 7th, 2011, 4:23 pm
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.

Re: Instructional: Autohotkey

Posted: June 7th, 2011, 4:53 pm
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.

Re: Instructional: Autohotkey

Posted: June 19th, 2011, 6:15 am
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.

Re: Instructional: Autohotkey

Posted: June 19th, 2011, 6:28 am
by Desosus
Yeah, I fixed it a while ago. Works fine now.

Re: Instructional: Autohotkey

Posted: July 5th, 2011, 11:55 am
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

Re: Instructional: Autohotkey

Posted: July 8th, 2011, 6:26 pm
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++ 
}

Re: Instructional: Autohotkey

Posted: July 9th, 2011, 2:42 am
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++ 
}

Re: Instructional: Autohotkey

Posted: July 11th, 2011, 12:51 am
by 200419110
Ummm i didnt know vets could patrol

Re: Instructional: Autohotkey

Posted: July 25th, 2011, 6:00 pm
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

.

Posted: February 26th, 2012, 9:33 pm
by LiamRayStanley
Be that way.

Re: Instructional: Autohotkey

Posted: February 26th, 2012, 9:55 pm
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..

Re: Instructional: Autohotkey

Posted: June 19th, 2012, 6:54 am
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

Re: Instructional: Autohotkey

Posted: June 19th, 2012, 9:08 am
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?

Re: Instructional: Autohotkey

Posted: June 19th, 2012, 11:05 am
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.