League macro only works once Topic is solved

Ask gaming related questions
Ludenife

League macro only works once  Topic is solved

03 Oct 2018, 17:47

Hi.

I have an "antiflame" macro for League, that sends a motivational sentence when I press Enter, effectively disabling the chat.
It used to work fine, but now it only works for one game, and then if I start another one I have to reload the script.
This only happens in League windows, tested on other games/applications and it works as intended.

Here is the script:

Code: Select all

if not A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}

#If WinActive("ahk_class RiotWindowClass") || WinActive("ahk_class TankWindowClass")
*Enter::
*NumpadEnter::

Send, {Enter}
sleep, 100
Send, (It picks a sentence randomly from an array)
sleep, 100
Send, {Enter}

return
#If
Thanks.
Ludenife

Re: League macro only works once

05 Oct 2018, 01:43

Bump.
I don't know why it shows as solved, but it is not.
Thanks.
Rohwedder
Posts: 1506
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: League macro only works once

05 Oct 2018, 06:35

Hallo,
only a try:

Code: Select all

GroupAdd, League, ahk_class RiotWindowClass
GroupAdd, League, ahk_class TankWindowClass
if not A_IsAdmin
{
   Run *RunAs "%A_ScriptFullPath%"
   ExitApp
}

#IfWinActive ahk_group League
$*Enter::
$*NumpadEnter::

Send, {Enter}
sleep, 100
Send, (It picks a sentence randomly from an array)
sleep, 100
Send, {Enter}

return
#IfWinActive
Ludenife

Re: League macro only works once

05 Oct 2018, 09:12

Hi, thanks for answering.

I tried your code and the result is the same. It only works if the scripts is started, reloaded or unsuspended while the game is running. If the script starts before the game window opens, it won't work, as if it doesn't recognize the id and doesn't trigger the hotkey.
What I can't figure out is why it works with other games without a problem, like it used to do with this one. :crazy:
Ludenife

Re: League macro only works once

12 Oct 2018, 06:35

Still trying to fix it but no luck... Any ideas?
Rohwedder
Posts: 1506
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: League macro only works once

13 Oct 2018, 00:58

Hallo,
I'm not a player, but Google says this is a well-known behavior of League.
swagfag
Posts: 1534
Joined: 11 Jan 2017, 17:59

Re: League macro only works once

13 Oct 2018, 02:36

Maybe starting a new game unloads keyboard hooks. You can try suspending and unsuspending briefly on an timer to reload the hooks.
Ludenife

Re: League macro only works once

14 Oct 2018, 08:01

Rohwedder wrote:Hallo,
I'm not a player, but Google says this is a well-known behavior of League.
Hi, I can't find any recent info, most threads are from 2013-2014 and my scripts worked just fine like a year ago. Do they propose any solution?

I'm going to try the reload timer if everything else fails. Just discovered that launching "Window Spy" makes the macro work again too without reloading or unsuspending. :crazy:
swagfag
Posts: 1534
Joined: 11 Jan 2017, 17:59

Re: League macro only works once

24 Oct 2018, 07:42

Ludenife wrote:
14 Oct 2018, 08:01
Just discovered that launching "Window Spy" makes the macro work again too without reloading or unsuspending.
that makes me even more inclined to believe it has something to do with how the keyboard hooks are interacting. LOL is probably loading its own hook, which overrides all other hooks.
try the following, run ur script, play a game, start a new one, verify that the script is no longer working, then start this script:

Code: Select all

$q::msgbox hook hotkey
finally, check if ur game script is working again. If it is, then its confirmed
Ludenife
Posts: 1
Joined: 04 Dec 2018, 10:19

Re: League macro only works once

04 Dec 2018, 10:53

swagfag wrote:
24 Oct 2018, 07:42
Ludenife wrote:
14 Oct 2018, 08:01
Just discovered that launching "Window Spy" makes the macro work again too without reloading or unsuspending.
that makes me even more inclined to believe it has something to do with how the keyboard hooks are interacting. LOL is probably loading its own hook, which overrides all other hooks.
try the following, run ur script, play a game, start a new one, verify that the script is no longer working, then start this script:

Code: Select all

$q::msgbox hook hotkey
finally, check if ur game script is working again. If it is, then its confirmed
Hi, sorry for the delay, I could not register in the forum nor post as a guest.

I tested it and it works, can I prevent the League hook from overriding my own or there is no solution?

Thanks for your time.
swagfag
Posts: 1534
Joined: 11 Jan 2017, 17:59

Re: League macro only works once

04 Dec 2018, 11:19

u cant prevent it. what u can do is reload ur script's hook so as to override the one belonging to LOL. to do this u must suspend then unsuspend the script. u can do this manually urself in the scripts tray menu, but it would be easier to put it on a, say, 2 second timer that would do this automatically over and over again for you.

Code: Select all

Settimer reloadhooks, 2000
Return

reloadhooks:
Suspend On
Suspend Off
Return

Return to “Gaming”

Who is online

Users browsing this forum: veladorn and 26 guests