Jump to content

Array error


Recommended Posts

It's well working during "some time" afterwards this error occurs. first time it was like 25 minutes and second time 6 hours

CODE

Func filef()

$cptPC = 0

$PC = PixelGetColor( $i , $j )

$HG = PixelGetColor( $i-1 , $j-1 )

$HC = PixelGetColor( $i , $j-1 )

$HD = PixelGetColor( $i+1 , $j-1 )

$BG = PixelGetColor( $i-1 , $j+1 )

$BD = PixelGetColor( $i+1 , $j+1 )

$BC = PixelGetColor( $i , $j+1 )

If( ($PC = $HG) or ($PC = $HC) or ($PC = $HD) )Then

if ( $PC = $HG) then $cptPC = $cptPC + 1

if ( $PC = $HC) then $cptPC = $cptPC + 1

if ( $PC = $HD) then $cptPC = $cptPC + 1

if ( $cptPC = 1 ) Then

If ( ($PC = $BG) or ($PC = $BC) or ($PC =$BD)) Then

if ( $PC = $BG) then $cptPC = $cptPC + 1

if ( $PC = $BC) then $cptPC = $cptPC + 1

if ( $PC = $BD) then $cptPC = $cptPC + 1

if ( $cptPC = 2 ) Then

$EGG = PixelGetColor( $i-2 , $j-2 )

$EG = PixelGetColor( $i-1 , $j-2 )

$EC = PixelGetColor( $i , $j-2 )

$ED = PixelGetColor( $i+1 , $j-2 )

$EDD = PixelGetColor( $i+2 , $j-2 )

if ( ($PC = $EGG) or ($PC = $EG) or ($PC = $EC ) or ($PC = $ED) or ($PC = $EDD ) )Then

if ( $PC = $EGG) then $cptPC = $cptPC + 1

if ( $PC = $EG) then $cptPC = $cptPC + 1

if ( $PC = $EC) then $cptPC = $cptPC + 1

if ( $PC = $ED) then $cptPC = $cptPC + 1

if ( $PC = $EDD) then $cptPC = $cptPC + 1

if ( $cptPC = 3 ) Then

$DGG = PixelGetColor( $i-2 , $j+2 )

$DG = PixelGetColor( $i-1 , $j+2 )

$DC = PixelGetColor( $i , $j+2 )

$DD = PixelGetColor( $i+1 , $j+2 )

$DDD = PixelGetColor( $i+2 , $j+2 )

if ( ($PC = $DGG) or ($PC = $DG) or ($PC = $DC ) or ($PC = $DD) or ($PC = $DDD ) )Then

if ( $PC = $DGG) then $cptPC = $cptPC + 1

if ( $PC = $DG) then $cptPC = $cptPC + 1

if ( $PC = $DC) then $cptPC = $cptPC + 1

if ( $PC = $DD) then $cptPC = $cptPC + 1

if ( $PC = $DDD) then $cptPC = $cptPC + 1

if ( $cptPC = 4 ) Then

$lmm = PixelSearch( $i-2, $j-2,$i+2 , $j-2, $PC )

$lm = PixelSearch( $i-1, $j-1,$i+1, $j-1, $PC )

$lp = PixelSearch( $i-1, $j+1,$i+1 , $j+1, $PC )

$lpp = PixelSearch( $i-2, $j+2,$i+2 , $j+2, $PC )

$D1 = Abs( $lmm[0] - $lm[0])

$D2 = Abs( $lpp[0] - $lp[0])

IF($D1 < 2 ) Then

If($D2 < 2 ) Then

;~

return 1

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

EndIf

return 0

EndFunc

Edited by Moughor
Link to comment
Share on other sites

It's well working during "some time" afterwards this error occurs. first time it was like 25 minutes and second time 6 hours

Please use codebox vice code tags for long stuff like that.

Where does the error occur? No, I'm not going to download anything from imageshack...

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

  • Developers

Wild guess, but this code should have a check to ensure the returned infomation is an Array:

$lmm = PixelSearch($i - 2, $j - 2, $i + 2, $j - 2, $PC)
$lm = PixelSearch($i - 1, $j - 1, $i + 1, $j - 1, $PC)
$lp = PixelSearch($i - 1, $j + 1, $i + 1, $j + 1, $PC)
$lpp = PixelSearch($i - 2, $j + 2, $i + 2, $j + 2, $PC)
$D1 = Abs($lmm[0] - $lm[0])
$D2 = Abs($lpp[0] - $lp[0])

Because i don't think an array is returned by pixelsearch() when the color isn't found.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...