Sign in to follow this  
Followers 0
Jesus

POker script error, please help me.

2 posts in this topic

#1 ·  Posted (edited)

Alright, this will be a big post, but here it goes. I decided to try some online poker a month ago. I came across this program which I was refered to by a friend. I go through the process of installing Autoit v3, and everything is up and running as needed. I then start to work with the following script:

; Pre-initialization : Set Name of Table

Global $tablename = "Brauna - 5/10 Play Money - No Limit Hold'em"

; Initialize Buttons

; These are the button names you might have to change these for different poker clients

$FoldButton = "Afx400000206"

$CheckButton = "Afx4000002010"

$CallButton = "Afx4000002010"

$BetButton = "Afx4000002014"

$RaiseButton = "Afx4000002010"

; Set Coordinate mode to relative to window

AutoItSetOption ( "PixelCoordMode", 0 )

; Wait for the window of table to become active

WinWaitActive($tablename)

; Main Loop

While WinExists($tablename)

Sleep(300);

$FoldVisible = ControlCommand($tablename, "", $FoldButton, "IsVisible", "");

$RaiseVisible = ControlCommand($tablename, "", $RaiseButton, "IsVisible", "");

if $FoldVisible = 1 then

Sleep(Random(1500, 2500))

$action = GetAction();

; Fold/Check

; if we can check for free, then do that instead of folding

if $action = 1 then

if StringInStr(ControlGetText($tablename, "", $CheckButton), "Check") = 1 then

ControlClick($tablename, "", $CheckButton);

else

ControlClick($tablename, "", $FoldButton);

endif

; Check/Call

;Sleep(Random(0, 2000));

elseif $action = 2 then

ControlClick($tablename, "", $CallButton);

; Call/Bet

; if we can call then call otherwise bet

elseif $action = 3 then

if StringInStr(ControlGetText($tablename, "", $CallButton), "Call") = 1 then ControlClick($tablename, "", $CallButton);

else

ControlClick($tablename, "", $BetButton);

endif

; Bet/Raise

;Sleep(Random(0, 2000));

elseif $action = 4 then

ControlClick($tablename, "", $RaiseButton);

endif

WEnd

; Poker Inspector Actions

Func GetAction()

WinActivate ("Connected to """ & $tablename);

; red - fold

$color = PixelGetColor (338, 55);

if $color = 255 then

WinActivate($tablename);

return 1;

endif

;yellow

$color = PixelGetColor (338, 67);

if $color = 65535 then

WinActivate($tablename);

return 2;

endif

; blue

$color = PixelGetColor (338, 79);

if $color = 16776960 then

; sometimes bet or just call 50% of the time

WinActivate($tablename);

return 3;

endif

; green

$color = PixelGetColor (338, 88);

if $color = 65280 then

; If we've got the nuts or close to then sometimes just check 20% of the time

; otherwise raise or reraise

WinActivate($tablename);

return 4;

endif

WinActivate($tablename);

return 1;

EndFunc

; Checks how many empty seats there are

Func OccupiedSeats()

Local $Count = 0

Local $SeatOpenColor = 3246765

;Seat 1

If (PixelGetColor(517, 96) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

;Seat 2

If (PixelGetColor(665, 133) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

;Seat 3

If (PixelGetColor(735, 251) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

; Seat 4

If (PixelGetColor(660, 378) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

; Seat 5

If (PixelGetColor(493, 413) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

; Seat 6

If (PixelGetColor(262, 413) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

; Seat 7

If (PixelGetColor(108, 378) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

; Seat 8

If (PixelGetColor(53, 247) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

; Seat 9

If (PixelGetColor(126, 133) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

; Seat 10

If (PixelGetColor(264, 96) == $SeatOpenColor) Then

$Count = $Count + 1;

EndIf

return $Count;

EndFunc

Once this was done, I attempted to run this on Poker Stars, and it failed. Whenever I run this script I get the error message as follows:

Line 0 (Location of Au3 file)

elsif $action = 4 then

elsif ^ ERROR

Error:Variable used without being declared.

I then decided to make a change to some variables.

I make the following changes:

$FoldButton = "Afx:400000:206"

$CheckButton = "Afx:400000:2010"

$CallButton = "Afx:400000:2010"

$BetButton = "Afx4000002014"

$RaiseButton = "Afx:400000:2010"

I then attempt to run the script again, and I get the error as follows:

Line 51 (Location of Au3 file)

elsif $action = 4 then

elsif ^ ERROR

Error: variable used without being declared.

I was then thinking maybe its the xode for the buttons on the poker client, so when I used Wutoit Window Viewer, when I hovered over a button, I got the following for each:

Fold Button = Afx:400000:206

Check Button = Afx:400000:2010

Call Button = Afx:400000:2010

Bet Button = Afx4000002014

Raise Button = Afx:400000:2010

Is there a issue with the ":" after Afx?

and How can I stop the reproducing of the error messages?

Thanks.

Also including an attachment of a screenshot of the AutoIt Window viewer when I hovered over a button.

Edited by Jesus

Share this post


Link to post
Share on other sites



Use the [ code /code] tags on your script when posting something... makes it easier to read.

Get tired of seeing this script sometimes... It's all over the forum... just do a search for Poker.

elseif $action = 4 then

ControlClick($tablename, "", $RaiseButton);

endif

WEnd

elseif should be If

Besides that... I'm pretty sure this script is not going to work.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

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