• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 20:27
CET 02:27
KST 10:27
  • 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 Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win2RSL Season 3: RO16 results & RO8 bracket13Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge2[TLMC] Fall/Winter 2025 Ladder Map Rotation14
StarCraft 2
General
When will we find out if there are more tournament Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win SC: Evo Complete - Ranked Ladder OPEN ALPHA Weekly Cups (Nov 10-16): Reynor, Solar lead Zerg surge RSL Season 3: RO16 results & RO8 bracket
Tourneys
Tenacious Turtle Tussle [Alpha Pro Series] Nice vs Cure RSL Revival: Season 3 $5,000+ WardiTV 2025 Championship StarCraft Evolution League (SC Evo Biweekly)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death
Brood War
General
Which season is the best in ASL? [BSL21] Ro.16 Group Stage (C->B->A->D) Data analysis on 70 million replays FlaSh on: Biggest Problem With SnOw's Playstyle soO on: FanTaSy's Potential Return to StarCraft
Tourneys
[Megathread] Daily Proleagues [BSL21] RO16 Tie Breaker - Group B - Sun 21:00 CET [BSL21] GosuLeague T1 Ro16 - Tue & Thu 22:00 CET [BSL21] RO16 Tie Breaker - Group A - Sat 21:00 CET
Strategy
Game Theory for Starcraft How to stay on top of macro? Current Meta PvZ map balance
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Beyond All Reason The Perfect Game Should offensive tower rushing be viable in RTS games?
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
TL Mafia Community Thread Mafia Game Mode Feedback/Ideas
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Artificial Intelligence Thread Things Aren’t Peaceful in Palestine YouTube Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
Thanks for the RSL
Hildegard
The Health Impact of Joining…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2110 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
Tenacious Turtle Tussle
00:00
Biweekly #36
CranKy Ducklings129
davetesta32
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft402
elazer 155
ProTech124
Nina 94
SortOf 47
CosmosSc2 45
StarCraft: Brood War
Calm 5307
Artosis 756
ggaemo 243
Aegong 48
Dota 2
NeuroSwarm8
Counter-Strike
Coldzera 1172
Fnx 301
Super Smash Bros
hungrybox972
Other Games
tarik_tv6867
shahzam674
JimRising 632
Day[9].tv587
C9.Mang0282
ViBE164
WinterStarcraft0
Organizations
Other Games
gamesdonequick617
Dota 2
PGL Dota 2 - Main Stream163
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• HeavenSC 35
• Adnapsc2 3
• intothetv
• sooper7s
• Migwel
• LaughNgamezSOOP
• AfreecaTV YouTube
• IndyKCrew
• Kozan
StarCraft: Brood War
• 80smullet 11
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21348
League of Legends
• Doublelift4459
• Rush311
Other Games
• imaqtpie1304
• Scarra911
• Day9tv587
Upcoming Events
The PondCast
8h 33m
Replay Cast
21h 33m
OSC
1d 15h
LAN Event
1d 16h
Replay Cast
1d 21h
Replay Cast
2 days
WardiTV Korean Royale
2 days
Sparkling Tuna Cup
3 days
WardiTV Korean Royale
3 days
Replay Cast
3 days
[ Show More ]
Wardi Open
4 days
Monday Night Weeklies
4 days
StarCraft2.fi
4 days
Replay Cast
4 days
Wardi Open
5 days
StarCraft2.fi
5 days
Wardi Open
6 days
StarCraft2.fi
6 days
Liquipedia Results

Completed

SOOP Univ League 2025
RSL Revival: Season 3
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
META Madness #9
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
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.