AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Autohotkey with League of legends
Goto page 1, 2, 3  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ski_power



Joined: 19 Feb 2010
Posts: 2

PostPosted: Fri Feb 19, 2010 4:07 pm    Post subject: Autohotkey with League of legends Reply with quote

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
View user's profile Send private message
randallf



Joined: 06 Jul 2009
Posts: 678

PostPosted: Sat Feb 20, 2010 3:39 am    Post subject: Reply with quote

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
View user's profile Send private message
ski_power



Joined: 19 Feb 2010
Posts: 2

PostPosted: Sat Feb 20, 2010 6:29 am    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Sun Feb 21, 2010 7:28 am    Post subject: Reply with quote

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

PostPosted: Mon Feb 22, 2010 3:05 am    Post subject: Re: Autohotkey with League of legends Reply with quote

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
View user's profile Send private message Visit poster's website
gamadren



Joined: 28 Nov 2006
Posts: 8

PostPosted: Tue Feb 23, 2010 1:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Grim
Guest





PostPosted: Thu Mar 24, 2011 1:19 pm    Post subject: Autohotkey with League of legends Reply with quote

Any update on your progress? I was searching for one of these and this is the only lead I found Razz
Back to top
girlgamer



Joined: 04 Jun 2010
Posts: 1347
Location: california

PostPosted: Thu Mar 24, 2011 3:07 pm    Post subject: Reply with quote

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
View user's profile Send private message
bopmucket
Guest





PostPosted: Tue Apr 26, 2011 7:44 am    Post subject: LoL Scripting Reply with quote

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 Smile
Back to top
bopmucket
Guest





PostPosted: Tue Apr 26, 2011 11:08 am    Post subject: actually... lol Reply with quote

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





PostPosted: Tue Apr 26, 2011 11:08 am    Post subject: actually... lol Reply with quote

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





PostPosted: Tue Apr 26, 2011 11:09 am    Post subject: actually... lol Reply with quote

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





PostPosted: Thu Apr 28, 2011 5:27 am    Post subject: Yea got it Reply with quote

$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





PostPosted: Thu Apr 28, 2011 5:58 am    Post subject: Reply with quote

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

PostPosted: Thu Apr 28, 2011 7:38 am    Post subject: Yep Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group