AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Warcraft III - Healthbars always on and use tgbyhn for inv
Goto page Previous  1, 2, 3, 4, 5
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
POINTS not logged in
Guest





PostPosted: Tue Oct 17, 2006 7:09 pm    Post subject: Using an escape char Reply with quote

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
Back to top
Dre773
Guest





PostPosted: Fri Nov 03, 2006 8:06 pm    Post subject: Help! healthbar script and mousemove script not compatible. Reply with quote

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, Laughing


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?
Back to top
Player1
Guest





PostPosted: Fri Nov 23, 2007 5:23 pm    Post subject: Reply with quote

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.
Back to top
The Shape



Joined: 06 Dec 2007
Posts: 1

PostPosted: Thu Dec 06, 2007 1:51 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Tommten
Guest





PostPosted: Sat Dec 08, 2007 11:15 pm    Post subject: Reply with quote

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? Smile

Is this possible?
Thanks for this ownage freeware!
Back to top
F4c2a



Joined: 10 Oct 2008
Posts: 2

PostPosted: Fri Oct 10, 2008 7:28 pm    Post subject: Reply with quote

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? Smile

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5
Page 5 of 5

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group