Code:
local playbutton = screen.loadImage("res/288257.png"); --playbutton image
local playmode = screen.loadImage("res/10004.png"); -- play mode image '5v5 summoners Rift'
local gametype = screen.loadImage("res/938567.png"); -- game type 'normal blind pick'
local solobutton = screen.loadImage("res/405470.png"); -- solo queue button
local queuepop = screen.loadImage("res/393985.png"); -- queue pop accept or decline
local champion = screen.loadImage("res/679088.png"); -- champion to select'urgot'
local lockin = screen.loadImage("res/814367.png"); -- lock in button image
local launcherlogo = screen.loadImage("res/984684.png"); --launcher league logo
local leaguewindow = window.getWinHandles("PVP.net")[1]; --league of legends pvp launcher window handle
local launcherRegion = nil; --region of the league pvp launcher
--small function to get the length of a table
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
--find and press the play button
function pressPlayButton()
local found,x,y = screen.find(launcherRegion,playbutton,.88);
if found then
local xoff = math.random(10,60);
local yoff = math.random(10,50);
log.write("play button found at x:"..x.." y:"..y);
input.moveMouse(x+xoff,y+yoff);
input.leftClick();
script.sleep(1500);
return true;
else
log.write("could not find play button.");
script.sleep(1000);
return false;
end
end
--selects the game mode and queue type
function selectQueue()
local found,x,y = screen.find(launcherRegion,playmode,.55);
if found then
local xoff = math.random(10,60);
local yoff = math.random(10,20);
input.moveMouse(x+xoff,y+yoff);
log.write("selecting game mode");
input.leftClick();
script.sleep(1000);
local found1,xx,yy = screen.find(launcherRegion,gametype,.55);
if found1 then
xoff = math.random(10,60);
yoff = math.random(100,110);
input.moveMouse(xx+xoff,yy+yoff);
input.leftClick();
script.sleep(1000);
return true;
end
end
log.write("could not select queue");
return false;
end
--presses the solo queue button
function enterSoloQueue()
local found,x,y = screen.find(launcherRegion,solobutton,.88);
if found then
log.write("entering queue...");
local xoff = math.random(10,70);
local yoff = math.random(10,40);
input.moveMouse(x+xoff,y+yoff);
input.leftClick();
script.sleep(1000);
return true;
end
log.write("could not find queue button");
return false;
end
--quen the queue pops it clicks accept
function queuePopped()
local found,x,y = screen.find(launcherRegion,queuepop,.88);
if found then
log.write("queue popped!");
local xoff = math.random(10,20);
local yoff = math.random(10,15);
input.moveMouse(x+xoff,y+yoff);
input.leftClick();
script.sleep(1000);
return true;
end
return false;
end
--locks in the champion pick
function lockIn()
local found,x,y = screen.find(launcherRegion,lockin,.88);
if found then
local xoff = math.random(10,30);
local yoff = math.random(10,20);
input.moveMouse(x+xoff,y+yoff);
input.leftClick();
log.write("locked in!")
return true;
end
return false;
end
--selects the desired champion
function selectChampion()
local found,x,y = screen.find(launcherRegion,champion,.88);
if found then
local xoff = math.random(10,20);
local yoff = math.random(10,15);
input.moveMouse(x+xoff,y+yoff);
input.leftClick();
script.sleep(1000);
log.write("champion selected!");
return true;
end
return false;
end
--waits for the queue to pop and selects and locks in the champ, if champ select is exited then it
--waits for queue pop again.
function waitForQueuePop()
if(window.getWinHandles("League of Legends")[1]~=nil) then
return true;
end
while selectChampion() == false do
queuePopped();
log.write("waiting for queue pop....");
script.sleep(500);
end
if lockIn() then
local found = screen.find(launcherRegion,launcherlogo,.88);
while (found==false) do
if(window.getWinHandles("League of Legends")[1]~=nil) then
break;
end
log.write("waiting for game to start!")
found = screen.find(launcherRegion,launcherlogo,.88);
script.sleep(1500);
end
return waitForQueuePop();
end
end
--start the auto queuer
function start()
if leaguewindow==nil then
log.write("no league window found");
return;
end
launcherRegion = screen.createRegion(window.getRect(leaguewindow));
if pressPlayButton() then
if selectQueue() then
if enterSoloQueue() then
if waitForQueuePop() then
log.write("GAME STARTED!");
end
end
end
end
end
------------
start();
If you have any questions or suggestions please feel free to post