AutoHotkey Community

It is currently May 26th, 2012, 5:35 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 70 posts ]  Go to page Previous  1, 2, 3, 4, 5
Author Message
 Post subject: Using an escape char
PostPosted: October 17th, 2006, 8:09 pm 
You can use the ` char to indicate that you want to use the actual key instead of what AutoHotkey would interpret it to be. Try using this code:

Code:
Send, {`^ Down}


If you could let me know if this works, I'll change it in Warkeys. (Not that it seems to matter since it works the other way...)

The escape char is explained here: http://www.autohotkey.com/docs/Scripts.htm#esc


Report this post
Top
  
Reply with quote  
PostPosted: November 3rd, 2006, 9:06 pm 
Reposted b/c full text not viewable.

So I'm trying to use the healthbar script that POINTS [thanks] created (with some hotkey customixation for my needs) with the mousemove code from jtbalogh. They're not functioning together and I'm not sure why.

Here's the code for the healthbars, hotkeys, etc.

Code:
#SingleInstance force      ;force a single instance
#HotkeyInterval 0      ;disable the warning dialog if a key is held down
#InstallKeybdHook      ;Forces the unconditional installation of the keyboard hook
#UseHook On         ;might increase responsiveness of hotkeys
#MaxThreads 20         ;use 20 (the max) instead of 10 threads
SetBatchLines, -1      ;makes the script run at max speed
SetKeyDelay , -1, -1      ;faster response (might be better with -1, 0)
;Thread, Interrupt , -1, -1   ;not sure what this does, could be bad for timers

;;;;; Make the icon the TFT icon (Author: NiJo?) ;;;;; 
regread, war, HKEY_CURRENT_USER, Software\Blizzard Entertainment\Warcraft III, ProgramX
menu, tray, Icon, %War%, 1, 1

;;;;; Variables ;;;;;
InChatRoomOn := False
HealthBarOn := False
FollowOn := False

;;;;; Timers ;;;;;
;; this timer checks to see if warcraft is active and turns on the health bars
settimer, timer_Warcraft, 1000 ;check every 1 second
timer_Warcraft:
{
  ifWinActive, Warcraft III
  {
    if (HealthBarOn == False)
    {
      Send, {[ Down}
      Send, {] Down}
      HealthBarOn := True
    }
  }

  else ifWinNotActive, Warcraft III
  {
    ;; turn off stuff
    if (HealthBarOn == True)
    {
      Send, {[ Up}
      Send, {] Up}
      HealthBarOn := False
    }

    ;; same for scrollLock
    if (FollowOn == True)
    {
      Send, {LButton Up}
      FollowOn := False
    }
  }
}

OnExit, ExitSub
return

ExitSub:
ExitApp ;The only way for an OnExit script to terminate itself is to use ExitApp


;;;;; Hotkeys ;;;;;
#ifWinActive, Warcraft III ;*new to ver 1.0.41.00* only run when war3 is running

;;;;; Enable/disable all hotkeys ;;;;;
;; For some reason the *~ commands do not work with warcraft
*Enter::
Suspend, Permit
Send, {Blind}{Enter}
if (InChatRoomOn == True)
  return
Suspend
if (A_IsSuspended == 1)
  SoundPlay,*64
else
  SoundPlay,*48
return

;; use numpadenter to turn off hotkeys if we press esc or some how mess it up
*NumpadEnter::
Suspend, Permit
Send, {Blind}{NumpadEnter}
Suspend, Off
SoundPlay,*48
return

;;;; Scroll Lock to toggle follow mode (useful in replays) ;;;;;
*ScrollLock::
Send, {Blind}{ScrollLock} ; toggle the light
if FollowOn
  Send, {LButton Up}
else
  Send, {LButton Down}
FollowOn := not FollowOn
return

Escape:: ; end message
Suspend, Permit ; disable all hotkeys, except this one and other permitted ones
Send, {Escape}
Suspend, off
if (A_IsSuspended == 0) ; notify done (0=off, 1=on)
  SoundPlay,*64
return

*Pause::
Suspend, Permit
if (InChatRoomOn == False)
{
  Suspend, On
  InChatRoomOn := True
  SoundPlay,*64
}
else
{
  Suspend, Off
  InChatRoomOn := False
  SoundPlay,*48
}
return

;;;;; Use 1 to toggle health on/off ;;;;;
;; the health bars are automatic now and cannot be turned off
;; however if for some reason they get turned off, pressing caps will turn it on
*1::
if (HealthBarOn == False)
{
  Send, {[ Down}
  Send, {] Down}
  HealthBarOn := True
}
else
{
  Send, {[ Up}
  Send, {] Up}
  HealthBarOn := False
}
return

;;;;; Use CapsTabShifttgb instead of KEYPAD for inventory ;;;;;
Tab::Send {Numpad7}
CapsLock::Send {Numpad4}
`::Send {Numpad1}
t::Send {Numpad8}
g::Send {Numpad5}
b::Send {Numpad2}

;;;;; Use Middle Mouse Button or 5 instead of F1 to select hero ;;;;;
5::Send {F1}
MButton::Send {F1}

;;;; use Wheel for tab and LeftControl to add units to a group;;;;;
*WheelUp::send, +{Tab}
*WheelDown::Send {Tab}



And here is the mousemove code, which only ran for me after deleting the "XButton1:: alternative, if available" and "XButton1 up:: alternative, if available" lines. By itself or running as a separate script this works great.

The problem is that if I run them simultaneously as two separate scripts I have no space bar in the message prompt. Apaintoread, :lol:


Code:
;------------------------------
; Mousemove
;------------------------------
BackupX := 0
BackupY := 0
TrackMapPan := False
TrackRadius := floor(A_ScreenWidth / 50) ; small distance mouse travels before moving map
;TrackSpeed := ... not possible since scroll speed is in gameplay options

;------------------------------
; Restore mouse position when moving map
;------------------------------
timer_map_pan:
{
  ifWinActive, Warcraft III
  {
    ;BlockInput ; not needed
    Coordmode, Mouse, Screen ; mouse-coordinates are related to the whole screen
    if (TrackMapPan == True) {
      MouseGetPos, X, Y, , , 1
      tempx := X
      tempy := Y
      tempxradius := X - BackupX
      tempyradius := Y - BackupY
      if (tempxradius > TrackRadius) {
        Send, {blind}{Left up}
        Send, {blind}{Right down}
        tempx := BackupX +TrackRadius
      } else if (tempxradius < -TrackRadius) {
        Send, {blind}{Right up}
        Send, {blind}{Left down}
        tempx := BackupX -TrackRadius
      } else {
        Send, {blind}{Right up}
        Send, {blind}{Left up}
      }
      if (tempyradius > TrackRadius) {
        Send, {blind}{Up up}
        Send, {blind}{Down down}
        tempy := BackupY +TrackRadius
      } else if (tempyradius < -TrackRadius) {
        Send, {blind}{Down up}
        Send, {blind}{Up down}
        tempy := BackupY -TrackRadius
      } else {
        Send, {blind}{Down up}
        Send, {blind}{Up up}
      }
      MouseMove, tempx, tempy, 0 ; restore mouse cursor position
    }
  }
}
OnExit, ExitSub
return

ExitSub:
ExitApp ;The only way for an OnExit script to terminate itself is to use ExitApp

;------------------------------
^Space::Space ; Ctrl-Space replaces Space to center on events.
;^Space up::Space up ; does not work, so use code in *Space up::

;------------------------------
Space::
if (TrackMapPan == False) { ; first call, since holding key repeats script continuously
  BackupX := A_ScreenWidth / 2
  BackupY := A_ScreenHeight / 2
  MouseMove, BackupX, BackupY, 0 ; center on screen for easy viewing
  ;MouseGetPos, BackupX, BackupY, , , 1 ; already determined
  TrackMapPan := True
  SetTimer, timer_map_pan, 0
}
return

;------------------------------
Space up::
SetTimer, timer_map_pan, Off
;MouseMove, BackupX, BackupY, 0 ; leave mouse as is
Send, {blind}{Right up} ; not needed anymore
Send, {blind}{Left up}
Send, {blind}{Down up}
Send, {blind}{Up up}
TrackMapPan := False
Send, {Space up}
Send, {XButton up}
return




When I drop the mousemove code into the healthbars script (after deleting the extra ExitSub lines to avoid an error) the spacebar works in the message prompt but when pressed in the game just scrolls the map quickly down and right.
Any ideas? I'm sure there's something I'm missing, I'm a bit new to this.

Thanks, Dre.

PS- POINTS, warkeys is great. Thanks for your efforts there and here.
PPS-Far less important, how can I modify the suspend/permit sounds? Or turn them off?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2007, 6:23 pm 
Very useful stuff, but keep in mind that scripts aren't allowed in most of the competitions. Ones you get use to a script it will be really hard to get back to default keys and commands.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 6th, 2007, 2:51 pm 
Offline

Joined: December 6th, 2007, 2:44 pm
Posts: 1
Hi, I want to change the icon into another one using the same code. However I'm a noob with ahk and would like to ask how can I find where the icon is?
For example in this case:

;;;;; Make the icon the TFT icon (Author: NiJo?) ;;;;;
regread, war, HKEY_CURRENT_USER, Software\Blizzard Entertainment\Warcraft III, ProgramX
menu, tray, Icon, %War%, 1, 1

how do I find out about the "menu, tray, Icon, %War%, 1, 1" line?

ty in advance

_________________
u phail 2 amuse meh


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 9th, 2007, 12:15 am 
Hi!
I just found this and tried it. Its great!
Only thing I had to do was change health bar to å and ´ buttons (swedish)
I would like to know a few things though.
I use Q W E R as my main spell and ability keys with heros now.
If I click the hotkey Q and on a creep, and the ability on Q button was not loaded it selects the crep instead.

What I want is this to happend when did that misstake:
When I press Q again, I want it to press F1 to select my hero and press Q on the hero. Add a F1 before the Q W E R buttons might do it? :)

Is this possible?
Thanks for this ownage freeware!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 10th, 2008, 8:28 pm 
Offline

Joined: October 10th, 2008, 8:22 pm
Posts: 2
Tommten wrote:
Hi!
I just found this and tried it. Its great!
Only thing I had to do was change health bar to å and ´ buttons (swedish)
I would like to know a few things though.
I use Q W E R as my main spell and ability keys with heros now.
If I click the hotkey Q and on a creep, and the ability on Q button was not loaded it selects the crep instead.

What I want is this to happend when did that misstake:
When I press Q again, I want it to press F1 to select my hero and press Q on the hero. Add a F1 before the Q W E R buttons might do it? :)

Is this possible?
Thanks for this ownage freeware!


Hi there Tommten, listen you wouldn't wanna toss me that code of yours where you get it to work with å and ´ buttons, since I've been trying to add ´ to the script for like a million times now but it just won't work - å (enemies' health) works just fine.

_________________
If you see pie, it's already pie.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 22nd, 2009, 12:20 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
This thread is pretty old, but since it was just brought to the top I feel that I should point out that one of the updates to Warcraft implemented a checkbox in the gameplay options to turn on health bars at all times, so that part of the script is pretty obsolete.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 29th, 2010, 1:54 pm 
POINTS wrote:
Although we can modify some of the keys of Warcraft III using the customkeys.txt, it leaves much to be desired.

From the ideas of this thread at wcreplays:
http://www.wcreplays.com/forums/archive/index.php/t-18200.html
I compiled a script that basically keeps the healthbars on all the time as well as use tgbyhn for the inventory (instead of the numpad).

You can download the compiled program here:
http://www.autohotkey.net/~POINTS/war3.exe

And the source code here:
http://www.autohotkey.net/~POINTS/war3.ahk

The code does these things:
Automatically turns on Healthbars when the warcraft III window is active
Automatically disables hotkeys when warcraft III is inactive

Uses tgbyhn instead of KEYPAD for inventory
Uses TAB like CTRL to set Control Groups
Uses Wheel like tab (to change active members of group)

Capslock: Resets healthbars if they get turned off
Pause: freezes the script (ie for chat room chatting)
ScrollLock: holds down the left mouse button to follow (if you put the cursor over the heros picture for example you can then follow the hero, I use this in replays because I dislike the auto camera)

Code:
#SingleInstance force      ;force a single instance
#HotkeyInterval 0      ;disable the warning dialog if a key is held down
#InstallKeybdHook      ;Forces the unconditional installation of the keyboard hook
#UseHook On         ;might increase responsiveness of hotkeys
#MaxThreads 20         ;use 20 (the max) instead of 10 threads
SetBatchLines, -1      ;makes the script run at max speed
SetKeyDelay , -1, -1      ;faster response (might be better with -1, 0)
;Thread, Interrupt , -1, -1   ;not sure what this does, could be bad for timers

;;;;; Make the icon the TFT icon (Author: NiJo?) ;;;;; 
regread, war, HKEY_CURRENT_USER, Software\Blizzard Entertainment\Warcraft III, ProgramX
menu, tray, Icon, %War%, 1, 1

;;;;; Variables ;;;;;
InChatRoomOn := False
HealthBarOn := False
FollowOn := False

;;;;; Timers ;;;;;
;; this timer checks to see if warcraft is active and turns on the health bars
settimer, timer_Warcraft, 1000 ;check every 1 second
timer_Warcraft:
{
  ifWinActive, Warcraft III
  {
    if (HealthBarOn == False)
    {
      Send, {[ Down}
      Send, {] Down}
      HealthBarOn := True
    }
  }

  else ifWinNotActive, Warcraft III
  {
    ;; turn off stuff
    if (HealthBarOn == True)
    {
      Send, {[ Up}
      Send, {] Up}
      HealthBarOn := False
    }

    ;; same for scrollLock
    if (FollowOn == True)
    {
      Send, {LButton Up}
      FollowOn := False
    }
  }
}

OnExit, ExitSub
return

ExitSub:
ExitApp ;The only way for an OnExit script to terminate itself is to use ExitApp


;;;;; Hotkeys ;;;;;
#ifWinActive, Warcraft III ;*new to ver 1.0.41.00* only run when war3 is running

;;;;; Enable/disable all hotkeys ;;;;;
;; For some reason the *~ commands do not work with warcraft
*Enter::
Suspend, Permit
Send, {Blind}{Enter}
if (InChatRoomOn == True)
  return
Suspend
if (A_IsSuspended == 1)
  SoundPlay,*64
else
  SoundPlay,*48
return

;; use numpadenter to turn off hotkeys if we press esc or some how mess it up
*NumpadEnter::
Suspend, Permit
Send, {Blind}{NumpadEnter}
Suspend, Off
SoundPlay,*48
return

;;;; Scroll Lock to toggle follow mode (useful in replays) ;;;;;
*ScrollLock::
Send, {Blind}{ScrollLock} ; toggle the light
if FollowOn
  Send, {LButton Up}
else
  Send, {LButton Down}
FollowOn := not FollowOn
return

*Pause::
Suspend, Permit
if (InChatRoomOn == False)
{
  Suspend, On
  InChatRoomOn := True
  SoundPlay,*64
}
else
{
  Suspend, Off
  InChatRoomOn := False
  SoundPlay,*48
}
return

;;;;; Use CAPSLOCK to toggle health on/off ;;;;;
;; the health bars are automatic now and cannot be turned off
;; however if for some reason they get turned off, pressing caps will turn it on
*Capslock::
if (HealthBarOn == False)
{
  Send, {[ Down}
  Send, {] Down}
  HealthBarOn := True
}
else
{
  Send, {[ Up}
  Send, {] Up}
  HealthBarOn := False
}
return

;; the send command allows us to hold down a key and it will repeat
;; useful for casting spells (ie summons) and tp-ing asap
t::Send t
+t::Send T
y::Send y
+y::Send Y
u::Send u
+u::Send U
i::Send i
+i::Send I

g::Send g
+G::Send G
h::Send h
+h::Send H
j::Send j
+j::Send J
k::Send k
+k::Send K

b::Send b
+b::Send B
n::Send n
+n::Send N
m::Send m
+m::Send M
,::Send ,
+,::Send <


;;;;; Use tgbyhn instead of KEYPAD for inventory ;;;;;
q::Send, {Numpad7}
a::Send, {Numpad4}
z::Send, {Numpad1}
w::Send, {Numpad8}
s::Send, {Numpad5}
x::Send, {Numpad2}

+q::Send, +{Numpad7}
+a::Send, +{Numpad4}
+z::Send, +{Numpad1}
+w::Send, +{Numpad8}
+s::Send, +{Numpad5}
+x::Send, +{Numpad2}


;;;;; Use TAB like CTRL to set Control Groups ;;;;;
~Tab & 1::Send, ^1
~Tab & 2::Send, ^2
~Tab & 3::Send, ^3
~Tab & 4::Send, ^4
~Tab & 5::Send, ^5
~Tab & 6::Send, ^6
~Tab & 7::Send, ^7
~Tab & 8::Send, ^8
~Tab & 9::Send, ^9
~Tab & 0::Send, ^0


;;;; use Wheel for tab ;;;;;
*WheelUp::send, {Tab}
*WheelDown::Send +{Tab}


Related Topic: Warkeys
http://www.autohotkey.com/forum/viewtopic.php?p=46507


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 31st, 2010, 2:32 am 
Offline

Joined: December 31st, 2010, 2:00 am
Posts: 2
POINTS wrote:
Quote:
Wow. Using Shift-WASD to move and Shift-mouseclick to set waypoints is really easy. Never thought of that.


Yeah this is going to be great! I hate using the arrow keys or mousing over to the edge the of screen.

I think your code here will be best since it doesn't use the send command
Code:
+w::Up ; works
+a::Left
+s::Down
+d::Right



Also, be careful of making alt a sticky key! You don't want to alt-q-q yourself to a gg!



Im newbie
Where I have to put that code?
thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 31st, 2010, 2:53 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
@dber: Stop spamming the same question. I have already answered you.

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 70 posts ]  Go to page Previous  1, 2, 3, 4, 5

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Google Feedfetcher, XX0, Yahoo [Bot] and 14 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group