Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

League of Legends Auto-Picker(/w Auto Champ List Update)


  • Please log in to reply
2 replies to this topic
Ruevil2
  • Members
  • 226 posts
  • Last active: Dec 04 2015 11:05 PM
  • Joined: 27 Mar 2012

This program is for automatically selecting and calling your favored champion when playing League of Legends. This is basically just a mod of this script by Sanctus, that I added a function to automatically update the champion list via Riot web API.

 

THIS REQUIRES YOU TO GO HERE AND SIGN UP FOR A RIOT DEVELOPER API KEY. IT WILL NOT WORK WITHOUT ONE AND THERE ARE NO PUBLIC OR ANONYMOUS KEYS.

 

LINK FOR API KEYS ----> https://developer.riotgames.com/

 

Alright now that is over with we can get to the codes. :)

#SingleInstance force
 
;;;Go here and sign up for an api key - https://developer.riotgames.com/
;;;it is free to sign up and no personal info is required.
 
key = ;<----your api key goes here
 
 
url = https://na.api.pvp.net/api/lol/static-data/na/v1.2/champion?api_key=%key%
ChampList := GetChampList(url)
Menu, Tray, Tip, League of Legends Auto Picker v1.06`nMade by Sanctus
myGui("x860 y400", "League of Legends AHK AutoPicker", ChampList)

myGui(position, title, list)
{
global thatVar
global thisVar
gui, new
gui, Default
gui, +LastFound +LabelMyGui
gui, add, groupbox, w200 h150, LOL AutoPicker
gui, font, s8, Arial
gui, add, text, xm12 ym20 section
gui, add, text, yp center, Choose the hero to play..
gui, Add, ComboBox, Sort vthisVar w120 r10 gAC, %list%
gui, add,text, yp+25 center, Choose the lane to call..
gui, Add, ComboBox, vthatVar w120 r10 gAC, ADC|Support|Top|Jungle|Mid
gui, add, button, yp+30 gDone, OK
gui, add, button, xp+30  gmyguiclose, Cancel
gui, add, text, yp+40 center, F8 TO CRASH PROGRAM
gui, add, text, yp+15 xp+17.5, Made by Sanctus
gui, add, text, yp+15 xp-30, Auto Update Added by Ruevil2
gui, add, link, yp+15 xp-30,  <a href="http://euw.leagueoflegends.com/news/champion-rotation">Click here to see EUW Champion Rotation.</a>
gui, add, link, yp+15 xp+5,  <a href="http://na.leagueoflegends.com/news/champions-skins/free-rotation/">Click here to see NA Champion Rotation.</a>
gui, font, s10, Verdana
gui, add, text, yp+15 xp+6, Version: 1.06 (23.07.2014)
gui, show, % position, % title
return
}

AC: 
AutoComplete(A_GuiControl) 
Return
 
Done:
{
gui,submit,nohide
gui, destroy
msgbox Hero that will automatically be picked : %thisVar%
msgbox Position that will be automaticly called: %thatVar%
Loop
{
WinWaitActive ahk_class ApolloRuntimeContentWindow
{
PixelSearch, FoundaX, FoundaY, 912, 130, 996, 142, 0xFFFFFF, 0, Fast ;Find Search Box
if ErrorLevel = 0
{
MouseClick, left, 930, 135
Sleep 10
Send, %thisVar%
Sleep, 280
MouseClick, Left, 325, 212
Sleep 30
MouseClick, left, 355, 737
Sleep 10
Send, %thatVar%
Sleep 10
MouseClick, left, 922, 735
Sleep, 2000
}
PixelSearch, FoundbX, FoundbY, 296, 180, 350, 233, 0x303030, 0, Fast ;Exit Script
if ErrorLevel = 0
{
ExitApp
}
}
}
return
}
 
myguiclose:
{
ExitApp
return
}
 
;AutoComplete Section
AutoComplete(ctrl) 
{ 
static lf = "`n" 
If GetKeyState("Delete") or GetKeyState("Backspace") 
Return
SetControlDelay, -1
SetWinDelay, -1 
GuiControlGet, h, Hwnd, %ctrl% 
ControlGet, haystack, List, , , ahk_id %h% 
GuiControlGet, needle, , %ctrl% 
StringMid, text, haystack, pos := InStr(lf . haystack, lf . needle) 
, InStr(haystack . lf, lf, false, pos) - pos 
If text !=
{
if pos != 0
{ 
ControlSetText, , %text%, ahk_id %h% 
ControlSend, , % "{Right " . StrLen(needle) . "}+^{End}", ahk_id %h% 
} 
}
}
 
;Auto Update Champion Section
GetChampList(url)
{
global ChampCount
str := URLToVar(url)
StringReplace, str, str, `",,All
StringReplace, str, str, `,, %A_Space%,All
StringReplace, str, str, name, name, UseErrorLevel
ChampCount := ErrorLevel
Pos = 1
Loop, %ChampCount%
{
Pos := (RegExMatch(str, "name:(.*?)\stitle:", Champs, Pos)) + 2
If A_Index = 1
NameList = %Champs1%
else
NameList = %NameList%|%Champs1%
}
return NameList
}
 
URLToVar(URL)
{
    ComObjError(0)
    WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
    WebRequest.Open("GET", URL)
    WebRequest.Send()
    Return WebRequest.ResponseText()
        , ComObjError(0)
}
 
;Crash Script
F8::ExitApp

Let me know if there are any issues with the web download bit. Refer to original post for other problems. Enjoy!


If I helped you out and you would like to show appreciation, feel free to buy me a beer.  grin.png   btn_donateCC_LG.gif


scarnity
  • Members
  • 3 posts
  • Last active: Aug 01 2014 09:38 PM
  • Joined: 27 Jul 2014

Hi, I tried this in a custom game and on the program when I click OK it tells me the hero and the role and after the program closes



punkkapoika
  • Members
  • 29 posts
  • Last active: May 15 2019 02:29 PM
  • Joined: 14 May 2012
I love the fact you used official Lol API :) +1