| View previous topic :: View next topic |
| Author |
Message |
ski_power
Joined: 19 Feb 2010 Posts: 2
|
Posted: Fri Feb 19, 2010 4:07 pm Post subject: Autohotkey with League of legends |
|
|
Hi guys, I had posted this in the league of legends forums but was pointed out to that I'd get better response here.
I'm planning to create a script in which if I press a key, correspondingly messages should be sent into my team chat.
For instance, if I press 9 it should show "Mid Miss", 8 should do that for Top, and 0 for Bottom.
The thing is, the script I made works in a normal notepad, but fails miserably in the game.
I even tried to run the script in admin mode and it still does not work.
I am a novice scripter in AHK and am using a simple substitution method.
eg.
2::
clipboard = "Top Miss"
Send {enter}
Send ^v
Send {enter}
return
It seems like AHK cannot 'see' the 2 key being pressed while in-game. But when I open notepad and press 2, it executes perfectly. |
|
| Back to top |
|
 |
randallf
Joined: 06 Jul 2009 Posts: 678
|
Posted: Sat Feb 20, 2010 3:39 am Post subject: |
|
|
We need to know exactly what commands the game expects in the chat window as well as the window title of the game, at a minimum. The command syntax from a help file would also be helpful.
Also please include the command to activate the chat window in the game. |
|
| Back to top |
|
 |
ski_power
Joined: 19 Feb 2010 Posts: 2
|
Posted: Sat Feb 20, 2010 6:29 am Post subject: |
|
|
The command to invoke the chat windows is simply pressing the Enter key.
For the Launcher, its
PVP.NET
ahk_class ApolloRuntimeContentWindow
The info for the game is
League of Legends (TM) Client
ahk_class LeagueOfLegendsWindowClass
Again just to check I tried creating a simple key replacement script, and it works everywhere except in-game. |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Feb 21, 2010 7:28 am Post subject: |
|
|
| Sorry i misread your question, if it doesn't detect the key in the game I'm sorry I do not know. |
|
| Back to top |
|
 |
Seatbelt99
Joined: 08 Aug 2007 Posts: 136 Location: Michigan
|
Posted: Mon Feb 22, 2010 3:05 am Post subject: Re: Autohotkey with League of legends |
|
|
| ski_power wrote: |
2::
clipboard = "Top Miss"
Send {enter}
Send ^v
Send {enter}
return
It seems like AHK cannot 'see' the 2 key being pressed while in-game. But when I open notepad and press 2, it executes perfectly. |
I'd say first step is confirm if it can see the 2 key being pressed or not.
do something like
2::
msgbox test worked
return
then in game, press 2...if you get the message box then you know that's not your problem. IF you don't then we'd have to figure out why it can't see the two key being pressed.
Good luck! |
|
| Back to top |
|
 |
gamadren
Joined: 28 Nov 2006 Posts: 8
|
Posted: Tue Feb 23, 2010 1:28 am Post subject: |
|
|
I had similar trouble and found the answer at the solomid forums.
I added these lines to the top of my script:
| Code: | #InstallKeybdHook
SendMode Event
#UseHook |
|
|
| Back to top |
|
 |
Grim Guest
|
Posted: Thu Mar 24, 2011 1:19 pm Post subject: Autohotkey with League of legends |
|
|
Any update on your progress? I was searching for one of these and this is the only lead I found  |
|
| Back to top |
|
 |
girlgamer
Joined: 04 Jun 2010 Posts: 1347 Location: california
|
Posted: Thu Mar 24, 2011 3:07 pm Post subject: |
|
|
In EverQuest II the chat box is also activated by the {enter} key. I know in that game the input is also terminated by an {enter} so any messages to the chat box take the form.
{enter}This is the message to be sent{enter}
Depending on which chat that the message needs to be sent to there is also a command of the form /say or /s or /p (for party chat} or /r (for raid chat. So a generalized send to the say channel is then modified by
the command as in...
{enter}/s This is the message to be sent{enter}
to bind that to the 2 key you'd use
| Code: | 2::
Send {enter}/s This is the message to be sent{enter}
sleep 200
Return |
Also one must be careful to make sure the proper window is active as well. If you're anything like me, when you're playing, you're running in windowed mode with several other info windows open for reference such as a game wiki window, one or more script window gui's and maybe a notepad or calculator and possibly a pdf game aid file. So I generally make sure my game window is activated when I send a hotkey. I make a practice of setting that at the beginning of my script.
| Code: | SetTitleMatchMode, 2
gamewindow = EverQuest II
2::
WinActivate %gamewindow%
Send {enter}/s This is the message to be sent{enter}
sleep 200
Return |
Finally, since many of my fight keys are bound to the game hotbars 1-9, alt1-alt9, and ctrl1-ctrl9. I bind my numpad keys to any numbersets i need for special functions. The end result then generally becomes...
| Code: | SetTitleMatchMode, 2
gamewindow = EverQuest II
*Numpad2::
*NumpadDown::
WinActivate %gamewindow%
Send {enter}/s This is the message to be sent{enter}
sleep 200
Return
*Numpad3::
*NumpadPgDn::
WinActivate %gamewindow%
Send {enter}/s This is another message to be sent{enter}
sleep 200
Return |
Hope this helps. _________________
 |
|
| Back to top |
|
 |
bopmucket Guest
|
Posted: Tue Apr 26, 2011 7:44 am Post subject: LoL Scripting |
|
|
You need to add '$' at the beginning for it to work. Without it only the LoL client will receive the keystroke command were as adding $ allows AHK to receive (and interpret) the command.
change your code to the following and it should work fine in game.
$2::
clipboard = "Top Miss"
Send {enter}
Send ^v
Send {enter}
return
I'm very new to AHK too. Just got lucky in finding a post which clarified this before I started scripting nething haha!
happy hunting  |
|
| Back to top |
|
 |
bopmucket Guest
|
Posted: Tue Apr 26, 2011 11:08 am Post subject: actually... lol |
|
|
Well after testing this it appears that the addition of $ doesnt work for numerical characters or symbols.... at least not for me. Not sure why that is. I'll look into it further and let you know if I find a fix.
I do have several letters scripted for in game actions using something such as
$q::
Send, q
Sleep, 50
Mouseclick, left
Sleep, 50
return
this code would cast blitzcrank's grab instantly (or any other hero ability w/ a similar mechanic). this is just an example and honestly not useful in-game after testing unless you have very good knowledge of the range of his grab. |
|
| Back to top |
|
 |
bopmucket Guest
|
Posted: Tue Apr 26, 2011 11:08 am Post subject: actually... lol |
|
|
Well after testing this it appears that the addition of $ doesnt work for numerical characters or symbols.... at least not for me. Not sure why that is. I'll look into it further and let you know if I find a fix.
I do have several letters scripted for in game actions using something such as
$q::
Send, q
Sleep, 50
Mouseclick, left
Sleep, 50
return
this code would cast blitzcrank's grab instantly (or any other hero ability w/ a similar mechanic). this is just an example and honestly not useful in-game after testing unless you have very good knowledge of the range of his grab. |
|
| Back to top |
|
 |
bopmucket Guest
|
Posted: Tue Apr 26, 2011 11:09 am Post subject: actually... lol |
|
|
Well after testing this it appears that the addition of $ doesnt work for numerical characters or symbols.... at least not for me. Not sure why that is. I'll look into it further and let you know if I find a fix.
I do have several letters scripted for in game actions using something such as
$q::
Send, q
Sleep, 50
Mouseclick, left
Sleep, 50
return
this code would cast blitzcrank's grab instantly (or any other hero ability w/ a similar mechanic). this is just an example and honestly not useful in-game after testing unless you have very good knowledge of the range of his grab. |
|
| Back to top |
|
 |
Sargon Rose Guest
|
Posted: Thu Apr 28, 2011 5:27 am Post subject: Yea got it |
|
|
$Numpad9:: ;;the following hotkeys are for the numpad 9, 6, 3, 0, and period for top missing, mid missing, btm missing, nvm, and back.
Send {Enter}
Sleep 50
Send top missing
Sleep 50
Send {Enter}
return
$Numpad6::
Send {Enter}
Sleep 50
Send mid missing
Sleep 50
Send {Enter}
return
$Numpad3::
Send {Enter}
Sleep 50
Send btm missing
Sleep 50
Send {Enter}
return
$NumpadDot::
Send {Enter}
Sleep 50
Send nvm
Sleep 50
Send {Enter}
return
$Numpad0::
Send {Enter}
Sleep 50
Send back
Sleep 50
Send {Enter}
return |
|
| Back to top |
|
 |
Game_Tester_1993 Guest
|
Posted: Thu Apr 28, 2011 5:58 am Post subject: |
|
|
Do any of these commands work Sargon?
also another thing to do would be to make sure the window is active before using, and adding sleep times, because what could be happening is that the processor in your computer has not had enough time to actually open the text field you type into, and pressing enter again closing it, i would advise adding
Sleep, 500 ; or something long enough to allow for the text bar to come up
that will wait half a second before continuing, that way u can amke sure it sends, i had a similar problem with my earlier scripts. |
|
| Back to top |
|
 |
SargonRose
Joined: 28 Apr 2011 Posts: 5 Location: Califorina
|
Posted: Thu Apr 28, 2011 7:38 am Post subject: Yep |
|
|
That was a Copy Paste of the code i had been using then. I have currently started using a new code that i wrote myself. No diffrence really i just like mine more. Though i was confused. Why do i need to use Sleep 50? I used it without the sleep parts and noticed no change.
Current Code
| Code: | $numpad9::
send {enter}
sleep 50
Send -Top Missing-
sleep 50
Send {enter}
return
$numpad6::
send {enter}
sleep 50
send -Mid Missing-
sleep 50
send {enter}
Return
$numpad3::
Send {Enter}
sleep 50
Send -Bottem Missing-
sleep 50
Send {Enter}
Return
$numpaddot::
send {enter}
sleep 50
send -Never Mind-
sleep 50
send {enter}
return
$numpad0::
send {enter}
sleep 50
send -Back-
sleep 50
send {enter}
return
|
|
|
| Back to top |
|
 |
|