Nice work with warkeys, haven't tried it yet but I am planning to try it soon.
Quote:
Your quick burrow/hide/statue/root script is better now. Too bad it only works on a few units though. When a group is given another action, these few units luckily do not return to the group. Are we assuming all burrow/hide/statue/root are activated by pressing 'c'? Would have been nice to just tell any unit to run for their lives temporarily and come back when feeling better.
Yea, I'm assuming all those actions have been bound to 'c'. It might actually be possible to tell a unit to run home like this. All the user would need to do is define a "home" location on the minimap (via hotkey) at the start of the game.
Quote:
I do not understand. The FAQ does not mention a problem with combinations like "1 & LButton::". If "1" is a prefix, then programs ignore it until released. No waiting that I can see. See FAQ - Custom combinations at,
That makes much more sense now, I must have just been noticing the time difference between key press and key release.
Here is a new script of mine. When you double click on any hero you will select all heroes you control, a lot like double clicking on units. The difference is you will select all heroes, not just heroes on the screen. This is my first warcraft script using PixelGetColor to achieve new functionality.
Basic program outline: The program knows if you clicked a hero by looking for the "hero damage type" icon. The script shift clicks heroes using the portraits in the upper left corner. To check whether or not there actually
is a hero portrait there it looks for a tooltip which appears on the lower right when you mouse over a hero portrait.
This requires Advanced Tooltips to be checked ON in the options menu. Finally, the script determines if it added or removed that hero by looking at the portraits on the bottom HUD.
Code:
;;;;;;;;;;;;;;;;;;
;Function which returns 1 if x and y are approximately the same color,
;and 0 otherwise. x and y are hexadecimal values in the form PixelGetColor
;spits out. t is the tolerance, ranging from 0-256. t=0 means x and y
;must be exactly the same, 256 means the function always returns 1
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
}
$LButton::
Send, {LButton down}
if (A_TimeSincePriorHotkey <= 150) and (A_PriorHotkey == "$LButton up")
{
PixelGetColor, color, 409, 679 ; looks at the damage type icon
if(color == 0x5FFAFF)
{
Keywait, LButton
MouseGetPos, X1, Y1
i := 0
Loop,3
{
y := 62 + i*65
x := 418 + i*38
MouseMove, 32, %y%, 0 ; move to a hero icon at the upper left
PixelGetColor, color, 745, 540 ; look for the tooltip on the bottom right
if(ColorEqual(color,0x238AAC,3) == 1)
{
Send, +{LButton}
Sleep, 10
PixelGetColor, color, %x%, 663 ; look at the bottom HUD portraits
if(color == 0x000000) ; if black we removed someone from the group, so add them back in
Send, +{LButton}
}
Sleep, 10
i := i + 1
}
MouseMove, %X1%, %Y1%, 0
}
}
return
$LButton up::
Send, {LButton up}
Since the program works by looking at pixels it needs to know the right reference colors. This could vary from user to user due to different gamma settings. Here is a test program to find your reference colors.
Code:
;;;;;Program to find your reference colors
;
;Select a hero and no other units. Mouse over the hero portrait in the upper
;left so a tooltip appears in the lower right. Press u. Alt-Tab out,
;press Shift u, and write down the values. Replace 0x5FFAFF with color 1
;and replace 0x238AAC with color 2
u::
PixelGetColor, color1, 409, 679
PixelGetColor, color2, 745, 540
return
+u::
MsgBox Color1 is: %color1%, Color2 is: %color2%
return
I'm thinking that using pixels will open up a brand new level of warcraft scripts. The quick burrow/hide ( /run home?) script, for example, could be comibined into one hotkey by looking at what type of unit was selected. I'm working on a "AMS everyone" script, and using pixels will be vital to know who is already AMS'ed.