Sign in to follow this  
Followers 0
mike1212

help

8 posts in this topic

#1 ·  Posted (edited)

Hello

I am trying to to get this code to return an accurate count, it returns a function command no matter what I put in "$Count = 3" variable in the loop.

What I need it to do is mouseClick("Right",289,792,1) when the count is 3 or less. I spent 5 hours :) getting error messages Closing loop, false tables on and on.:D when ever I tried to use the < then sign.

I get needs"=".

I think the troubled area is in the while loop!

Any help is welcomed.

Script Start - Add your code below here
Global $tablename = "Poker Academy Pro"
WinWaitActive($tablename)
While WinExists($tablename)
    sleep(10000)
    $Count = OccupiedSeats()
     If $Count = 5 Then
        $Count = 3
        mouseClick("Right",289,792,1)     EndIf
Wend
Func OccupiedSeats()
    Local $Count = 0
;Seat 1
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 2
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 3
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 4
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 5
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
    Return 5
    WinActivate( $tablename)

Thank You For Your Support.

Mike1212 :D

Edited by mike1212

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Wait a sec, you are checking the same pixel 5 times, you will get either 0 or 5 every time, change the x,y's for the PixelGetColor()'s

;Script Start - Add your code below here
Global $tablename = "Poker Academy Pro"
WinWaitActive($tablename)
While WinExists($tablename)
    sleep(10000)
    $Count = OccupiedSeats()
     If $Count <= 3 Then mouseClick("Right",289,792,1)
Wend
Func OccupiedSeats()
    Local $Count = 0
;Seat 1
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 2
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 3
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 4
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 5
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
    Return $Count
EndFunc
Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi Ejoc

Sorry for the same pixel areas, I have a ton of note pads with attempts to create a count loop.

I added your response to the code.

and remove a seat from the func, gave each seat there own pixel location.

;Script Start - Add your code below here
Global $tablename = "Poker Academy Pro"
WinWaitActive($tablename)
While WinExists($tablename)
    sleep(10000)
    $Count = OccupiedSeats()
    If $Count <= 3 Then mouseClick("Right",289,792,1)
Wend
Func OccupiedSeats()
    Local $Count = 0
;Seat 1
    If (PixelGetColor(638, 18) = 8497128) Then
        $Count = $Count + 1;
    EndIf
;Seat 2
    If (PixelGetColor(588,826) = 2207708) Then
        $Count = $Count + 1;
    EndIf
;Seat 3
    If (PixelGetColor(615,859) = 5035509 ) Then
        $Count = $Count + 1;
    EndIf    

        ;Seat 4
        If (PixelGetColor(726,863) = 4508908) Then
            $Count = $Count + 1;
        EndIf
        Return $Count

    EndFunc  ;==>OccupiedSeats

The same happens, when I run this code, it still moves the mouse and clicks.

It should not, seeing how 4 seats with correct pixels have been added to the func.

And the loop statment reads

If $Count <= 3 Then mouseClick("Right",289,792,1)

The count should be 4, hence no mouse movement. However this mouse still is moving :D

This is :)

I feel like I cant add.

Awaiting your response

Thank You Mike1212 :D

Edited by mike1212

Share this post


Link to post
Share on other sites

Try debugging it:

;Script Start - Add your code below here
Global $tablename = "Poker Academy Pro"
WinWaitActive($tablename)
While WinExists($tablename)
    sleep(10000)
    $Count = OccupiedSeats()
    MsgBox(0,"","OccupiedSeats Returned:" & $Count)
    If $Count <= 3 Then mouseClick("Right",289,792,1)
Wend
Func OccupiedSeats()
    Local $Count = 0
;Seat 1
    If (PixelGetColor(638, 18) = 8497128) Then
        MsgBox(0,"","Seat 1 Occupied")
        $Count = $Count + 1;
    EndIf
;Seat 2
    If (PixelGetColor(588,826) = 2207708) Then
        MsgBox(0,"","Seat 2 Occupied")
        $Count = $Count + 1;
    EndIf
;Seat 3
    If (PixelGetColor(615,859) = 5035509 ) Then
        MsgBox(0,"","Seat 3 Occupied")
        $Count = $Count + 1;
    EndIf   

       ;Seat 4
        If (PixelGetColor(726,863) = 4508908) Then
        MsgBox(0,"","Seat 4 Occupied")
            $Count = $Count + 1;
        EndIf
        Return $Count

    EndFunc ;==>OccupiedSeats

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites

WinWaitActive("Poker Academy Pro")

While WinExists("Poker Academy Pro")
   Sleep(10000)
   $Count = OccupiedSeats()
   If $Count <= 3 Then 
      MouseClick("Right",289,792,1)
   EndIf
Wend

Func OccupiedSeats()
   Local $Count = 0
   If PixelGetColor(638, 18) = 4801335 Then
      $Count = $Count + 1
   EndIf
   If PixelGetColor(397,129) = 3352861 Then
      $Count = $Count + 1
   EndIf
   If PixelGetColor(291,189) = 7695185 Then
      $Count = $Count + 1
   EndIf    
   If PixelGetColor(726,863) = 4508908 Then
      $Count = $Count + 1
   EndIf
   Return $Count
EndFunc

thats works fine for me, i tested it with different X,Y coords and colours and instead of a mouse click i used a msg box return the value of $count and it was correct and didnt appear if it was 4, one problem i encounted is in your click if its less then 3 it will continuosly click over and over, and when i was testing i had a little bot of trouble try to close it when testing because it keep clicking in the same place over and over again and i couldnt moce the mouse, but i was able to close it by using hotkeys and task manager =)


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

WinWaitActive("Poker Academy Pro")

While WinExists("Poker Academy Pro")
   Sleep(10000)
   $Count = OccupiedSeats()
   If $Count <= 3 Then 
      MouseClick("Right",289,792,1)
   EndIf
Wend

Func OccupiedSeats()
   Local $Count = 0
   If PixelGetColor(638, 18) = 4801335 Then
      $Count = $Count + 1
   EndIf
   If PixelGetColor(397,129) = 3352861 Then
      $Count = $Count + 1
   EndIf
   If PixelGetColor(291,189) = 7695185 Then
      $Count = $Count + 1
   EndIf    
   If PixelGetColor(726,863) = 4508908 Then
      $Count = $Count + 1
   EndIf
   Return $Count
EndFunc

thats works fine for me, i tested it with different X,Y coords and colours and instead of a mouse click i used a msg box return the value of $count and it was correct and didnt appear if it was 4, one problem i encounted is in your click if its less then 3 it will continuosly click over and over, and when i was testing i had a little bot of trouble try to close it when testing because it keep clicking in the same place over and over again and i couldnt moce the mouse, but i was able to close it by using hotkeys and task manager =)

<{POST_SNAPBACK}>

Hello Burrup

Still unable to get a count from this script. I linked it to a pixel color and

the mouse moves if it sees 1, 2 ,3, or 4. targets.

looked good until I pluged in 4 and it moved. So it cant be seeing a count.

Thanks Mike1212 :)

While 1
    $Mouse = MouseGetPos ()
    $Count = OccupiedSeats()
    IF $Count <= 3 Then
        MouseClick("Left",208,303,1,10)
        MouseMove ($Mouse[0],$Mouse[1],1)
    EndIf
    Sleep(10000)
Wend
Func OccupiedSeats()
    Local $Count = 0
    If PixelGetColor(38, 16) = 15727358 Then
        $Count = $Count + 1
    EndIf
    If PixelGetColor(38,16) =  15727358 Then
        $Count = $Count + 1
    EndIf
    If PixelGetColor(38,16) =  15727358 Then
        $Count = $Count + 1
    EndIf
    If PixelGetColor(38,16) =  15727358 Then
        $Count = $Count + 1
    EndIf
    Return $Count
EndFunc  ;==>OccupiedSeats

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

You just need to add some MsgBox's so you can figure out what is wrong. Ejoc has an example you can use already. Just make sure that it's going through all the if statements when you would expect.

Also use Au3Info to verify the colors your using for the positions you specify.

Edited by Kerberuz

Kerby

Share this post


Link to post
Share on other sites

You just need to add some MsgBox's so you can figure out what is wrong. Ejoc has an example you can use already. Just make sure that it's going through all the if statements when you would expect.

Also use Au3Info to verify the colors your using for the positions you specify.

<{POST_SNAPBACK}>

Thank You I failed to see the post, it now works fine.

Thank You Mike :)

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