 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
dwinar
Joined: 05 Sep 2009 Posts: 10
|
Posted: Sat Sep 05, 2009 7:40 pm Post subject: Starcraft AutoBUILDER |
|
|
Greetings!
I am making a macro for StarCraft that will allow to train units really fast and automatically. But that's not the point. I am just starting with AutoHotkey and want to learn more. So the question is how to make macro that works like or at least similar to that one I have found on other forum posted by XGhozt
| Quote: | If you have many many buildings late in the game, it isn't feasible to hotkey them all, but it still would be nice to be able to macro like mad very quickly.
There 4 modes of this script and 4 separate hotkeys, F5, F6, F7, F8
Let X=5, 6, 7, or 8:
Fx, backspace : this resets what buildings are in group Fx
Fx, right click : this sets a rally point for all buildings in group Fx to where the mouse is
Fx, any letter: this builds the corresponding unit at all buildings in the group Fx
Fx, click, click, click, ..., right click : this teaches the script where the buildings are. Since no hotkeys are to be used we must show it where the buildings are by clicking on the minimap then clicking on the buildings, this way it knows exactly how to get to your buildings no matter where you are. You may click on the minimap again to add buildings at distant locations. It is important not to scroll while clicking the buildings, but you can scroll around by dragging the mouse on the minimap. Right click to escape this mode. Note you can build units as you select these buildings. Also if you do not make your first click on the minimap this mode is just escaped. A side effect of building units or setting rally points is that you screen position at F4 is used to remember where you were before the you started building units. Zerg players do not need to press s first. A pitfall of this method is that if someone is hovering units over your buildings it may fail to select the building. Just play around with it, its alot simpler than it sounds and it should be intuitive.
*Remember to clear F5, F6, F7, F8 with backspace before each game |
It can't use the GUI because you shouldn't minimalize the game.
Thanks in advance!
with regards,
Dwinar
EDIT:
Ok... So I produced this some time ago and now I would like to know how to upgrade this script:
| Code: |
CoordMode Mouse, Screen
#Esc::
ExitApp
return
; Mouse movement "recording" mode
F5::
recordbreaker := 0
; MsgBox Mouse movement "recording" mode
loop 1
{
Input RecordedKey, L1
SoundPlay *32
; 1 CLICK ON MINIMAP
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *48
MouseGetPos px1, py1
Sleep 500
; 1 Building to click
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *-1
MouseGetPos x1, y1
LIMITER := 1
Sleep 500
; 2 Building to click
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *-1
MouseGetPos x2, y2
LIMITER := 2
Sleep 500
; 3 Building to click
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *-1
MouseGetPos x3, y3
LIMITER := 3
Sleep 500
; 4 Building to click
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *-1
MouseGetPos x4, y4
LIMITER := 4
Sleep 500
; 2 CLICK ON MINIMAP
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *48
MouseGetPos px2, py2
Sleep 500
; 5 Building to click
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *-1
MouseGetPos x5, y5
LIMITER := 5
Sleep 500
; 6 Building to click
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *-1
MouseGetPos x6, y6
LIMITER := 6
Sleep 500
; 7 Building to click
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *-1
MouseGetPos x7, y7
LIMITER := 7
Sleep 500
; 8 Building to click
KeyWait LButton, D
if recordbreaker > 0
break
else
SoundPlay *-1
MouseGetPos x8, y8
LIMITER := 8
Sleep 500
; MsgBox Recording ended
}
return
; Stop recording anytime you want
F6::
recordbreaker := 1
; MsgBox You have ended "recording" earlier
return
; You can change training key ANYTIME
+F5::
Input RecordedKey, L1
SoundPlay *32
return
; Perform "recorded" action
F7::
loop 1
{
Send {Shift Down}{F4}{Shift Up} ; remember screen position, to return here after performed action
; 1 CLICK ON MINIMAP
Click %px1%, %py1%
Sleep 100
; 1 Building to click
if LIMITER > 0
{
Click %x1%, %y1%
Sleep 100
Send %RecordedKey%
Sleep 100
}
else
{
Send {F4}
break
}
; 2 Building to click
if LIMITER > 1
{
Click %x2%, %y2%
Sleep 100
Send %RecordedKey%
Sleep 100
}
else
{
Send {F4}
break
}
; 3 Building to click
if LIMITER > 2
{
Click %x3%, %y3%
Sleep 100
Send %RecordedKey%
Sleep 100
}
else
{
Send {F4}
break
}
; 4 Building to click
if LIMITER > 3
{
Click %x4%, %y4%
Sleep 100
Send %RecordedKey%
Sleep 100
}
else
{
Send {F4}
break
}
; 2 CLICK ON MINIMAP
Click %px2%, %py2%
Sleep 100
; 5 Building to click
if LIMITER > 4
{
Click %x5%, %y5%
Sleep 100
Send %RecordedKey%
Sleep 100
}
else
{
Send {F4}
break
}
; 6 Building to click
if LIMITER > 5
{
Click %x6%, %y6%
Sleep 100
Send %RecordedKey%
Sleep 100
}
else
{
Send {F4}
break
}
; 7 Building to click
if LIMITER > 6
{
Click %x7%, %y7%
Sleep 100
Send %RecordedKey%
Sleep 100
}
else
{
Send {F4}
break
}
; 8 Building to click
if LIMITER > 7
{
Click %x8%, %y8%
Sleep 100
Send %RecordedKey%
Sleep 100
}
else
{
Send {F4}
break
}
Send {F4} ; return of the screen
}
return
; Set rally point to all "remembered" buildings
+F7::
loop 1
{
Send {Shift Down}{F4}{Shift Up}
MouseGetPos rx1, ry1
; 1 CLICK ON MINIMAP
Click %px1%, %py1%
Sleep 100
; 1 Building to click
if LIMITER > 0
{
Send {Shift Down}{F3}{Shift Up}
Click %x1%, %y1%
Sleep 100
Send {F4}
Sleep 100
Click Right %rx1%, %ry1%
Sleep 100
}
else
{
break
}
; 2 Building to click
if LIMITER > 1
{
Send {F3} ; instead of clicking on minimap
Click %x2%, %y2%
Sleep 100
Send {F4} ; "rally point"
Sleep 100
Click Right %rx1%, %ry1%
Sleep 100
}
else
{
break
}
; 3 Building to click
if LIMITER > 2
{
Send {F3}
Click %x3%, %y3%
Sleep 100
Send {F4}
Sleep 100
Click Right %rx1%, %ry1%
Sleep 100
}
else
{
break
}
; 4 Building to click
if LIMITER > 3
{
Send {F3}
Click %x4%, %y4%
Sleep 100
Send {F4}
Sleep 100
Click Right %rx1%, %ry1%
Sleep 100
}
else
{
break
}
; 2 CLICK ON MINIMAP
Click %px2%, %py2%
Sleep 100
; 5 Building to click
if LIMITER > 4
{
Send {Shift Down}{F3}{Shift Up}
Click %x5%, %y5%
Sleep 100
Send {F4}
Sleep 100
Click Right %rx1%, %ry1%
Sleep 100
}
else
{
break
}
; 6 Building to click
if LIMITER > 5
{
Send {F3}
Click %x6%, %y6%
Sleep 100
Send {F4}
Sleep 100
Click Right %rx1%, %ry1%
Sleep 100
}
else
{
break
}
; 7 Building to click
if LIMITER > 6
{
Send {F3}
Click %x7%, %y7%
Sleep 100
Send {F4}
Sleep 100
Click Right %rx1%, %ry1%
Sleep 100
}
else
{
break
}
; 8 Building to click
if LIMITER > 7
{
Send {F3}
Click %x8%, %y8%
Sleep 100
Send {F4}
Sleep 100
Click Right %rx1%, %ry1%
Sleep 100
}
else
{
break
}
}
return
; Reset of settings
#F5::
Reload
return
|
I mean... Is there any way to make it easier (more user friendly or even shorten the script without effect loses) or give it possibility to "remeber" more than 10 clicks without expanding script too much.
Last edited by dwinar on Wed Sep 16, 2009 8:21 am; edited 2 times in total |
|
| Back to top |
|
 |
txquestor
Joined: 22 Aug 2009 Posts: 294
|
Posted: Tue Sep 15, 2009 10:50 pm Post subject: How to make a configurable macro |
|
|
The AHK Forum is one of the most helpful on the Net.
However, just asking for someone to write a script for you is not going to get any response.
You have to put some effort into it too. I suggest you try three things.
Go to the forum "Ask for Help". At the top of the page is a link called
"Announcement" PLEASE READ IF YOU'RE NEW: How to Get Answers Effectively.
The 3rd link is: Tutorial for Newbies. Read it too.
If you click on the "Autohotkey" picture on the upper left of any page.
It takes you to the docs, tutorial, hekp file and other references to help you understand AHK
There are also many example scripts in the ASK FOR HELP forum
and the SCRIPTs & FUNCTIONs forum.
I glanced at your code and it's very similar to AHK "HOTKEYS"
Finally, use the "Seach' feature button at the top of the page.
Enter words like; Hotkeys, StarCraft, Mouse and others words relating to your interest.
Take the code you posted after you learned a bit and try writing a script.
Start with just a couple lines of your code above and test it to see if it does what you want.
If you have problems, then post your code and someone will help yuo
I also suggest you change your subject to something more meaningful.
You'll probably find what your looking for. _________________
"Man's quest for knowledge is an expanding series whose limit is infinity" |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|