More possibly useful scripts:
Code:
;Double Right Click sends Alt Right Click, which forces a non-formation move.
;Useful if you want to have formation on but don't want units pausing when you are
;trying to run away.
$*RButton::
Send, {RButton}
Keywait, RButton, D, T0.1
if ErrorLevel = 0
Send, !{RButton}
return
Code:
;An new version of a "Ctrl+#" replacement key. Single click MButton to add/remove
;a unit to the group, drag and release MButton to add a selection to the group,
;and double click MButton to add all units of the same type to the group.
;Assumes "group" is a global variable which tracks last pressed # key.
MButton::
If(A_TimeSincePriorHotkey <= 150 and A_PriorHotkey == "MButton")
{
Keywait, MButton
Send, {Shift Down}
Send, {LButton}
Send, {LButton}
Send, {Shift Up}
Send, ^%group%
}
else
{
Critical ;prevents this block from being interrupted by the previous block
Send, {Shift Down}
Send, {LButton Down}
Keywait, MButton
Send, {LButton Up}
Send, {Shift Up}
Send, ^%group%
}
return
Code:
;Auto cast hotkey. Double press the spell key to toggle autocast. Built in pixel checks
;to ensure that the script doesn't activate when spamming the key for unit production.
;Must manually edit the "<X>,<Y>" to the desired icon position (in pixels)!
;Useful if all spells bound to "r" have the same icon position.
;(see Warkeys program or customkeys.txt)
ColorEqual(x,y,t)
{
x += 0
y += 0
x1 := Floor(x/65536)
y1 := Floor(y/65536)
x2 := Floor((x-x1*65536)/256)
y2 := Floor((y-y1*65536)/256)
x3 := (x-x1*65536-x2*256)
y3 := (y-y1*65536-y2*256)
z1 := x1-y1
z1 := x2-y2
z1 := x3-y3
if (Abs(z1) <= t) and (Abs(z2) <= t) and (Abs(z2) <= t)
return 1
else
return 0
}
$r::
Send, r
Keywait, r
PixelGetColor, color1, 409, 679
PixelGetColor, color2, 521, 656
If(ColorEqual(color1,0x7B6E62,3) == 0 and ColorEqual(color2,0x12D3FC,3) == 0)
{
KeyWait, r, D, T0.1
If ErrorLevel = 0
{
Keywait, r
MouseGetPos X1, Y1
Send, {Escape}
MouseClick,Right,<X>,<Y>,1,0
MouseMove,%X1%,%Y1%, 0
}
}
return
This code does not work flawlessly with autocast spells which have no target (raise dead, summon carrion beetle, get corpse, and phase shift); Unless the spell is cooling down, double pressing the spell key will result in a single activation before the autocast is disabled for these spells. If you move the "Send, r" command into an else statement for "If ErrorLevel = 0" then the script will work correctly for those 4 spells at the cost of a 100 ms delay in the "r" key.