Sign in to follow this  
Followers 0
t1g3r

H.e.l.p

8 posts in this topic

Hi Autoit guys, yes another noob at script writing. My problem is with a script that i have done myself and getting used to all the functions and things you can do is a nightmare so im calling out for help. i will attach the scrip so you can look at it. The problem is i seem to have a few errors but cant figure out how to sort them out i have spent days trying and try as i might i cant figure it out, if you are going to repley please explain in very simple terms as i am still new to all this. also would this script work after the correcttions.

thank you for all the help i receive.

script.au3

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi Autoit guys, yes another noob at script writing. My problem is with a script that i have done myself and getting used to all the functions and things you can do is a nightmare so im calling out for help. i will attach the scrip so you can look at it. The problem is i seem to have a few errors but cant figure out how to sort them out i have spent days trying and try as i might i cant figure it out, if you are going to repley please explain in very simple terms as i am still new to all this. also would this script work after the correcttions.

thank you for all the help i receive.

1. you are posting in the wrong forum -> moved it to support.

2. Here is the result when running your script through Tidy.. Indenting helps to make the code readable abd helps identify the issues:

; Pre-initialization : Set Name of Table
Global $tablename = "enter table name here"
; Initialize Buttons
$Foldbutton = "AfxWnd4217"
$Checkbutton = "Button1"
$Callbutton = "Button1"
$Betbutton = "AfxWnd4219"
$Raisebutton = "AfxWnd4219"
; Wait 6 seconds for the window of table to become active
WinWaitActive($tablename)
; Main Loop
While WinExists($tablename)
    Sleep(Random(1500, 2500))
   ;Fold
    If $action = 1 Then
        ControlClick($tablename, "", $Foldbutton);
    EndIf
   ;Check
   ;Sleep(Random(0, 2000));
;### Tidy Error: Level error -> ElseIf is closing previous While
ElseIf $action = 2 Then
    ControlClick($tablename, "" $Checkbutton);
;### Tidy Error: Level error -> EndIf is closing previous While
EndIf
;Call
;Sleep(Random(0, 2000));
;### Tidy Error: next line creates a negative tablevel.
ElseIf $action = 3 Then
ControlClick($tablename, "" $Callbutton);
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
EndIf
;Bet
;Sleep(Random(0, 2000));
;### Tidy Error: next line creates a negative tablevel.
ElseIf $action = 4 Then
ControlClick($tablename, "" $Betbutton);
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
EndIf
;Raise
;Sleep(Random(0, 2000));
;### Tidy Error: next line creates a negative tablevel.
ElseIf $action = 5 Then
ControlClick($tablename, "" $Raisebutton);
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
EndIf
;### Tidy Error: next line creates a negative tablevel.
;### Tidy Error: next line creates a negative tablevel for the line after it.
WEnd
;Poker Pro Actions
Func get $action (1 - 5)
    WinActivate("Poker Pro 2006" & $tablename);
   ;fold
    $control = ControlGetText("Poker Pro 2006 """ & $tablename, "Fold", static9);
    If $control = "Fold" Then
        WinActivate($tablename);
        Return 1
    EndIf
   ;check
    $control = ControlGetText("Poker Pro 2006 """ & $tablename, "Check", static9);
    If $control = "Check" Then
        WinActivate($tablename);
        Return 2
    EndIf
   ;call
    $control = ControlGetText("Poker Pro 2006 """ & $tablename, "Call", static9);
    If $control = "Call" Then
        WinActivate($tablename);
        Return 3
    EndIf
   ;bet
    $control = ControlGetText("Poker Pro 2006 """ & $tablename, "Bet", static9);
    If $control = "Bet" Then
        WinActivate($tablename);
        Return 4
    EndIf
   ;raise
    $control = ControlGetText("Poker Pro 2006 """ & $tablename, "Raise", static9);
    If $control = "Raise" Then
        WinActivate($tablename);
        Return 5
;### Tidy Error: Level error -> EndFunc is closing previous If
    EndFunc  ;==>get $action
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

dam, seems to be more errors than expected, well it is my first ever script, can anybody help me correct the mistakes or explain what i need to change and what to change it to.

thanks

Share this post


Link to post
Share on other sites

dam, seems to be more errors than expected, well it is my first ever script, can anybody help me correct the mistakes or explain what i need to change and what to change it to.

thanks

The ElseIf's need to be If's ..

and there is an EndIF missing before the EndFunc.

Thats all... :}


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

HI,

try this:

Still to come $action and the ControlIDs instead of $static9 .

; Pre-initialization : Set Name of Table
Global $tablename = "enter table name here"

; Initialize Buttons
$Foldbutton = "AfxWnd4217"
$Checkbutton = "Button1"
$Callbutton = "Button1"
$Betbutton = "AfxWnd4219"
$Raisebutton = "AfxWnd4219"
$action = "????????????????????"; ????????????????????????????????????????????????
$static9 = "???"; Put here the controlIDs!!!
; Wait 6 seconds for the window of table to become active
WinWaitActive($tablename)

; Main Loop
While WinExists($tablename) 
Sleep(Random(1500, 2500))

Select
;Fold
case $action = 1 
ControlClick($tablename, "", $Foldbutton)
;Check
;Sleep(Random(0, 2000));
case $action = 2 
ControlClick($tablename, "" , $Checkbutton)

;Call
;Sleep(Random(0, 2000));
case $action = 3 
ControlClick($tablename, "" ,$Callbutton)

;Bet
;Sleep(Random(0, 2000));
case $action = 4 
ControlClick($tablename, "" ,$Betbutton)


;Raise
;Sleep(Random(0, 2000));
case $action = 5 
ControlClick($tablename, "" ,$Raisebutton)
EndSelect
WEnd

;Poker Pro Actions
Func get($action)
WinActivate ("Poker Pro 2006" & $tablename)

;fold
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Fold", $static9)
if $control = "Fold" Then
WinActivate($tablename);
Return 1
EndIf

;check
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Check", $static9);
if $control = "Check" Then
WinActivate($tablename);
Return 2
EndIf

;call
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Call", $static9);
if $control = "Call" Then
WinActivate($tablename);
Return 3
EndIf

;bet
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Bet", $static9);
if $control = "Bet" Then
WinActivate($tablename);
Return 4
EndIf

;raise
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Raise", $static9);
if $control = "Raise" Then
WinActivate($tablename);
Return 5
EndIf
EndFunc

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

HI,

try this:

Still to come $action and the ControlIDs instead of $static9 .

; Pre-initialization : Set Name of Table
Global $tablename = "enter table name here"

; Initialize Buttons
$Foldbutton = "AfxWnd4217"
$Checkbutton = "Button1"
$Callbutton = "Button1"
$Betbutton = "AfxWnd4219"
$Raisebutton = "AfxWnd4219"
$action = "????????????????????"; ????????????????????????????????????????????????
$static9 = "???"; Put here the controlIDs!!!
; Wait 6 seconds for the window of table to become active
WinWaitActive($tablename)

; Main Loop
While WinExists($tablename) 
Sleep(Random(1500, 2500))

Select
;Fold
case $action = 1 
ControlClick($tablename, "", $Foldbutton)
;Check
;Sleep(Random(0, 2000));
case $action = 2 
ControlClick($tablename, "" , $Checkbutton)

;Call
;Sleep(Random(0, 2000));
case $action = 3 
ControlClick($tablename, "" ,$Callbutton)

;Bet
;Sleep(Random(0, 2000));
case $action = 4 
ControlClick($tablename, "" ,$Betbutton)
;Raise
;Sleep(Random(0, 2000));
case $action = 5 
ControlClick($tablename, "" ,$Raisebutton)
EndSelect
WEnd

;Poker Pro Actions
Func get($action)
WinActivate ("Poker Pro 2006" & $tablename)

;fold
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Fold", $static9)
if $control = "Fold" Then
WinActivate($tablename);
Return 1
EndIf

;check
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Check", $static9);
if $control = "Check" Then
WinActivate($tablename);
Return 2
EndIf

;call
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Call", $static9);
if $control = "Call" Then
WinActivate($tablename);
Return 3
EndIf

;bet
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Bet", $static9);
if $control = "Bet" Then
WinActivate($tablename);
Return 4
EndIf

;raise
$control = ControlGetText ("Poker Pro 2006 """ & $tablename, "Raise", $static9);
if $control = "Raise" Then
WinActivate($tablename);
Return 5
EndIf
EndFunc

So long,

Mega

thanks for the reply mega but what do i put on the action line.

$action = "????????????????????"; ????????????????????????????????????????????????

Share this post


Link to post
Share on other sites

thanks for the reply mega but what do i put on the action line.

$action = "????????????????????"; ????????????????????????????????????????????????

HI,

sorry I just fixed the bugs without regarding the logic. :mellow:

Your script doesn´t make sense at all. :)

There is no GUI and the functions ...

Maybe you should start with the GUI tutorial or search the forum for Autoit1-2-3 from Valuater.

Sorry, for the hard words! :) But I cannot get with a small glance what you are trying to achieve eith the script.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

HI,

sorry I just fixed the bugs without regarding the logic. :)

Your script doesn´t make sense at all. :o

There is no GUI and the functions ...

Maybe you should start with the GUI tutorial or search the forum for Autoit1-2-3 from Valuater.

Sorry, for the hard words! :mellow: But I cannot get with a small glance what you are trying to achieve eith the script.

So long,

Mega

He's not using an GUI, he's using a script that's been floating around this forum for over a year now I believe... It's been hacked up and spit out to produce the above results. I'm sure HardCopy would get a kick out of this post :)

[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