#include <file.au3>
#include <array.au3>
#include <String.au3>
#include <GuiConstantsEX.au3>
#include <Staticconstants.au3>
;Hotkeys
#Region "HotKeys"
HotKeySet("{F1}", "SetMiningStuff")
HotKeySet("{F2}", "MiningWithTori")
HotKeySet("{ESC}","Close")
#EndRegion
;Globals
#Region "Globals"
Global $LeftCritter, $RightCritter, $UpCritter, $DownCritter, $LCPixel, $RCPixel, $UCPixel, $DCPixel, $pos, $hWnd, $LPixel, $RPixel, $UPixel, $DPixel, $miner
Global $LeftCritter_X, $LeftCritter_Y, $RightCritter_X, $RightCritter_Y $UpCritter_X, $UpCritter_Y, $DownCritter_X, $DownCritter_Y
#EndRegion
$RightCritter = StringSplit("772,500",",")
$LeftCritter = StringSplit("619,562",",")
$UpCritter = StringSplit("618,560",",")
$DownCritter = StringSplit("649,457",",")
;Self Explainitory
$RightCritter_X = $RightCritter[1]
$RightCritter_Y = $RightCritter[2]
$LeftCritter_X = $LeftCritter[1]
$LeftCritter_Y = $LeftCritter[2]
$UpCritter_X = $UpCritter[1]
$UpCritter_Y = $UpCritter[2]
$DownCritter_X = $DownCritter[1]
$DownCritter_Y = $DownCritter[2]
while 1
sleep(20)
WEnd
Func SetMiningStuff()
$hWnd = WinGetHandle('Nostale')
;Use this as SOON as the Start button of the Minigame is clicked
;This sets the Pixel colors to watch for.
$RCPixel = PixelGetColor($RightCritter_X, $RightCritter_Y, $hWnd)
$LCPixel = PixelGetColor($LeftCritter_X, $LeftCritter_Y, $hWnd)
$UCPixel = PixelGetColor($UpCritter_X, $UpCritter_Y, $hWnd)
$DCPixel = PixelGetColor($DownCritter_X, $DownCritter_Y, $hWnd)
EndFunc
Func MiningWithTori()
$miner = NOT $miner
While $miner
$hWnd = WinGetHandle('Nostale')
;This Sets new Variables as the Constant Pixel Color within ths given coords
$RCPixel = PixelGetColor($RightCritter_X, $RightCritter_Y, $hWnd)
$LCPixel = PixelGetColor($LeftCritter_X, $LeftCritter_Y, $hWnd)
$UCPixel = PixelGetColor($UpCritter_X, $UpCritter_Y, $hWnd)
$DCPixel = PixelGetColor($DownCritter_X, $DownCritter_Y, $hWnd)
;If the Constant Pixel color changes
Sleep("40")
If $RPixel <> $RCPixel then
Send("{RIGHT}",0)
Sleep("300")
EndIf
If $LPixel <> $LCPixel then
Send("{LEFT}",0)
Sleep("300")
EndIf
If $UPixel <> $UCPixel then
Send("{Up}",0)
Sleep("300")
EndIf
If $DPixel <> $DCPixel then
Send("{Down}",0)
Sleep("300")
WEnd
EndFunc
Func Close()
Exit 0
EndFunc