AutoHotkey Community

It is currently May 27th, 2012, 6:33 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: February 19th, 2010, 5:07 pm 
Offline

Joined: February 19th, 2010, 5:04 pm
Posts: 2
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 4:39 am 
Offline

Joined: July 6th, 2009, 9:58 pm
Posts: 678
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 20th, 2010, 7:29 am 
Offline

Joined: February 19th, 2010, 5:04 pm
Posts: 2
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 21st, 2010, 8:28 am 
Sorry i misread your question, if it doesn't detect the key in the game I'm sorry I do not know.


Report this post
Top
  
Reply with quote  
PostPosted: February 22nd, 2010, 4:05 am 
Offline

Joined: August 8th, 2007, 5:41 am
Posts: 136
Location: Michigan
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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2010, 2:28 am 
Offline

Joined: November 28th, 2006, 7:27 pm
Posts: 8
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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 24th, 2011, 2:19 pm 
Any update on your progress? I was searching for one of these and this is the only lead I found :P


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 24th, 2011, 4:07 pm 
Offline

Joined: June 4th, 2010, 9:04 pm
Posts: 1347
Location: california
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.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject: LoL Scripting
PostPosted: April 26th, 2011, 8:44 am 
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 :)


Report this post
Top
  
Reply with quote  
 Post subject: actually... lol
PostPosted: April 26th, 2011, 12:08 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject: actually... lol
PostPosted: April 26th, 2011, 12:08 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject: actually... lol
PostPosted: April 26th, 2011, 12:09 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject: Yea got it
PostPosted: April 28th, 2011, 6:27 am 
$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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 28th, 2011, 6:58 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject: Yep
PostPosted: April 28th, 2011, 8:38 am 
Offline

Joined: April 28th, 2011, 8:31 am
Posts: 5
Location: Califorina
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 33 posts ]  Go to page 1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: JSLover and 64 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group