**** THIS SCRIPT ONLY WORK IN WINDOW MODE ****
**** THIS SCRIPT ONLY WORK IN WINDOW MODE ****
Hi all, scripted an autoIt script that will do auto login and autopot
This script utilize a configuration file name config.dat to do the following, so it should be in the same folder as where the script is.
To terminate the script just press F11.
Auto Login (ID must be save)
Default Server/Channel Selection
Default Character Selection
As for the autopot, it is scripted to run @ 70% of the HP/MP level. (HP pot at key 1, MP pot at key 2)
It is scripted base on the game window x,y location.
So it should still work for any screen resolution and any location the game screen is drag to.
Note that the game will be minimize and restore during some parts of the auto login as during focusing on the game the mouse refuses to move. So the script will minimize the game shift the mouse, restore the game and click on where the mouse is.
So there might be high chances that it will not work good for slower computer. If that happen just edit the function "clickloc($locx, $locy)" and add some delay into the script.
CURRENTLY MY SCREEN IS USING 1680 x 1050.
SO PLEASE LET ME KNOW
The actual autoIt Script
Code:
;HotKey for terminating the script
HotKeySet("{F11}", "Terminate")
#include <file.au3>
$i = 1
Dim $aRecords
;Window title for dragonica should be changed after every patch
$WinTitle = "Dragonica (Client Ver : 0.1.23)"
;Force focus on dragonica
WinActivate($WinTitle)
;Reading config file if error reading terminate script
If Not _FileReadToArray("config.dat",$aRecords) Then
MsgBox(4096,"Error", "Error reading configuration")
Exit
EndIf
;Continuous looping
While $i <> 0
if $i = 2 Then
Sleep(500)
$i = 1
Else
;If autologin flag is true in the config file and game exist
If ($aRecords[2] = 'True' And WinExists($WinTitle)) Then
checkLogin()
EndIf
;If the game exist check for hp and mp
If (WinExists($WinTitle)) Then
checkHp70()
checkMp70()
EndIf
$i = 2
EndIf
WEnd
Func checkLogin()
;Getting window x,y,width,height
$size = WinGetPos($WinTitle)
;Setting flags for login/server/character selection to false
$isLoginScreen = False
$isServerScreen = False
$isCharScreen = False
;Searching for 3 pixel to determine if it is really the login screen
If (Hex(PixelGetColor( $size[0]+419 , $size[1]+485 ), 6) = '4d3413' And Hex(PixelGetColor( $size[0]+750 , $size[1]+440 ), 6) = 'f2455e' And Hex(PixelGetColor( $size[0]+190 , $size[1]+520 ), 6) = '89b694') Then
$isLoginScreen = True
EndIf
;If it is the login screen proceed to login
If $isLoginScreen = True Then
;Send password keypress to the game
ControlSend($WinTitle,'','',$aRecords[4]);
sleep(200)
;Time to login.
ControlSend($WinTitle,'','','{ENTER}');
EndIf
Sleep(1000)
;Searching for 3 pixel to determine if it is really the server selection screen
If (Hex(PixelGetColor( $size[0]+60 , $size[1]+55 ), 6) = 'fbc34f' And Hex(PixelGetColor( $size[0]+515 , $size[1]+455 ), 6) = 'f64500' And Hex(PixelGetColor( $size[0]+515 , $size[1]+700 ), 6) = 'f64700') Then
$isServerScreen = True
EndIf
If $isServerScreen = True Then
;Default server selection screen Kaye/Elga
If $aRecords[6] = 'Kaye' Then
ClickLoc($size[0]+210, $size[1]+350)
ElseIf $aRecords[6] = 'Elga' Then
ClickLoc($size[0]+330, $size[1]+350)
EndIf
Sleep(500)
;Default channel selection
If($aRecords[8] = 1 Or $aRecords[8] = 2 Or $aRecords[8] = 3) Then
ClickLoc($size[0]+440+(($aRecords[8]-1)*160), $size[1]+518)
ElseIf($aRecords[8] = 4 Or $aRecords[8] = 5 Or $aRecords[8] = 6) Then
ClickLoc($size[0]+440+(($aRecords[8]-4)*160), $size[1]+561)
ElseIf($aRecords[8] = 7 Or $aRecords[8] = 8 Or $aRecords[8] = 9) Then
ClickLoc($size[0]+440+(($aRecords[8]-7)*160), $size[1]+604)
ElseIf($aRecords[8] = 10) Then
ClickLoc($size[0]+440+(($aRecords[8]-10)*160), $size[1]+647)
EndIf
EndIf
Sleep(2000)
;Searching for 3 pixel to determine if it is really the character selection screen
If (Hex(PixelGetColor( $size[0]+25 , $size[1]+775 ), 6) = 'aa7640' And Hex(PixelGetColor( $size[0]+1010 , $size[1]+775 ), 6) = 'dfb677' And Hex(PixelGetColor( $size[0]+1010 , $size[1]+35 ), 6) = 'dbb070') Then
$isCharScreen = True
EndIf
;Default character screen
If $isCharScreen = True Then
ClickLoc($size[0]+625, $size[1]+185+(($aRecords[10]-1)*145))
Sleep(200)
ControlSend($WinTitle,'','','{ENTER}');
EndIf
Sleep(3000)
EndFunc
Func checkHp70()
$size = WinGetPos($WinTitle)
;checking if hp falls below 70%
$checkHp70 = Hex(PixelGetColor( $size[0]+675 , $size[1]+730 ), 6)
;If hp falls below 70% autopot
If $checkHp70 = '343434' Then
ControlSend($WinTitle,'','','{1}');Uses hp pots
Sleep(10000)
EndIf
EndFunc
Func checkMp70()
$size = WinGetPos($WinTitle)
;checking if mp falls below 70%
$checkMp70 = Hex(PixelGetColor( $size[0]+675 , $size[1]+767 ), 6)
;If mp falls below 70% autopot
If $checkMp70 = '6D6D6C' Then
ControlSend($WinTitle,'','','{2}');Uses mp pots
Sleep(10000)
EndIf
EndFunc
;FUNCTION FOR DOING CLICKING ON LOCATION OF THE SCREEN
;THIS FUNC WILL MINIMIZE AND RESTORE THE GAME INTERFACE
;AS DURING FOCUSING ON THE GAME THE MOUSE WILL NOT MOVE
Func ClickLoc($LocX, $LocY)
WinSetState($WinTitle, "", @SW_MINIMIZE)
MouseMove($LocX, $LocY, 0)
WinActivate($WinTitle)
ControlClick($WinTitle,'','','primary', 3)
ControlClick($WinTitle,'','','primary', 3)
EndFunc
Func Terminate()
Exit 0
EndFunc
Code:
[AutoLogin] True [Password] Password [DefaultServer] Kaye [DefaultChannel] 5 [DefaultCharacter] 1
[AutoLogin] >>> True/False
[Password] >>> Autologin password
[Default Server] >>> Kaye/Elga
[DefaultChannel] >>> 1 to 10
[DefaultCharacter] >>> 1 to 4
The below is just an example
Code:
[AutoLogin] True [Password] Password [DefaultServer] [DefaultChannel] 5 [DefaultCharacter]
It will skip the default server selection and proceed to choose channel 5.
And no character will be selected at the character selection screen.
Pardon me for a poorly written script. But I'm just sharing






