 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
jamestr
Joined: 05 Apr 2004 Posts: 96 Location: Connecticut USA
|
Posted: Wed Apr 07, 2004 5:04 am Post subject: warcraft 3 script |
|
|
this is a generic strategy game script, though the map rotation is specific to warcraft 3.
| Code: | #MaxThreads 20
#MaxThreadsPerHotkey 4
#HotkeyInterval 1000 ; default 2000
#MaxHotkeysPerInterval 250 ; default 50
;RWIN::return ; null rwin
space & lbutton:: ;left click and move cursor over minimap
sleep 200
MouseClick, left, , , 1, 0,
mousemove, 100, 520
return
space & rbutton:: ;right click and move cursor over toolbar sleep 200
;;send {SHIFTUP}
MouseClick, left, , , 1, 0,
mousemove, 700, 520
return
!q::suspend ;;;; Alt-q suspend
space::Send {space} ; non-repeating space
;; bottow row zxcvb
space & z::send, !eu ; equals alt-e-u (undo)
;space & x::send ^x
;space & c::send ^c
;space & v::send ^v
;space & b::send ^b
;; middle row asdfg
a::mousemove, 100, 520
space & a::mousemove, 100, 520
;space & s::send ^a
;space & d::send ^a
;space & f::send ^a
space & g::mousemove, 700, 520
g::mousemove, 700, 520
;; top row qwerty
;space & q::send ^q
;space & w::send ^w
;space & e::mousemove, 400, 320
;space & r::send ^r
;space & t::send ^t
;space & y::mousemove, 750, 550
y::mousemove, 350, 350
;; numerics 123456
1 & space::send, 1 ; non repeating 1
1:: ; select hero,
send, 1
sleep 150
send, t ; activate spell
return
space & 1::send ^1 ;add units to group 1
space & 2:: ;add units to group 2
send ^2;
sleep 200
mousemove, 100, 520
return
;;space & 2::send ^2
space & 3::send ^3
space & 4::send ^4
space & 5::send ^5
space & 6::send ^6
r:: ; logically press L to rotate map (del key)
GetKeyState, statew, del, L
if statew = u
send, {ins up}
Send, {del down}
if statew = d
send, {del up}
return
w:: ; logically press w to rotate map (ins key)
GetKeyState, statew, ins, L
if statew = u
send, {del up}
Send, {ins down}
if statew = d
send, {ins up}
return
space & p:: ;;;; runs notepad
Run, Notepad
Sleep, 1000
Send, {enter}Oh do behave {! 10}
return
;;space & s::
;; below moves cursor to screen edges using esdf (or change to wasd)
s::
;sleep, 100
MouseGetPos, xpos, ypos
MouseMove, 0, 450
Loop
{
GetKeyState, state, s, P
if state = U
{
; MouseMove, %xpos%, %ypos% ,1
mousemove 400, 350
break
}
}
return
f::
MouseGetPos, xpos, ypos
MouseMove, 1100, 500
Loop
{
GetKeyState, state, f, P
if state = U
{
; MouseMove, %xpos%, %ypos% ,1
mousemove 400, 350
break
}
}
return
e::
;sleep, 100
MouseGetPos, xpos, ypos
MouseMove, 400, 00
Loop
{
GetKeyState, state, e, P
if state = U
{
; MouseMove, %xpos%, %ypos% ,1
mousemove 400, 250
break
}
}
return
d::
MouseGetPos, xpos, ypos
MouseMove, 400, 800
Loop
{
GetKeyState, state, d, P
if state = U
{
; MouseMove, %xpos%, %ypos% ,1
mousemove 400, 350
break
}
}
return |
|
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Wed Apr 07, 2004 11:51 am Post subject: |
|
|
Well, you've certainly made great use of the spacebar in that one. I also notice that you've taken advantage of the fact that custom hotkeys can be inverted to form a different hotkey. For example, "space & 1" is different than "1 & space".
If the script doesn't perform exactly the way you want it -- such as MouseGetPos getting messed up when you press two MouseMove keys simultaneously (as you mentioned in your other topic) -- let me know because I think I have some solutions. |
|
| Back to top |
|
 |
jamestr
Joined: 05 Apr 2004 Posts: 96 Location: Connecticut USA
|
Posted: Thu Apr 08, 2004 5:26 pm Post subject: |
|
|
well, after some strategy game testing I think the script works well, the way it is.
but sure, it would be nice if i knew how to code it so;
"MouseGetPos, xpos, ypos "
retained the mouse location that existed, before i had pressed the 2 mousemove keys.
That might be helpful for a roleplaying or action style game.
by the way,
autohotkey is an AMAZING hotkey program!
Incredibly flexible hotkey configurations!! |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Apr 08, 2004 10:54 pm Post subject: |
|
|
I'm glad you like AHK.
For your script, you could change it so that the MouseGetPos fetches into temporary variables. Then check if those variables contain coordinates that are too close to the coordinates you move to with your other keys. If so, do not update your master variables, let them retain their previous values (which hopefully contain the starting coordinates). |
|
| 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
|