League of Legends Login Script

Post gaming related scripts
Richard_Long
Posts: 6
Joined: 23 Jul 2015, 04:00
Location: South Germany
Contact:

League of Legends Login Script

23 Sep 2015, 06:40

Hi.

This is the first ahk script i wrote. I used the LoL Tools from the old Forum but it doesn't work any more. So i started figguring out how this works and wrote my own litte script. It is only to start and login to LoL for multiple accounts. For this first version i do not have things like window size detection a.s.o. so the relative Window coordinates for the clicks have to adjusted by yourself. I plan all that for my next version when i'm more into all that. The Anti AFK feature i wrote works but i do not want to release it jet. I don't want all users use the same way to anti afk abbout cheat delection so i plan to do this with much randomness way i can.

This script is NOT ready to use without changing something by yourself. For Example: Coordinates for the clicks, ammount of used LoL accounts a.s.o.

But i have a huge TODO list for feature versions. Please tell me if you see serious bugs or problems in my script, i'm open for any critics or tips to improve it.

And sorry for my bad english ;)

Code: Select all

; LoL Login Script
; v1.0 beta
; by [email protected]
; (User Richard_Long in ahkscript.org forum)

;;; LoL Account Data ;;;
UsernameA = example_username1
PasswordA = example_password1
SummonerA = example_summonername1

UsernameB = 
PasswordB = 
SummonerB = Name2

UsernameC = 
PasswordC = 
SummonerC = Name3

UsernameD = 
PasswordD = 
SummonerD = Name4 

; Sorry you have to delete a fiew lines below if you don't use that much accounts


;;; Game Data ;;;
RiotPath = C:\Riot Games\league of legends\lol.launcher.exe
InstallLocation = C:\Riot Games\league of legends\


;;; Misc settings ;;;
global AntiAfkEnabled := false ;This feature is not implemented jet. I work on this in a future version.
MenuUseSummonerNames := true ;Show Summoners Name instead of Username in the Tray Menu.
DefaultAccount = C ;Default Account to log in on Tray Icon double click. Leave it empty to disable it.


;;; Init ;;;
#NoEnv
#Persistent
#SingleInstance, force
SetBatchLines, 20ms
SendMode, Input
CoordMode,Mouse,Window
CoordMode,Pixel,Window
SetWorkingDir, %A_ScriptDir%
OnExit, EXIT
if not A_IsAdmin
    Run *RunAs "%A_ScriptFullPath%"

    
if MenuUseSummonerNames
{
    AccountDescA = %SummonerA%
    AccountDescB = %SummonerB%
    AccountDescC = %SummonerC%
    AccountDescD = %SummonerD%
}
else
{
    AccountDescA = %UsernameA%
    AccountDescB = %UsernameB%
    AccountDescC = %UsernameC%
    AccountDescD = %UsernameD% 
}


;Tray Menu
Menu, Tray, Icon, %RiotPath%, 1
Menu, Tray, Tip, LoL_Login v1.0
Menu, Tray, NoStandard
; TODO: create next lines with a loop and skip empty accounts...
; TODO: Use only one Handler function for all accounts
Menu, Tray, Add, Login to LoL (%AccountDescA%), STARTA
Menu, Tray, Add, Login to LoL (%AccountDescB%), STARTB
Menu, Tray, Add, Login to LoL (%AccountDescC%), STARTC
Menu, Tray, Add, Login to LoL (%AccountDescD%), STARTD
Menu, Tray, Add
Menu, Tray, Add, Anti-AFK, AfkTool
Menu, Tray, Add
Menu, Tray, Add, Reload This Script, RELOAD
Menu, Tray, Add, Exit Script, EXIT
If DefaultAccount
{
    DefaultAccountname := AccountDesc%DefaultAccount%
    menu, Tray, Default, Login to LoL (%DefaultAccountname%)
}
else
{
    menu, Tray, NoDefault
}

If AntiAfkEnabled
{
    Menu, Tray, Check, Anti-AFK
    enableAFK()
}
return


AfkTool:
    CheckAFKToggle( A_ThisMenuItem, A_ThisMenu )
return

CheckAFKToggle(MenuItem, MenuName){
    AntiAfkEnabled := !AntiAfkEnabled
    If (AntiAfkEnabled)
    {
        Menu, %MenuName%, Check, %MenuItem%
        enableAFK()
    }
    else
    {
        Menu, %MenuName%, UnCheck, %MenuItem%
    }
}    

enableAFK()
{
    Loop
    {
        if not AntiAfkEnabled
            break
        MsgBox, The Anti Afk Feature is not implemented in this version.
    }
}



F8::
    CheckAFKToggle("Anti-AFK", "Tray")
return

RELOAD:
    Reload
return

STARTA:
    Login(UsernameA,PasswordA,InstallLocation)
return

STARTB:
    Login(UsernameB,PasswordB,InstallLocation)
return

STARTC:
    Login(UsernameC,PasswordC,InstallLocation)
return

STARTD:
    Login(UsernameD,PasswordD,InstallLocation)
return



EXIT: 
    ExitApp
Return

Login(username, password, installloc)
{
    ; Credits for this function to LoL Tools in http://www.autohotkey.com/board/topic/114985-league-of-legends-tools/
    global
    ; I commented out something because i experienced, the Launcher is killed by LoL itself when killing the Client.
    ;===Kills League of Legends=====================================================================
    IfWinExist, ahk_class ApolloRuntimeContentWindow
    { ;Runwait, taskkill /f /im LoLLauncher.exe,, Hide
      ;sleep, 250
      Runwait, taskkill /f /im LolClient.exe,, Hide
      sleep, 250
    } else IfWinExist, ahk_class RADSWindowClass
    { ;Runwait, taskkill /f /im LoLLauncher.exe,, Hide
      ;sleep, 250
      Runwait, taskkill /f /im LolClient.exe,, Hide
      sleep, 250
    } else IfWinExist, ahk_class LOLPATCHER
    { Runwait, taskkill /f /im LoLPatcher.exe,, Hide
      sleep, 250
      ;Runwait, taskkill /f /im LolClient.exe,, Hide
      ;sleep, 250
    }
    ;===Runs League of Legends======================================================================
    Run, lol.launcher.exe,%installloc%
    sleep, 5000
    
    ;===Clicks Play=================================================================================
    WinWaitActive ahk_class LOLPATCHER
    WinGetPos,,, w, h, A
    Sleep 2000
    WinActivate ahk_class LOLPATCHER
    ;MouseMove, 500, 30
    MouseClick, left, 500, 30,,0 ; Change the position here if not working.
    Goto, Login
    
    Login:
    WinWaitActive ahk_class ApolloRuntimeContentWindow
    WinGetPos,,, w, h, A
    WinActivate ahk_class ApolloRuntimeContentWindow
    sleep, 3000
    MouseClick, left, 120, 320,,0 ; Change the position here if not working.
    sleep, 1000
    SetKeyDelay, 5, 5
    Sleep, 1000
    Send, %username%
    WinWaitActive ahk_class ApolloRuntimeContentWindow
    WinGetPos,,, w, h, A
    Sleep, 1000
    MouseClick, left, 120, 380,,0 ; Change the position here if not working.
    Sleep, 1000
    SetKeyDelay, 5, 5
    Sleep, 1000
    Send, %password%
    Sleep, 2500
    WinGetPos,,, w, h, A
    MouseClick, Left, 360, 430,,0 ; Change the position here if not working.

    return
}
Future version plan:
- GUI to add/edit/delete LoL accounts and LoL location choosing.
- Update/EULA detection.
- Randomized anti afk movement.
- Code simplification and improvements.
- Change to AutoHotkey_L
- Trigger my cygwin bash script to backup/restore created Item lists...


If you think this isn't good enaugh to release here, please tell me and i'll delete it.
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

Re: League of Legends Login Script

05 Nov 2015, 19:38

Hey, just dropped in here to say I like your work! If you have any questions about the original script I would be happy to answer them. Keep it up!
User avatar
Wickster
Posts: 21
Joined: 19 Apr 2014, 23:02

Re: League of Legends Login Script

26 Nov 2015, 05:21

I have something along these lines as well thats already made, If you wish to check it out feel free to do so RAWM. I realized I wasnt the first one to think of this either, which is why I continued to work on my own script. Feel free to use some of my coding to further advance your own script or feel free to use mine and let me know what you think :)
Richard_Long
Posts: 6
Joined: 23 Jul 2015, 04:00
Location: South Germany
Contact:

Re: League of Legends Login Script

10 Dec 2015, 08:34

Yeah i checked out RAWM some month ago. But i don't remember what was the reason i don't use it. Maybe to much inside that confused me. I don't just want to use it, i want to understand it to be able making changes if it does not work. So i started this script here just to figgure things out and learn.

I do not use my script atm so i also haven't worked on it since release.

If you tool (RAWM) is still working, i'll use this instead maintain a own one.

Thank you guys for all the work here.

Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 87 guests