Jump to content

Error: Subscript used with non-Array variable


Recommended Posts

Hi guys,

I'm getting the following error:

D:\test6.au3 (53) : ==> Subscript used with non-Array variable.:

I think I might not be using array variables correctly. My intention is to get the pixel color of different locations on my screens. If the pixel color is a specifc color, I want to attribute if that window slot is available in an array variable. The practical application I'm trying to build is a tool that will lay out different poker tables on my screens.

Here is my code:

Global $SlotTournamentID; Array variable with the Tournament ID#
Global $AvailableSlots; Array variable with True False for each slot
Global Const $MultiTables = 2; Set number of tables to open at the same time
Global $SlotPosX            ; Horizontal (X) position of Tournament Window
Global $SlotPosY            ; Vertical (Y) position of Tournament Window
Global Const $FrogPixelLocationX = 239; Horizontal (X) pixel location of frog
Global Const $FrogPixelLocationy = 278; Vertical (Y) pixel location of frog
Global $PlayMoneyTitle = "Play Money"
Global Const $FTPBuyIn = "250"; Set Buy-In amount. "250", "2,000", "10,000", "100,000", "500,000", "1,000,000"

CheckAvailableSlots ($AvailableSlots)

Func CheckAvailableSlots (ByRef $ASlots); Closes busted-out tables and frees up the slotIDs. Verifies if the "Frog" is not present in one of the slots
    
    For $SlotNum = 0 To $MultiTables - 1 Step +1
        If $ASlots[$SlotNum] = PixelGetColor ( $SlotPosX [$SlotNum] + $FrogPixelLocationX, $SlotPosY [$SlotNum] + $FrogPixelLocationy) = 0x75260B Then
            If $FTPRealMoney = 0 Then
                WinWaitClose ( $FTPBuyIn & " " & $PlayMoneyTitle & " Sit & Go (" & $SlotTournamentID [$SlotNum])
                $SlotTournamentID [$SlotNum] = ""
            Else
                WinWaitClose ( $FTPBuyIn & " Sit & Go (" & $SlotTournamentID [$SlotNum])
                $SlotTournamentID [$SlotNum] = ""
            EndIf
        $ASlots[$SlotNum] = PixelGetColor ( $SlotPosX [$SlotNum] + $FrogPixelLocationX, $SlotPosY [$SlotNum] + $FrogPixelLocationy) <> 0x8EB34F
        EndIf
    Next
    Return $ASlots
EndFunc

Thanks for any help I can get.

Link to comment
Share on other sites

If $ASlots[$SlotNum] = PixelGetColor ( $SlotPosX [$SlotNum] + $FrogPixelLocationX, $SlotPosY [$SlotNum] + $FrogPixelLocationy) = 0x75260B ThenoÝ÷ Ù(hºW[y«­¢+Ù%ÀÌØíM±½ÑÍlÀÌØíM±½Ñ9ÕµtôA¥á±Ñ
½±½È ÀÌØíM±½ÑA½Í`lÀÌØíM±½Ñ9Õµt¬ÀÌØíɽA¥á±1½Ñ¥½¹`°ÀÌØíM±½ÑA½ÍdlÀÌØíM±½Ñ9Õµt¬ÀÌØíɽA¥á±1½Ñ¥½¹ä¤¹|)A¥á±Ñ
½±½È ÀÌØíM±½ÑA½Í`lÀÌØíM±½Ñ9Õµt¬ÀÌØíɽA¥á±1½Ñ¥½¹`°ÀÌØíM±½ÑA½ÍdlÀÌØíM±½Ñ9Õµt¬ÀÌØíɽA¥á±1½Ñ¥½¹ä¤ôÁàÜÔÈØÁQ¡¸

This is just a wrong syntax though. You should be comparing X for an X and Y for an Y.

Edit: Ignore the X and Y part ^^ I though it's somehow related to GetMousePos() :lmao:, rofl AutoIt code corrupted. :)

Edited by Authenticity
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...