• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 22:03
CEST 04:03
KST 11:03
  • 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
Team TLMC #5: Winners Announced!0[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5TL.net Map Contest #21 - Finalists4Team TLMC #5: Vote to Decide Ladder Maps!0
Community News
5.0.15 Patch Balance Hotfix (2025-10-8)16Weekly Cups (Sept 29-Oct 5): MaxPax triples up3PartinG joins SteamerZone, returns to SC2 competition245.0.15 Balance Patch Notes (Live version)118$2,500 WardiTV TL Map Contest Tournament 152
StarCraft 2
General
5.0.15 Patch Balance Hotfix (2025-10-8) 5.0.15 Balance Patch Notes (Live version) The New Patch Killed Mech! Weekly Cups (Sept 29-Oct 5): MaxPax triples up Team TLMC #5: Winners Announced!
Tourneys
Tenacious Turtle Tussle Sea Duckling Open (Global, Bronze-Diamond) $2,500 WardiTV TL Map Contest Tournament 15 RSL Offline Finals Dates + Ticket Sales! Stellar Fest
Strategy
Custom Maps
External Content
Mutation # 494 Unstable Environment Mutation # 493 Quick Killers Mutation # 492 Get Out More Mutation # 491 Night Drive
Brood War
General
Question regarding recent ASL Bisu vs Larva game [BSL21] - How to Qualify to Each League ? ASL20 General Discussion BW General Discussion RepMastered™: replay sharing and analyzer site
Tourneys
[Megathread] Daily Proleagues [ASL20] Ro8 Day 4 Small VOD Thread 2.0 [ASL20] Ro8 Day 3
Strategy
Current Meta TvZ Theorycraft - Improving on State of the Art Proposed Glossary of Strategic Uncertainty 9 hatch vs 10 hatch vs 12 hatch
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread Dawn of War IV Path of Exile
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
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
SPIRED by.ASL Mafia {211640} TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread UK Politics Mega-thread The Games Industry And ATVI
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
Movie Discussion! Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts The Automated Ban List BarCraft in Tokyo Japan for ASL Season5 Final
Blogs
What your "aura" says about…
Peanutsc
Mental Health In Esports: Wo…
TrAiDoS
Try to reverse getting fired …
Garnet
[ASL20] Players bad at pi…
pullarius1
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1285 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
23:00
Biweekly #33
CranKy Ducklings108
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Nathanias 124
CosmosSc2 62
StarCraft: Brood War
Artosis 741
NaDa 50
ajuk12(nOOB) 7
Icarus 3
Dota 2
monkeys_forever451
LuMiX1
Counter-Strike
fl0m1908
Super Smash Bros
C9.Mang0228
Other Games
summit1g9734
shahzam997
JimRising 419
Maynarde213
ViBE189
UpATreeSC58
JuggernautJason4
Organizations
Other Games
gamesdonequick999
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 11 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Doublelift4234
Upcoming Events
The PondCast
7h 57m
Map Test Tournament
8h 57m
OSC
13h 57m
SKillous vs Krystianer
GgMaChine vs Demi
ArT vs Creator
INexorable vs TBD
ReBellioN vs TriGGeR
UedSoldier vs Iba
sOs vs Moja
Map Test Tournament
1d 8h
OSC
1d 10h
Korean StarCraft League
2 days
CranKy Ducklings
2 days
Map Test Tournament
2 days
OSC
2 days
[BSL 2025] Weekly
2 days
[ Show More ]
Safe House 2
2 days
Sparkling Tuna Cup
3 days
Map Test Tournament
3 days
OSC
3 days
IPSL
3 days
Bonyth vs Art_Of_Turtle
Razz vs rasowy
Liquipedia Results

Completed

Acropolis #4 - TS2
Maestros of the Game
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
WardiTV TLMC #15
EC S1
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
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.