• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:38
CEST 11:38
KST 18:38
  • 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
[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18Serral wins EWC 202549
Community News
Maestros of The Game—$20k event w/ live finals in Paris20Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195Weekly Cups (Jul 28-Aug 3): herO doubles up6
StarCraft 2
General
What mix of new and old maps do you want in the next 1v1 ladder pool? (SC2) : 2v2 & SC: Evo Complete: Weekend Double Feature Geoff 'iNcontroL' Robinson has passed away The GOAT ranking of GOAT rankings RSL Revival patreon money discussion thread
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament RSL: Revival, a new crowdfunded tournament series Maestros of The Game—$20k event w/ live finals in Paris Monday Nights Weeklies Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
External Content
Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below Mutation # 484 Magnetic Pull
Brood War
General
Flash On His 2010 "God" Form, Mind Games, vs JD Joined effort New season has just come in ladder BW General Discussion Flash Announces (and Retracts) Hiatus From ASL
Tourneys
[ASL20] Ro24 Group B [ASL20] Ro24 Group C BWCL Season 63 Announcement [CSLPRO] It's CSLAN Season! - Last Chance
Strategy
Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting Muta micro map competition
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Dawn of War IV Path of Exile Stormgate/Frost Giant Megathread
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
US Politics Mega-thread Russo-Ukrainian War Thread The year 2050 Things Aren’t Peaceful in Palestine European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion
World Cup 2022
Tech Support
High temperatures on bridge(s) Gtx660 graphics card replacement Installation of Windows 10 suck at "just a moment"
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
Evil Gacha Games and the…
ffswowsucks
Breaking the Meta: Non-Stand…
TrAiDoS
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Sharpening the Filtration…
frozenclaw
ASL S20 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2332 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
Next event in 22m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Sea 7035
Killer 771
PianO 590
Larva 430
Pusan 376
ggaemo 350
Hyun 291
Soma 166
Rush 146
firebathero 145
[ Show more ]
Free 26
NotJumperer 21
Noble 20
HiyA 16
NaDa 16
Dota 2
XcaliburYe581
febbydoto3
League of Legends
Dendi533
JimRising 401
rGuardiaN0
Counter-Strike
Stewie2K1660
olofmeister1213
Super Smash Bros
Mew2King30
Heroes of the Storm
Khaldor187
Other Games
summit1g7712
singsing1843
Happy312
SortOf108
Nina98
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 13 non-featured ]
StarCraft 2
• Berry_CruncH426
• Reevou 6
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1046
Upcoming Events
Sparkling Tuna Cup
22m
WardiTV Summer Champion…
1h 22m
SC Evo League
2h 22m
Chat StarLeague
6h 22m
Razz vs Julia
StRyKeR vs ZZZero
Semih vs TBD
Replay Cast
14h 22m
Afreeca Starleague
1d
Queen vs HyuN
EffOrt vs Calm
Wardi Open
1d 1h
RotterdaM Event
1d 5h
Replay Cast
1d 14h
Afreeca Starleague
2 days
Rush vs TBD
Jaedong vs Mong
[ Show More ]
WardiTV Summer Champion…
2 days
PiGosaur Monday
2 days
Afreeca Starleague
3 days
herO vs TBD
Royal vs Barracks
Replay Cast
3 days
The PondCast
4 days
WardiTV Summer Champion…
4 days
Replay Cast
4 days
LiuLi Cup
5 days
Cosmonarchy
5 days
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
BSL Team Wars
5 days
Team Hawk vs Team Dewalt
BSL Team Wars
5 days
Team Hawk vs Team Bonyth
SC Evo League
6 days
[BSL 2025] Weekly
6 days
Liquipedia Results

Completed

Jiahua Invitational
uThermal 2v2 Main Event
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
CSL Season 18: Qualifier 1
Acropolis #4 - TS1
CSLAN 3
SEL Season 2 Championship
WardiTV Summer 2025
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL Season 18: Qualifier 2
CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
IEM Chengdu 2025
PGL Masters Bucharest 2025
MESA Nomadic Masters Fall
Thunderpick World Champ.
CS Asia Championships 2025
Roobet Cup 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall 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.