Sign in to follow this  
Followers 0
Makalele

What's wrong here

7 posts in this topic

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 :(


Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

it is running perfectly fine here :(

array.au3 is included? I am just guessing - reinstallation of autoit will help?

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Rotfl i found it :)

Dim can't be inside code. It has to be on start :( Thank you anyway. Topic can be closed :)


Share this post


Link to post
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
Sign in to follow this  
Followers 0