Jump to content

What's wrong here


Recommended Posts

Hi! I got a basic issue with array. Dunno what's wrong here:

Dim $pixeldata[100][4] 

$pixelcount=0

func PixelDataErase()
    for $q1=0 to 99
        for $q2=0 to 3
            $pixeldata[$q1][$q2]=0
        next
    next
    $pixelcount=0
endfunc

And there's an error:

D:\Dokumenty\AutoIt\DrognanShopBot\drognan_sb.au3 (451) : ==> Expected a "=" operator in assignment statement.:
$pixeldata[$q1][$q2]=0
$pixeldata^ ERROR

PLZ Help. Thanks a lot :(

Link to comment
Share on other sites

The code snippet you provided runns fine here (Autoit 3.3.6.0).

Your script seems to be much larger - did you redefine $pixeldata somewhere?

What version of AutoIt do you run?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

The code snippet you provided runns fine here (Autoit 3.3.6.0).

Your script seems to be much larger - did you redefine $pixeldata somewhere?

What version of AutoIt do you run?

Yep, my script is much longer but this is just new thing used in only one function:

Func Scan2()
    
    $Wand = 2187742
    $Staff = 6535754
    $Scepter = 16766810
    
    $ItemBlock = 5394861
    
    PixelDataErase()
    
    for $sy=$ShopScanY1 to $ShopScanY2
        for $sx=$ShopScanX1 to $ShopScanX2
            If ToScan($sx,$sy) Then
                $pixel = PixelGetColor($sx,$sy)
                If ($pixel=$Wand OR $pixel=$Staff OR $pixel=$Scepter) Then
                    
                    $pixeldata[$pixelcount][0]=$sx
                    $pixeldata[$pixelcount][1]=$sy
                    
                    $px=$sx
                    $py=$sy
                    
                    While PixelGetColor($px,$sy)=$pixel
                        $px+=1
                    WEnd
                    
                    While PixelGetColor($sx,$py)=$pixel
                        $py+=1
                    WEnd
                    
                    $pixeldata[$pixelcount][2]=$px-$sx
                    $pixeldata[$pixelcount][3]=$py-$sy
                    
                    $pixelcount+=1
                EndIf
            endif
        next
    next
    
EndFunc

How about this?

Func PixelDataErase()
    Dim $pixeldata[UBound($pixeldata)][UBound($pixeldata,2)]
EndFunc   ;==>PixelDataErase

doesn't work :/

D:\Dokumenty\AutoIt\DrognanShopBot\drognan_sb.au3 (455) : ==> Array variable subscript badly formatted.:
Dim $pixeldata[UBound($pixeldata)][UBound($pixeldata,2)]
Dim $pixeldata[^ ERROR
Link to comment
Share on other sites

Hard to say without seeing the rest... try this...

Func Scan2()

    $Wand = 2187742
    $Staff = 6535754
    $Scepter = 16766810
    $ItemBlock = 5394861

    $pixelcount = 0
    Local $pixeldata[($ShopScanY2-$ShopScanY1)*($ShopScanX2-$ShopScanX1)][4]

    For $sy = $ShopScanY1 To $ShopScanY2
        For $sx = $ShopScanX1 To $ShopScanX2
            If ToScan($sx, $sy) Then
                $pixel = PixelGetColor($sx, $sy)
                If ($pixel = $Wand Or $pixel = $Staff Or $pixel = $Scepter) Then

                    $pixeldata[$pixelcount][0] = $sx
                    $pixeldata[$pixelcount][1] = $sy

                    $px = $sx
                    $py = $sy

                    While PixelGetColor($px, $sy) = $pixel
                        $px += 1
                    WEnd

                    While PixelGetColor($sx, $py) = $pixel
                        $py += 1
                    WEnd

                    $pixeldata[$pixelcount][2] = $px - $sx
                    $pixeldata[$pixelcount][3] = $py - $sy

                    $pixelcount += 1

                EndIf
            EndIf
        Next
    Next

    Return $pixeldata

EndFunc   ;==>Scan2
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...