Pretty new to AutoIt, so probably a very noob error. Everything goes fine until the "Func login()" line, it just stop and doesnt do anything. Any idea?
Code:
#include <ImageSearch.au3>
;Alpha, No GUI LoL Bot
HotKeySet("q", "stopbot") ;Emergency Stop
;Open League of Legends Launcher
Run("C:\Riot Games\League of Legends\" & "\lol.launcher.exe", "", @SW_MAXIMIZE)
Sleep(500)
;Press "Play" in League of Legends Launcher
$x = 0
$y = 0
start()
While 1
Sleep(500)
WEnd
Func start()
While 1
$result = _ImageSearch("Pressplay.bmp", 0, $x, $y, 1)
If $result = 1 Then
MouseMove($x, $y)
MouseClick("left")
EndIf
WEnd
EndFunc ;==>start
;Inputs Username and Password from File
$accountfile = @ScriptDir & "\account.txt"
$x1 = 780
$x2 = 520
$y1 = 780
$y2 = 580
Func login()
While 1
$Openusr = FileOpen($accountfile)
$Readusr = FileReadLine($Openusr, 1)
ClipPut($Readusr)
FileClose($Openusr)
MouseMove($x1, $y1)
MouseClick("left")
Send("{LCTRL}+v")
$Openpw = FileOpen($accountfile)
$Readpw = FileReadLine($Openpw, 2)
ClipPut($Readpw)
FileClose($Openpw)
Sleep(5000)
MouseMove($x2, $y2)
MouseClick("left")
Send("{LCTRL}+v")
WEnd
EndFunc ;==>login
;Stops the bot with HotKeySet "q" - ALWAYS LAST FUNC
Func stopbot()
Exit 0
EndFunc ;==>stopbot
Rorc, if these functionnames are used then his Editor would show it up by colored functionnames.
The problem why it doesn't work is because he didn't call login().
you can use Mouseclick("left",x,y,amount of clicks,movespeed)
and your script keeps in the first while 1, since there is no escape out of it. only the hotkey kills the whole script