Jump to content


Noob making Minecraft macro


  • Please log in to reply
3 replies to this topic

#1 pagonda1

pagonda1
  • Guests

Posted 19 July 2012 - 02:26 AM

Hello, I am a noob at autohotkey. I know a bit of Java from my high school computer programming class, but I have very little knowledge of autohotkey. For the past 3 hours, I've been messing around with it trying to make a Minecraft macro.
Basically what I want it to do is:

-start with F3
-stop with F4
-Press 8 (this is where my weapon slot is)
-then attack 100 times
-Press 9(this is where my food slot is)
-then eat for 3 seconds
-repeat it all over again.
I want to AFK grind some mobs

Here's the code
F3::
F4::stop=1
	stop = 0

Loop
{
If stop = 1
Break
Else
{
SetMouseDelay 30
Send 8                 ;this is my sword slot
Click 100              ; attack for 100 swings
send 9                 ;this is my food slot
Sleep, 3000
Click down right       ;hold down the button to eat
Sleep, 3000            ;eat for 3 secs
Click up right         ;stop eating
}
}
return

Basically, it just doesn't work :\
Any help is very much appreciated!
Thank you for reading!

#2 MasterFocus

MasterFocus
  • Moderators
  • 4130 posts

Posted 19 July 2012 - 02:53 AM

Please indent your code next time, it's better for debugging.
The order of a few things is messed up.
Some things don't need to be inside the loop, the auto-execute part is after a hotkey (in fact, inside it), etc...
Try searching for "definitive autofire" and you'll find a very useful thread for this kind of script!

#3 pagonda1

pagonda1
  • Guests

Posted 19 July 2012 - 02:08 PM

Thank you for your reply, and the link! Now I'm on my way to fixing it :D

#4 Guests

  • Guests

Posted 19 July 2012 - 02:34 PM

Yay, I got it working!
here it is now:
Pause

Loop {
	SetMouseDelay 30
  Send 8                 ;this is my sword slot
  Click 200             ; attack for 200 swings
  send 9                 ;this is my food slot
  Click down right       ;hold down the button to eat
  Sleep, 4000            ;eat for 4 secs
  Click up right         ;stop eating
}

F8::Pause
I'm still tweaking it for maximum efficiency, and the pause only works after the loop finishes, so I'll find a fix for that too!
Thanks so much for the help man.