Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Alt allways pressed - Warcraft version


  • Please log in to reply
6 replies to this topic
NiJo
  • Members
  • 73 posts
  • Last active: Jul 17 2007 11:51 AM
  • Joined: 12 Nov 2005
Ever hated warcraft for not having an option to allways see the life of your enemys? Here is that patch :p

A simple code that keeps the alt-key down, unless you press a key.

Press Alt GR for activating (or lctrl + ralt) , lalt for deactivating

Here is an already compiled version of the script with the FrozenThron Icon:
Frozen Throne Alt

Here is the code: Edited 3 Times.

onexit exit

#InstallKeybdHook 
#usehook on
#MaxThreads 20
#SingleInstance
SetBatchLines, -1
SetKeyDelay , -1, 0
Thread, NoTimers
Thread, Interrupt , -1, -1

regread, war, HKEY_CURRENT_USER, Software\Blizzard Entertainment\Warcraft III, ProgramX
menu, tray, Icon, %War%, 1, 1

run, %War%,,, pid
process, wait, %pid%
process, waitclose, %pid%
process, wait, war3.exe
sleep, 10000
process, exist, war3.exe
war3_pid:=errorlevel
settimer, timer_Warcraft, 1500
return

timer_Warcraft:
process, exist, %war3_pid%
if !errorlevel
exitapp

ifWinActive, Warcraft III
   Suspend, Off
else
   Suspend, On
return


!a::send, {alt up}{a}{alt down}
!b::send, {alt up}{b}{alt down}
!c::send, {alt up}{c}{alt down}
!d::send, {alt up}{d}{alt down}
!e::send, {alt up}{e}{alt down}
!f::send, {alt up}{f}{alt down}
!g::send, {alt up}{g}{alt down}
!h::send, {alt up}{h}{alt down}
!i::send, {alt up}{i}{alt down}
!j::send, {alt up}{j}{alt down}
!k::send, {alt up}{k}{alt down}
!l::send, {alt up}{l}{alt down}
!m::send, {alt up}{m}{alt down}
!n::send, {alt up}{n}{alt down}
!o::send, {alt up}{o}{alt down}
!p::send, {alt up}{p}{alt down}
!q::send, {alt up}{q}{alt down}
!r::send, {alt up}{r}{alt down}
!s::send, {alt up}{s}{alt down}
!t::send, {alt up}{t}{alt down}
!u::send, {alt up}{u}{alt down}
!v::send, {alt up}{v}{alt down}
!w::send, {alt up}{w}{alt down}
!x::send, {alt up}{x}{alt down}
!y::send, {alt up}{y}{alt down}
!z::send, {alt up}{z}{alt down}

!.::send, {alt up}{.}{alt down}
!,::send, {alt up}{,}{alt down}
!-::send, {alt up}{-}{alt down}
!<::send, {alt up}{<}{alt down}
!\::send, {alt up}{\}{alt down}
!+::send, {alt up}{+}{alt down}

!1::send, {alt up}{1}{alt down}
!2::send, {alt up}{2}{alt down}
!3::send, {alt up}{3}{alt down}
!4::send, {alt up}{4}{alt down}
!5::send, {alt up}{5}{alt down}
!6::send, {alt up}{6}{alt down}
!7::send, {alt up}{7}{alt down}
!8::send, {alt up}{8}{alt down}
!9::send, {alt up}{9}{alt down}
!0::send, {alt up}{0}{alt down}

!F1::send, {alt up}{F1}{alt down}
!F2::send, {alt up}{F2}{alt down}
!F3::send, {alt up}{F3}{alt down}

!F4::
GetKeyState, lal, lalt, P
if lal=U
{
send {alt up}{F4 down}
keywait F4
send {F4 up}{alt down}
}
else
send {alt down}{F4}
return

!F5::send, {alt up}{F5}{alt down}
!F6::send, {alt up}{F6}{alt down}
!F7::send, {alt up}{F7}{alt down}
!F8::send, {alt up}{F8}{alt down}
!F9::send, {alt up}{F9}{alt down}
!F10::send, {alt up}{F10}{alt down}
!F11::send, {alt up}{F11}{alt down}
!F12::send, {alt up}{F12}{alt down}

!Numpad1::send, {alt up}{Numpad1}{alt down}
!Numpad2::send, {alt up}{Numpad2}{alt down}
!Numpad3::send, {alt up}{Numpad3}{alt down}
!Numpad4::send, {alt up}{Numpad4}{alt down}
!Numpad5::send, {alt up}{Numpad5}{alt down}
!Numpad6::send, {alt up}{Numpad6}{alt down}
!Numpad7::send, {alt up}{Numpad7}{alt down}
!Numpad8::send, {alt up}{Numpad8}{alt down}
!Numpad9::send, {alt up}{Numpad9}{alt down}
!Numpad0::send, {alt up}{Numpad0}{alt down}

!Numpadenter::
send, {alt up}{Numpadenter down}
keywait enter
send {Numpadenter up}{alt down}
return

!Numpadadd::send, {alt up}{Numpadadd}{alt down}
!Numpadsub::send, {alt up}{Numpadsub}{alt down}
!Numpaddot::send, {alt up}{Numpaddot}{alt down}


!lbutton::
GetKeyState, lal, lalt, P
if lal=U
{
send {alt up}{lbutton down}
keywait lbutton
send {lbutton up}{alt down}
}
else
send {alt down}{lbutton}
return

!rbutton::
send {alt up}{rbutton down}
keywait rbutton
send {rbutton up}{alt down}
return

!mbutton::
send {alt up}{mbutton down}
keywait mbutton
send {mbutton up}{alt down}
return

!xbutton1::
send {alt up}{xbutton1 down}
keywait xbutton1
send {xbutton1 up}{alt down}
return

!xbutton2::
send, {alt up}{xbutton2 down}
keywait xbutton2
send {xbutton2 up}{alt down}
return


!enter::
suspend, on
send, {alt up}{enter}
return

enter::
suspend, off
send, {enter}{alt down}
return


!shift::
send, {alt up}{shift down}
keywait shift
send {shift up}{alt down}
return

!ctrl::
send, {alt up}{ctrl down}
keywait ctrl
send {ctrl up}{alt down}
return

!del::
send, {alt up}{del}
keywait del
send {alt down}
return

!bs::
send, {alt up}{bs down}
keywait bs
send {bs up}{alt down}
return

!esc::
send, {alt up}{esc down}
keywait esc
send {esc up}{alt down}
return

!space::
send, {alt up}{space down}
keywait space
send {space up}{alt down}
return

!tab::
GetKeyState, lal, lalt, P
if lal=U
{
send {alt up}{tab down}
keywait tab
send {tab up}{alt down}
}
else
send {alt down}{tab}
return


!up::
send, {alt up}{up down}
keywait up
send {up up}{alt down}
return

!down::
send, {alt up}{down down}
keywait down
send {down up}{alt down}
return

!left::
send, {alt up}{left down}
keywait left
send {left up}{alt down}
return

!right::
send, {alt up}{right down}
keywait right
send {right up}{alt down}
return


lctrl & ralt::
Suspend , off
keywait ralt
send {alt down}
return


exit:
send {alt up}
exitapp
return

This way it works. I think this don't consume too much PC resources, do this, coders?

NiJo
  • Members
  • 73 posts
  • Last active: Jul 17 2007 11:51 AM
  • Joined: 12 Nov 2005
I have modified this again.
I think this time is working correctly. Tried a few times.

Anyone had bugs?

What more extra keys combo you think I should include?
like: ALT+TAB, ALT+F4, SHIFT+"letter"...

POINTS
  • Members
  • 290 posts
  • Last active: Oct 13 2010 02:12 AM
  • Joined: 17 Jan 2006
in warcraft pressing the bracket keys [] is the same as holding down alt

you can just use these lines to accomplish the same task:

;;;;; Use CAPSLOCK to toggle health on/off ;;;;;
*Capslock::
Sleep, 100
Send, {[ Down}
Send, {] Down}
Loop
{
GetKeyState, state, Capslock, P
if state = D
break
Sleep, 50
}
Send, {[ Up}
Send, {] Up}
return

There is a really good thread on this here on WCReplays:
http://wcreplays.com...ead.php?t=18200
text only:
http://www.wcreplays...hp/t-18200.html

POINTS
  • Members
  • 290 posts
  • Last active: Oct 13 2010 02:12 AM
  • Joined: 17 Jan 2006
here's an even better way:

;;;;; Use CAPSLOCK to toggle health on/off ;;;;;

CapsLockOn := False

*Capslock::
if (CapsLockOn == False)
{
	Send, {[ Down}
	Send, {] Down}
	CapsLockOn := True
}
else
{
	Send, {[ Up}
	Send, {] Up}
	CapsLockOn := False
}
return


POINTS
  • Members
  • 290 posts
  • Last active: Oct 13 2010 02:12 AM
  • Joined: 17 Jan 2006
Just thought I'd post my whole script.
I added some of your stuff Nijo, the icon thing is hella cool.
This is a simplified version of my script but I think it'll still work.

#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 ;;;;;
ChatOn := 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 ever 1 second
timer_Warcraft:
{
  ifWinActive, Warcraft III
  {
    if (HealthBarOn == False)
    {
      Send, {[ Down}
      Send, {] Down}
      HealthBarOn := True
      Send, ^!{Home} ;pause/unpause winamp
    }
  }

  else ifWinNotActive, Warcraft III
  {
    ;; turn off stuff
    if (HealthBarOn == True)
    {
      Send, {[ Up}
      Send, {] Up}
      HealthBarOn := False
      Send, ^!{Home} ;pause/unpause winamp
    }

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

;;;;; 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, {Enter}
Gosub, EnterSub
return

+Enter::
Suspend, Permit
Send, +{Enter}
Gosub, EnterSub
return

^Enter::
Suspend, Permit
Send, ^{Enter}
Gosub, EnterSub
return

!Enter::
Suspend, Permit
Send, !{Enter}
Gosub, EnterSub
return

EnterSub:
if (ChatOn == False)
{
	Suspend, On
	ChatOn := True
	SoundPlay,*64
}
else
{
	Suspend, Off
	ChatOn := False
	SoundPlay,*48
}
return

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

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

;;;;; Use CAPSLOCK to toggle health on/off ;;;;;
;; the health bars are automatic now and cannot be turned off
;; however if for some reason the 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

;;;;; Dvorak to qwerty ;;;;;
;; the send command allows us to hold down a key and it will repeat
;; useful for casting spells (ie summons) and tping asap
q::Send q
+q::Send Q
w::Send w
+w::Send W
e::Send e
+e::Send E
r::Send r
+r::Send R

a::Send a
+a::Send A
s::Send s
+s::Send S
d::Send d
+d::Send D
f::Send f
+f::Send F

z::Send z
+z::Send Z
x::Send x
+x::Send X
c::Send c
+c::Send C
v::Send v
+v::Send V


;;;;; Use tgbyhn instead of KEYPAD for inventory ;;;;;
t::Send, {Numpad7}
g::Send, {Numpad4}
b::Send, {Numpad1}
y::Send, {Numpad8}
h::Send, {Numpad5}
n::Send, {Numpad2}

+t::Send, +{Numpad7}
+g::Send, +{Numpad4}
+b::Send, +{Numpad1}
+y::Send, +{Numpad8}
+h::Send, +{Numpad5}
+n::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}



POINTS
  • Members
  • 290 posts
  • Last active: Oct 13 2010 02:12 AM
  • Joined: 17 Jan 2006
I posted my script (again!)
http://www.autohotke...pic.php?p=46508

Hopefully we can get more support there.

toralf
  • Moderators
  • 4035 posts
  • Last active: Aug 20 2014 04:23 PM
  • Joined: 31 Jan 2005
Could you please remove double postings? Thanks.
Ciao
toralf
 
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.