Jump to content

similar to array problem I was having before only


ratacat
 Share

Recommended Posts

I tried my best to imitate what worked in last solution, but I think I am still missing something. Here is the function itself first, and then I'll post full code.

func get_seat2 ($seatselect)
;debug ()
    WinActivate ("no all-in")
    WinWaitActive ("no all-in")
    
while $gotseat = 0
    for $c = 0 to 8
        $cato = $seatselect[$c]
        msgbox(0, "$cato", $cato)
        $sendcordx = $cato[1]
        $sendcordy = $cato[2]
        msgbox(0, "$sendcordx, $sendcordy", $sendcordx & " , " & $sendcordy)
        findseat ( $taken, $sendcordx, $sendcordy)
        if $taken = 0 then
        mouseclick("left", $cato[1], $cato[2])
    ;chk_seat ($gotseat)
        do_buyin()
        endif
    next
WEnd
endfunc

the problem is that the cords aren't getting through. THat first msgbox returns blank, the second one returns 0, 0. Any suggestions or answers would be most welcome, here is rest of the code.

;-----------------------------------------Options----------------------------------------------
Opt("WinTitleMatchMode", 2)
Opt("TrayIconDebug", 1)

; Press Esc to terminate script, Pause/Break to "pause"
Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d


;-------------------------------------------Variables----------------------------------------
;VARIABLES
$jumpto = "3"
$taken = "0"
$level = "0"
$gotseat = 0
global $b, $ytable, $i, $lost

;-------------------------------------Select Seat Variables-----------------------------
dim $seat1[3]
dim $seat2[3]
dim $seat3[3]
dim $seat4[3]
dim $seat5[3]
dim $seat6[3]
dim $seat7[3]
dim $seat8[3]
dim $seat9[3]

dim $seatselect[9]

$seatselect[0] = $seat1
$seatselect[1] = $seat2
$seatselect[2] = $seat3
$seatselect[3] = $seat4
$seatselect[4] = $seat5
$seatselect[5] = $seat6
$seatselect[6] = $seat7
$seatselect[7] = $seat8
$seatselect[8] = $seat9

;--------------Seat#[0]= seat#
;--------------Seat#[1]= xcord
;--------------Seat#[2]= ycord

$seat1[0] = 1
$seat1[1] = 205
$seat1[2] = 375

$seat2[0] = 2
$seat2[1] = 410
$seat2[2] = 407

$seat3[0] = 3
$seat3[1] = 629
$seat3[2] = 371

$seat4[0] = 4
$seat4[1] = 754
$seat4[2] = 264

$seat5[0] = 5
$seat5[1] = 676
$seat5[2] = 131

$seat6[0] = 6
$seat6[1] = 538
$seat6[2] = 74

$seat7[0] = 7
$seat7[1] = 298
$seat7[2] = 72

$seat8[0] = 8
$seat8[1] = 161
$seat8[2] = 135

$seat9[0] = 9
$seat9[1] = 76
$seat9[2] = 271

;------------------------------Determining Level of Engagement---------------------------

If WinExists ("PokerStars Lobby") then
 $level = "1"
endif

If WinExists ("PokerStars Lobby - Logged in as sandycat") then
 $level = "2"
endif

If WinExists ("no all-in") then
 $level = "3"
endif

;------------------------------------Main Loop--------------------------------------------

if $level = "0" then
    do_pstars()
    sleep(300)
    do_logon()
    sleep(300)
    get_table()
    sleep(300)
    get_seat2($seatselect)
endif

If $level = "1" then
do_logon()
sleep(300)
get_table()
sleep(300)
get_seat2($seatselect)
endif

If $level = "2" then
get_table()
sleep(300)
get_seat2($seatselect)
endif

if $level = "3" then
get_seat2($seatselect)
endif





;-------------------------------------MINOR Functions-------------------------------------------
func debug ()
    msgbox(0, "debug", "BUG!!!!")
endfunc

func do_scroll_down ()
    WinActivate("PokerStars Lobby - Logged in as sandycat")
    WinWaitActive("PokerStars Lobby - Logged in as sandycat")
    mouseclick("left", 534, 422, 2)
endfunc


Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc


;----------------------------------LOGON FUNCTIONS------------------------

func do_pstars ()
;___changes localdir to pstars home and runs pstar's exe
    FileChangeDir ("C:\Program Files\PokerStars")
    run("PokerStars.exe")
endfunc




func do_logon ()
;msgbox (262144, "loopstart2", $jumpto)
;___activates pstars window if it is minimized or in backdrop
    WinActivate("PokerStars Lobby")
    WinWaitACtive("PokerStars Lobby")


;___Uses keyboard Alt + L + Enter to access login menu
;send("!l")
;send("{ENTER}")

;___Uses two sets of mouseclicks to access login menu
    mouseclick("Left", 22, 39)
    sleep(100)
    mouseclick("Left", 33, 53)
    sleep(300)

;___Making sure windows is focus'ed on PStars login screen
    WinActivate("Login")
    MouseClick("Left", 423, 236)

;___Entering a password, and waiting for client
    send("*******", 1)
    Send("{ENTER}")
endfunc


;-------------------------------SELECT TABLE----------------------------------

func get_table ()
    get_random()
    WinActivate("PokerStars Lobby - Logged in as sandycat")
    WinWaitActive("PokerStars Lobby - Logged in as sandycat")
    sleep(300)

;___Select Hold'em Tables, then sort ascending stakes
    MouseClick("Left", 42, 157)
    sleep(300)

;___Open up tourney listed as 'b' or THe bottom on the list.
    MouseCLick("Left", 265, $ytable, 2)
endfunc


func get_random ()
local $adjust
local $xtable
$adjust = Int(random(1, 20))
$xtable = "265"
if $adjust <= "20" then
$ytable = "425"
elseif $adjust <= "15" then
$ytable = "410"
endif
if $adjust <= "10" then
$ytable = "398"
elseif $adjust <= "5" then
$ytable = "385"
endif
if $adjust = "4" then
$ytable = "372"
endif
endfunc

;-----------------------FIND SEAT FUNTIONS - Order of Importance-------------------------------

func get_seat2 ($seatselect)
;debug ()
    WinActivate ("no all-in")
    WinWaitActive ("no all-in")
    
while $gotseat = 0
    for $c = 0 to 8
        $cato = $seatselect[$c]
        msgbox(0, "$cato", $cato)
        $sendcordx = $cato[1]
        $sendcordy = $cato[2]
        msgbox(0, "$sendcordx, $sendcordy", $sendcordx & " , " & $sendcordy)
        findseat ( $taken, $sendcordx, $sendcordy)
        if $taken = 0 then
        mouseclick("left", $cato[1], $cato[2])
    ;chk_seat ($gotseat)
        do_buyin()
        endif
    next
WEnd
endfunc


for $c = 0 to 3
    $cato = $seatselect[$c]
    for $i = 0 to 3
    send($cato[$i] & "{ENTER}")
    next
next




func findseat ( $taken, $sendcordx, $sendcordy)
    $checkx = $sendcordx - 8
    $checky = $sendcordy - 8
    MouseMove ( $sendcordx, $sendcordy)
    sleep (300)
    $colorcheck = PixelGetColor ( $checkx, $Checky)
    if $colorcheck = 16774863 then
    $taken = 1
    endif
    return $taken
endfunc


func do_buyin ()
WinWaitActive("Buy-in", "", 4)
if winactive("Buy-in") then
    mouseclick("left", 363, 333)
    sleep(300)
    mouseclick("left", 354, 487)
    sleep(300)
    mouseclick("left", 16, 416)
endif
endfunc


;---------------------------UNUSED----FUNCTIONS--------------------------------


func chk_seat ($gotseat)
    sleep(1000)
    if WinExists("Buy-in") then
    $b = 1
    endif
    if $b = 1 then
    $gotseat = "1"
    do_buyin()
    else
    $gotseat = "0"
    endif
    return $gotseat
endfunc


func get_seat ($taken)
    WinActivate ("no all-in")
    WinWaitActive ("no all-in")
;seat1
    chk_seat ($gotseat)
    findseat ( 0, 205, 375)
    if $taken = "0" then
    MouseClick("left", 205, 375)
    endif
    

;seat2
        chk_seat ($gotseat)
        if $taken = "1" then
        findseat(0, 410, 407)
        endif
        if $taken = "0" then
        MouseClick("left", 410, 407)
        $alltaken = "0"
        endif
;seat3
            chk_seat ($gotseat)
            if $taken = "1" then
            findseat(0, 629, 371)
            endif
            if $taken = "0" then
            MouseClick("left", 629, 371)
            $alltaken = "0"
            endif
;seat4
                chk_seat ($gotseat)
                if $taken = "1" then
                findseat(0, 754, 264)
                endif
                if $taken = "0" then
                MouseClick("left", 754, 264)
                $alltaken = "0"
                endif
;seat5
                    chk_seat ($gotseat)
                    if $taken = "1" then
                    findseat(0, 676, 131)
                    endif
                    if $taken = "0" then
                    MouseClick("left", 676, 131)
                    $alltaken = "0"
                    endif
;seat6
                        chk_seat ($gotseat)
                        if $taken = "1" then
                        findseat(0, 538, 74)
                        endif
                        if $taken = "0" then
                        MouseClick("left", 538, 74)
                        $alltaken = "0"
                        endif
;seat7
                            chk_seat ($gotseat)
                            if $taken = "1" then
                            findseat(0, 298, 72)
                            endif
                            if $taken = "0" then
                            MouseClick("left", 298, 72)
                            $alltaken = "0"
                            endif
;seat8
                                chk_seat ($gotseat)
                                if $taken = "1" then
                                findseat(0, 162, 135)
                                endif
                                if $taken = "0" then
                                MouseClick("left", 162, 135)
                                $alltaken = "0"
                                endif
;seat9
                                    chk_seat ($gotseat)
                                    if $taken = "1" then
                                    findseat(0, 76, 271)
                                    endif
                                    if $taken = "0" then
                                    MouseClick("left", 76, 271)
                                    $alltaken = "0"
                                    endif
                                    mouseclick("left", 786, 11)
                                    


endfunc
Link to comment
Share on other sites

Your code is syntactically correct according to Au3Check.

First, you are copying $seat1 to $seatselect[1], etc. BEFORE they are initialized with values. $seatselect[1] will not hold a reference to $seat1, but make a new copy. It is also better to use a two-dimensional array $seatselect[9][3], would have avoided this problem.

Second, there is some code in the global scope between som function definitions. If it is part of the main program, place it there.

Generally, use ByRef on array func arguments, unless you want to locally modify the array within the function only, which is not the case here.

blub

Link to comment
Share on other sites

thanks man I appreciate the help.

If you wouldn't mind, would someone just write a really short piece of code that relays to me the function of a bidimensional array...I understand why it would be needed, but I don't really understand how to use one.

Link to comment
Share on other sites

Think of it as a chart. Fix the last part of this script to test the behavior of arrays.

Dim $Array_A[10], $Array_B[10][6], $Array_C[10][6][6]
For $Count_Global = 0 To 9
     $Array_A[$Count_Global] = 'Text for number ' & String($Count_Global)
     For $Count_B = 0 To 5
          $Array_B[$Count_Global][$Count_B] = 'Text for column ' & String($Count_Global) & ' and row ' & String($Count_B)
          For $Count_C = 0 To 5
               $Array_C[$Count_Global][$Count_B][$Count_C] = 'Text for column ' & String($Count_Global) & ' and row ' & String($Count_B) & ' and level ' & String($Count_C)
          Next
     Next
Next
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access
MsgBox(0,'',$Array_*[*][*][*]);Put what array spot to access

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

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