Please bear in mind that it ONLY works for 1024x768 resolution (as I was running 2Moons in a window mode while developing this proof of concept for a friend.)
YOU WILL NEED TO BE RUNNING THE GAMEGUARD EMULATOR.
I will possibly be developing this further if there becomes enough demand, If ANYTHING it can be rather help for you people to see howto do pixel checksums (rather than check every single pixel in a square to see if something is okay, just checksum the entire square and see if it matches the checksum your expecting... look at code to see)
(THIS SCRIPT CAN BE INSTALLED ANYWHERE AS LONG AS YOU CONFIGURE THE INI PROPERLY)
First you will need to make a file called 'login.ini' and place the following contents in it:
Code: Select all
[setup]
username=YOUR USERNAME
password=YOUR PASSWORD
char=THE NUMBER OF YOUR CHAR IN THE CHAR SELECT SCREEN
server=THE SERVER
launchPath=THE PATH TO YOUR 2MOONS EXE
launchEXE=THE 2MOONS EXE
(bear in mind that the number of your char in select screen can change and is unreliable, no fix as of yet.)
Example login.ini:
Code: Select all
[setup]
username=randomuser
password=withrandompass
char=1
server=Trieste
launchPath=C:\Program Files (x86)\Acclaim\2moons\bin\
launchEXE=launcher.exe
now just place that in the same folder as the script (compiled or not, doesn't matter aslong as it can read the login.ini) and your off!
Feel free to comment and improve.
SCRIPT:
Code: Select all
$configUsername = IniRead ( "login.ini", "setup", "username", "" )
$configPassword = IniRead ( "login.ini", "setup", "password", "" )
$configCharSlot = IniRead ( "login.ini", "setup", "char", "" )
$configServer = IniRead ( "login.ini", "setup", "server", "" )
$launchPath = IniRead ( "login.ini", "setup", "launchPath", "" )
$launchEXE = IniRead ( "login.ini", "setup", "launchEXE", "" )
; Dim Server Select Database Vars
Dim $serverSelectTitleCoords[4] = [470, 500, 550, 510] ; The BBox coords of the area to checksum for if we are on server select screen.
Dim $serverSelectTitleChecksum = 4287529993 ; Server select title BBox checksum.
Dim $serverNameCoords[2][2] = [[493, 541], [493, 557]] ; The coords of the names for each server.
Dim $serverSelectButton[2] = [513, 693] ; The coords of the server select button.
; Dim Login Database Vars
Dim $logInTitleCoords[4] = [490, 595, 528, 606] ; The BBox coords of the area to checksum for if we are on log in screen.
Dim $logInTitleChecksum = 3530723475 ; Log In title BBox checksum.
Dim $loginSelectButton[2] = [447, 704] ; The coords of the login button.
; Dim Char Select Vars
Dim $charSelectButton[2] = [825, 50 + ($configCharSlot * 47)] ; The location of the character to select.
Dim $charSelectLoaded[4] = [679, 150, 679, 157] ; The BBox coords of the area to check if we are loaded
Dim $charSelectLoadedChecksum = 723059477 ; The checksum for the loaded bbox.
Dim $charConnectButton[2] = [510, 651] ; The location of the character connect button.
; Dim internal vars
Dim $serverCoords[2] = [0,0]
; Setup AutoIt too handle coords correctly.
AutoItSetOption ( "PixelCoordMode", 2)
AutoItSetOption ( "MouseCoordMode", 2)
ShellExecute($launchPath & "/" & $launchEXE, -1, $launchPath)
; Wait for 2Moons to be active window.
WinWaitActive("2Moons")
; Loop until 'Select server' image is display correctly (PixelChecksum)
waitTillPixelChecksum($serverSelectTitleCoords, $serverSelectTitleChecksum)
; Get Server Name Button Coords.
If $configServer == "Abaddon" Then
$serverCoords[0] = $serverNameCoords[0][0]
$serverCoords[1] = $serverNameCoords[0][1]
ElseIf $configServer == "Trieste" Then
$serverCoords[0] = $serverNameCoords[1][0]
$serverCoords[1] = $serverNameCoords[1][1]
Else
; Not Found? Fatal Error!
MsgBox(0, "Fatal Error", "Unable to select server...")
Exit
EndIf
; Click the server name button.
MouseClick ("left", $serverCoords[0], $serverCoords[1])
; Click the accept server button.
MouseClick ("left", $serverSelectButton[0], $serverSelectButton[1])
; Loop until 'Log In' image is display correctly (PixelChecksum)
waitTillPixelChecksum($logInTitleCoords, $logInTitleChecksum)
; Send the username and password.
Send ($configUsername & "{TAB}" & $configPassword)
; Click the login button.
MouseClick ("left", $loginSelectButton[0], $loginSelectButton[1])
; Loop until 'char select' screen is loaded correctly (PixelChecksum)
waitTillPixelChecksum($charSelectLoaded, $charSelectLoadedChecksum)
; Select the char.
MouseClick ("left", $charSelectButton[0], $charSelectButton[1])
; Select the char.
MouseClick ("left", $charConnectButton[0], $charConnectButton[1])
; Checks if the pixelchecksum of the box (x1, y1, x2, y2) equals the pixelchecksum supplied.
; Good for checking if parts of something are loaded.
Func waitTillPixelChecksum($coords, $pixelChecksum)
Do
$getChecksum = PixelChecksum($coords[0], $coords[1], $coords[2], $coords[3])
Until $getChecksum == $pixelChecksum
EndFuncAttachments
Here is the script






