• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:46
CEST 13:46
KST 20:46
  • 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
[ASL19] Finals Recap: Standing Tall8HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL42Weekly Cups (June 23-29): Reynor in world title form?12FEL Cracov 2025 (July 27) - $8000 live event16Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
RELIABLE USDT RECOVERY SERVICE//TECHY FORCE CYBER The SCII GOAT: A statistical Evaluation Statistics for vetoed/disliked maps Esports World Cup 2025 - Final Player Roster How does the number of casters affect your enjoyment of esports?
Tourneys
RSL: Revival, a new crowdfunded tournament series [GSL 2025] Code S: Season 2 - Semi Finals & Finals $5,100+ SEL Season 2 Championship (SC: Evo) FEL Cracov 2025 (July 27) - $8000 live event HomeStory Cup 27 (June 27-29)
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Flash Announces Hiatus From ASL BW General Discussion [ASL19] Finals Recap: Standing Tall BGH Auto Balance -> http://bghmmr.eu/ Help: rep cant save
Tourneys
[Megathread] Daily Proleagues [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET The Casual Games of the Week Thread [BSL20] ProLeague LB Final - Saturday 20:00 CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Path of Exile What do you want from future RTS games? Beyond All Reason
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
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine US Politics Mega-thread Trading/Investing Thread The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread NBA General Discussion Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
Game Sound vs. Music: The Im…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 683 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
RSL Revival
10:00
Season 1: Playoffs Day 1
ByuN vs Classic
Clem vs Cham
Crank 1652
Tasteless1161
IndyStarCraft 140
Rex133
3DClanTV 81
IntoTheiNu 63
LiquipediaDiscussion
The PondCast
10:00
Episode 53
CranKy Ducklings29
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Crank 1652
Tasteless 1161
IndyStarCraft 140
Rex 133
Harstem 108
ProTech58
EnDerr 6
StarCraft: Brood War
Britney 36284
Sea 3689
Rain 3625
Horang2 3102
Jaedong 1058
BeSt 663
EffOrt 526
Larva 422
Mini 389
actioN 325
[ Show more ]
Stork 265
Light 248
ToSsGirL 225
Last 176
Killer 150
Pusan 106
Sharp 93
ZerO 91
Snow 88
Mong 66
Mind 46
Rush 45
hero 44
sSak 36
Nal_rA 34
Noble 33
Shinee 26
yabsab 24
sorry 22
ajuk12(nOOB) 18
Sacsri 18
Sea.KH 16
JulyZerg 14
Icarus 14
soO 13
Movie 12
NaDa 10
SilentControl 9
IntoTheRainbow 5
Bale 4
Dota 2
BananaSlamJamma544
XcaliburYe427
420jenkins389
Counter-Strike
shoxiejesuss796
x6flipin615
allub180
Super Smash Bros
Mew2King151
Other Games
B2W.Neo584
DeMusliM497
crisheroes314
Lowko158
Pyrionflax68
SortOf61
ArmadaUGS22
ZerO(Twitch)13
Organizations
StarCraft 2
ComeBackTV 850
StarCraft: Brood War
Kim Chul Min (afreeca) 604
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 28
• iHatsuTV 3
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 4
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV380
Upcoming Events
WardiTV European League
4h 15m
ByuN vs NightPhoenix
HeRoMaRinE vs HiGhDrA
Krystianer vs sebesdes
MaxPax vs Babymarine
SKillous vs Mixu
ShoWTimE vs MaNa
Replay Cast
12h 15m
RSL Revival
22h 15m
herO vs SHIN
Reynor vs Cure
OSC
1d 1h
WardiTV European League
1d 4h
Scarlett vs Percival
Jumy vs ArT
YoungYakov vs Shameless
uThermal vs Fjant
Nicoract vs goblin
Harstem vs Gerald
FEL
1d 4h
Korean StarCraft League
1d 15h
CranKy Ducklings
1d 22h
RSL Revival
1d 22h
FEL
2 days
[ Show More ]
Sparkling Tuna Cup
2 days
RSL Revival
2 days
FEL
3 days
BSL: ProLeague
3 days
Dewalt vs Bonyth
Replay Cast
4 days
Replay Cast
4 days
The PondCast
5 days
Replay Cast
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Proleague 2025-06-28
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025

Upcoming

CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
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
FISSURE Playground #1
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.