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

Post gaming related scripts
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

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

23 Jul 2014, 13:37

-----OUTDATED

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.

Original Script ----> http://www.autohotkey.com/board/topic/9 ... m-release/

THIS REQUIRES YOU TO GO 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. :)

Code: Select all

#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.05`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
Enjoy and let me know if there are issues, I will try to fix them.
Last edited by Ruevil2 on 07 Nov 2016, 11:30, edited 1 time in total.
Ruevil2
Posts: 173
Joined: 14 Jul 2014, 10:39

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

08 Nov 2016, 11:19

This project has been left behind in favor of League Tools. League Tools is my current active gaming script and this feature could possibly be added to that script in the future. It is on the to-do list.

Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 24 guests