Jump to content

[Unsolved] Function Order (pixelsearch)


Recommended Posts

Hey guys Heres my code to begin with

Func GetOuttaA1Noob()
;Set this up asap then incorporate into Func Checkingame()
    Sleep(500)
; To find the map layout find, go to saved.au3
;Now lets bounce
; Scannign for square 1
$Scan1  =  PixelSearch(0, 0, 800, 600, $Act1FirstSquare)
If Not @Error Then
FileWriteLine($File, "Map Layout: Your in A1 and the layout is act 1 map A " & @HOUR & ":" & @MIN & "." & @SEC & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @LF)
Sleep(500)
MouseClick("right", $Scan1[0], $Scan1[1])
Sleep(1000)
$GreenScan2 = PixelSearch( 0, 0, 800, 600, $GreenSquare)
MouseClick("Left", $GreenScan2[0], $GreenScan2[1])
Sleep(1000)
$RedScan2 = PixelSearch( 0, 0, 800, 600, $RedSquare)
MouseClick("Left", $RedScan2[0], $RedScan2[1])
Sleep(1000)
$PurpleScan2 = PixelSearch( 0, 0, 800, 600, $PurpleSquare)
MouseClick("Left", $PurpleScan2[0], $PurpleScan2[1])
Sleep(1000)
EndIf
If @Error <> 0 Then
FileWriteLine($File, "Couldnt find map layout. Failed at search 1 " & @HOUR & ":" & @MIN & "." & @SEC & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @LF)
CreateFailedGame()
EndIf

;Scanning for square 2
;Square 2 Scinario
Sleep(500)
$Scan2 = PixelSearch(0, 0, 800, 600, $Act1SecondSquare)
If Not @Error Then
    Sleep(500)
MouseClick("right", $Scan2[0], $Scan2[1])
Sleep(500)
FileWriteLine($File, "Map Layout: Your in A1 and the layout is act 1 map B " & @HOUR & ":" & @MIN & "." & @SEC & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @LF)
$GreenScan1 = PixelSearch( 0, 0, 800, 600, $GreenSquare)
MouseClick("Left", $GreenScan1[0], $GreenScan1[1])
Sleep(1000)
$RedScan1 = PixelSearch( 0, 0, 800, 600, $RedSquare)
MouseClick("Left", $RedScan1[0], $RedScan1[1])
Sleep(1000)
$PurpleScan1 = PixelSearch( 0, 0, 800, 600, $PurpleSquare)
MouseClick("Left", $PurpleScan1[0], $PurpleScan1[1])
Sleep(1000)
EndIf
If @Error <> 0 Then
FileWriteLine($File, "Couldnt find map layout. Failed at search 2 " & @HOUR & ":" & @MIN & "." & @SEC & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @LF)
CreateFailedGame()
EndIf

;Scanning for square 3
;Square 3 Scinario
Sleep(500)
$Scan3 = PixelSearch(0, 0, 800, 600, $Act1ThirdSquare)
If Not @Error Then
    Sleep(500)
MouseClick("right", $Scan3[0], $Scan3[1])
Sleep(500)
FileWriteLine($File, "Map Layout: Your in A1 and the layout is act 1 map C " & @HOUR & ":" & @MIN & "." & @SEC & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @LF)
$RedScan3 = PixelSearch( 0, 0, 800, 600, $RedSquare)
MouseClick("Left", $RedScan3[0], $RedScan3[1])
Sleep(1000)
$GreenScan3 = PixelSearch( 0, 0, 800, 600, $GreenSquare)
MouseClick("Left", $GreenScan3[0], $GreenScan3[1])
Sleep(1000)
$PurpleScan3 = PixelSearch( 0, 0, 800, 600, $PurpleSquare)
MouseClick("Left", $PurpleScan3[0], $PurpleScan3[1])
Sleep(1000)
EndIf
If @Error <> 0 Then
FileWriteLine($File, "Couldnt find map layout. Failed at search 3 " & @HOUR & ":" & @MIN & "." & @SEC & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @LF)
CreateFailedGame()
EndIf
Sleep(500)

;Scannnig for square 4
;Square 4 Scinario
$Scan4 = PixelSearch(0, 0, 800, 600, $Act1FourthSquare)
If Not @Error Then
    Sleep(500)
MouseClick("right", $Scan4[0], $Scan4[1])
Sleep(500)
FileWriteLine($File, "Map Layout: Your in A1 and the layout is act 1 map D " & @HOUR & ":" & @MIN & "." & @SEC & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @LF)
$GreenScan4 = PixelSearch( 0, 0, 800, 600, $GreenSquare)
MouseClick("Left", $GreenScan4[0], $GreenScan4[1])
Sleep(1000)
$PurpleScan4 = PixelSearch( 0, 0, 800, 600, $PurpleSquare)
MouseClick("Left", $PurpleScan4[0], $PurpleScan4[1])
Sleep(1000)
EndIf
If @Error <> 0 Then
FileWriteLine($File, "Couldnt find map layout. Failed at search 4 " & @HOUR & ":" & @MIN & "." & @SEC & " - " & @MDAY & "/" & @MON & "/" & @YEAR & @LF)
CreateFailedGame()
EndIf
Sleep(1000)
MouseClick("Left", 370, 110); Waypoint Selection
Sleep(1000)
MouseClick("Left", 115, 162); Hoggarth or wtf ever selection
Sleep(1000)
Walktoportal2()
    EndFunc

OK so what i want this to do is.

It scans the screen for 4 colors, $Purple and stuff Depending on which color it finds (Map layout) it then chooses which path to take (based off green red purple boxes

my problem is that it only does the 1st pixelsearch, and it doesnt go threw all the different 4 pixelscans.

What can i do to fix this problem

Link to comment
Share on other sites

because it logs the event Failed at search 1-4 for each pixelsearch.

When i find the layout and test the pixel search for the certain layout with just it, it works fine.

In my log, it doesnt show Failed at search 1 2 3 4 ( 4 lines) just one.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...