• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 09:22
CET 15:22
KST 23:22
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
ComeBackTV's documentary on Byun's Career !3Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win3Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15
StarCraft 2
General
Did they add GM to 2v2? Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win ComeBackTV's documentary on Byun's Career ! RSL Revival - 2025 Season Finals Preview Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump
Tourneys
RSL Offline Finals Info - Dec 13 and 14! Master Swan Open (Global Bronze-Master 2) Winter Warp Gate Amateur Showdown #1: Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle How Rain Became ProGamer in Just 3 Months BGH Auto Balance -> http://bghmmr.eu/ [BSL21] RO8 Bracket & Prediction Contest BW General Discussion
Tourneys
[Megathread] Daily Proleagues [BSL21] WB SEMIFINALS - Saturday 21:00 CET [BSL21] RO8 - Day 2 - Sunday 21:00 CET [ASL20] Grand Finals
Strategy
Game Theory for Starcraft Current Meta Simple Questions, Simple Answers Fighting Spirit mining rates
Other Games
General Games
Stormgate/Frost Giant Megathread Path of Exile General RTS Discussion Thread Dawn of War IV Nintendo Switch Thread
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI Russo-Ukrainian War Thread YouTube Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
The (Hidden) Drug Problem in…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1513 users

AutoHotkey toggle script for Dota

Blogs > evanthebouncy!
Post a Reply
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2010-07-10 08:45:58
July 10 2010 08:40 GMT
#1
So I have a laptop which doesn't have a number pad, which makes item usage a little bit hard.

I downloaded the autohotkey program that let you write some simple script, what I'm interested in is re-mapping the numPad keys over to normal letter keys.

Now I want to able to toggle the mapping on/off during game, so when I talk I don't talk numbers.

Here's the attempt:


toggleOn = 0
9::
if toggleOn = 1
{
d::Numpad8
g::Numpad5
v::Numpad2
o::Numpad1
toggleOn = 0
}
if toggleOn = 0
{
toggleOn = 1
}


The idea is we map the key "9" into the following expression that does the work. But it doesn't work. Instead I find my keys always mapped T+T

Any help would be great : )

Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
ShadowDrgn
Profile Blog Joined July 2007
United States2497 Posts
Last Edited: 2010-07-10 08:46:59
July 10 2010 08:43 GMT
#2
It's because your second conditional is always true. You're setting toggleOn to 0 and then checking if it's 0, and since it is, it's set to 1.


toggleOn = 0
P::
if toggleOn = 1
{
d::Numpad8
g::Numpad5
v::Numpad2
o::Numpad1
toggleOn = 0
}
else
{
toggleOn = 1
}


I'm not sure this does what you want anyway. I think you need to clear the bindings when you toggle it off...
Of course, you only live one life, and you make all your mistakes, and learn what not to do, and that’s the end of you.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2010-07-10 08:53:18
July 10 2010 08:48 GMT
#3
Ohh, nice catch. Let me try it your way.

I can maybe store the binding in the other numPads, then swap it back in the else, lolol... gimme some time

Apparently the binding is permanent, when I tried to do
d::a
d::b

it says "duplicate hotkey", which probably means you can only assign it once...

Oh well, thx for the catch anyways, I write a lot of
if (pred)
return blahblah

statements, and never occured the ifs can run over each other ha! thanks a lot!
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
ShadowDrgn
Profile Blog Joined July 2007
United States2497 Posts
Last Edited: 2010-07-10 08:57:44
July 10 2010 08:51 GMT
#4

toggleOn = 0
9::
if toggleOn = 0
{
d::Numpad8
g::Numpad5
v::Numpad2
o::Numpad1
toggleOn = 1
}
else
{
Hotkey, *d, off
Hotkey, *g, off
Hotkey, *v, off
Hotkey, *o, off
toggleOn = 0
}


I think that does what you want.
Of course, you only live one life, and you make all your mistakes, and learn what not to do, and that’s the end of you.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2010-07-10 08:58:34
July 10 2010 08:56 GMT
#5
Hmm I tried yours, it says
"Hotkey nonexistent, specifically "d" "
hmmm

Actually, if I just copy/paste your code, "9" does nothing and the binding remains
if I flip the initialization of toggleOn to 0 instead of 1, it gives the above error message

wierd!
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
ShadowDrgn
Profile Blog Joined July 2007
United States2497 Posts
July 10 2010 08:58 GMT
#6
Yeah, I forgot you need asterisks. I tested it and it's really screwy and doesn't work at all haha.
Of course, you only live one life, and you make all your mistakes, and learn what not to do, and that’s the end of you.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
July 10 2010 09:01 GMT
#7
Haha, it's still screwey even if we put the *
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2010-07-10 09:03:56
July 10 2010 09:02 GMT
#8
I think we first assigned Numpad8 to d

then we killed it's de-referenced value with "off"

so d never came back, so I can't type d anymore haha

Also I think it's bad to do
9::

as it binds 9 to something weird, in my case 9 got binded to 8
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
ShadowDrgn
Profile Blog Joined July 2007
United States2497 Posts
July 10 2010 09:04 GMT
#9
Oh, well I just made this really easy.


d::Numpad8
g::Numpad5
v::Numpad2
o::Numpad1
9::Suspend
Of course, you only live one life, and you make all your mistakes, and learn what not to do, and that’s the end of you.
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
July 10 2010 09:06 GMT
#10
using this at the moment, 9 doesn't toggle at all :/

toggleOn = 0

if (GetKeyState("9"))
{
if toggleOn = 0
{
d::Numpad8
g::Numpad5
v::Numpad2
o::Numpad1
toggleOn = 1
}
else
{
Hotkey, *d, off
Hotkey, *g, off
Hotkey, *v, off
Hotkey, *o, off
toggleOn = 0
}
}

Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
Last Edited: 2010-07-10 09:08:13
July 10 2010 09:07 GMT
#11
On July 10 2010 18:04 ShadowDrgn wrote:
Oh, well I just made this really easy.


d::Numpad8
g::Numpad5
v::Numpad2
o::Numpad1
9::Suspend


Yay thx!
syscall ftw

lololol
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
ShadowDrgn
Profile Blog Joined July 2007
United States2497 Posts
July 10 2010 09:09 GMT
#12
I already had AHK help open from when I was working on a script earlier. Good timing.
Of course, you only live one life, and you make all your mistakes, and learn what not to do, and that’s the end of you.
Nuttyguy
Profile Blog Joined March 2010
United Kingdom1526 Posts
July 10 2010 09:49 GMT
#13
http://my.opera.com/ceez/blog/wc3isk
is a program i use its quite good, can map to any key and f8 to start and stop the program and do mouse buttons
Adeny
Profile Blog Joined January 2009
Norway1233 Posts
Last Edited: 2010-07-10 10:15:35
July 10 2010 10:05 GMT
#14
This is a classic. You need to check if the button is being held, or if it has been released. I'm going to mash up something in pseduo-code because I don't know AHK.

I don't know if this is clear so what it's supposed to do is:
When you press the button, it should set the released flag to false. Now, when you release the button again, both has_been_released, and keystate(*button*) should be false, and thus change the state of our "lightswitch" / whatever.

Oh, and you could've posted it here for more replies, I think.
http://www.teamliquid.net/forum/viewmessage.php?topic_id=134491

Edit: Oh, and I forgot to add, but you obviously need a
if(state == 1) { do whatever with hotkeys here }.


var has_been_released = true
var state = 0


for(ever) //insert infinite loop here
{
if (keystate(*button*) == true)
{
has_been_released = false
}
if (keystate(*button*) == false && has_been_released == false)
{
has_been_released = true
if (state == 1)
{
state = 0
}
if (state == 0)
{
state = 1
}
}
}
floor exercise
Profile Blog Joined August 2008
Canada5847 Posts
July 10 2010 11:03 GMT
#15
Why not use this http://warkeys.sourceforge.net/ to change the keys permanently?
evanthebouncy!
Profile Blog Joined June 2006
United States12796 Posts
July 10 2010 11:07 GMT
#16
On July 10 2010 20:03 floor exercise wrote:
Why not use this http://warkeys.sourceforge.net/ to change the keys permanently?


I'm sure there are existing solutions, but it can be fun coding :p
Life is run, it is dance, it is fast, passionate and BAM!, you dance and sing and booze while you can for now is the time and time is mine. Smile and laugh when still can for now is the time and soon you die!
Please log in or register to reply.
Live Events Refresh
WardiTV 2025
13:00
Playoffs
Solar vs CureLIVE!
herO vs Spirit
Scarlett vs Gerald
Rogue vs Shameless
MaNa vs ShoWTimE
Nice vs Creator
WardiTV1051
ComeBackTV 575
TaKeTV 261
IndyStarCraft 145
Rex139
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko469
IndyStarCraft 145
Rex 139
StarCraft: Brood War
Britney 37602
Sea 4435
Horang2 1269
Larva 959
EffOrt 764
GuemChi 595
Mini 585
Soma 496
Stork 404
ZerO 345
[ Show more ]
firebathero 280
Snow 275
PianO 224
Sharp 222
BeSt 165
Hyuk 145
hero 129
Rush 127
Last 116
Hyun 96
Killer 95
JYJ 79
Light 66
Pusan 66
sorry 48
Mind 45
Mong 44
Sea.KH 38
Aegong 31
Movie 26
Terrorterran 24
soO 23
scan(afreeca) 13
Shine 6
Dota 2
Gorgc4790
singsing4729
qojqva2760
Dendi984
syndereN171
XcaliburYe126
League of Legends
C9.Mang0319
rGuardiaN124
Counter-Strike
byalli588
allub159
oskar120
Other Games
B2W.Neo1274
olofmeister871
Beastyqt608
crisheroes358
Hui .279
QueenE75
Mew2King74
Livibee60
Trikslyr28
ZerO(Twitch)13
nookyyy 10
Organizations
StarCraft: Brood War
lovetv 8
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV436
League of Legends
• Nemesis2067
Upcoming Events
WardiTV 2025
20h 38m
ByuN vs TBD
Clem vs TBD
OSC
23h 38m
CranKy Ducklings
1d 19h
WardiTV 2025
1d 20h
SC Evo League
1d 22h
Ladder Legends
2 days
BSL 21
2 days
Sziky vs Dewalt
eOnzErG vs Cross
Sparkling Tuna Cup
2 days
Ladder Legends
3 days
BSL 21
3 days
StRyKeR vs TBD
Bonyth vs TBD
[ Show More ]
Replay Cast
3 days
Wardi Open
3 days
Monday Night Weeklies
4 days
WardiTV Invitational
5 days
Replay Cast
6 days
WardiTV Invitational
6 days
ByuN vs Solar
Clem vs Classic
Cure vs herO
Reynor vs MaxPax
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Offline Finals
Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 1
WardiTV 2025
META Madness #9
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

CSL Season 19: Qualifier 2
CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.