Jump to content

Script Example


Recommended Posts

I am a complete noob to autoit and scripts. Ive messed around with examples and gotten somethings to work by myself. So forgive me if it seems by asking im taking the easy way out.

But what Im trying to do is create a script for online poker (not a bot) that I can enter in an amount for plus/minus, then when that amount is reached it logs me off of the program and closes it. For example, if the amount is 100, then when i reach 100 more or less than I started with, it will close out automatically. Im thinking it will have to take into account my seat or whatever it can to track my money.

Can someone recommend me an example of something like this?

Thanks a lot

Link to comment
Share on other sites

Hello Birthritual576. It's depend on how the Poker game handles the reaction with the user. I mean, via edit boxes? buttons? or perhaps it's just enough to use 'AutoIt Window Info' tool that is installed in the same directory as AutoIt is and use the help file for functions like WinWaitActive, WinGetHandle, ControlSend or ControlClick functions... It's rather versatile way and for someone that don't know this game it's quite hard to give you an example for a script that might be legitimate for this purpose.

Link to comment
Share on other sites

Hello Birthritual576. It's depend on how the Poker game handles the reaction with the user. I mean, via edit boxes? buttons? or perhaps it's just enough to use 'AutoIt Window Info' tool that is installed in the same directory as AutoIt is and use the help file for functions like WinWaitActive, WinGetHandle, ControlSend or ControlClick functions... It's rather versatile way and for someone that don't know this game it's quite hard to give you an example for a script that might be legitimate for this purpose.

I play on Pokerstars at the moment, if that helps, but the site does use buttons. when u sit in at a table, a window pops up that ask how much u want to start with. this may be where i want to look at but i dont know. ill take a look at the autoit window info tool and see if i can understand it.

Link to comment
Share on other sites

If this page is a plain HTML and it's possible to retrieve this info via InternetExplorer.Application object I think that you might want to read about the _IE* functions, a little bit understanding of the HTML form and tags can help a lot, unless it's some javascript or flash game which might complicate things, if this is the case you can try to use some flash decompiler, maybe it can help you. Good-luck.

Link to comment
Share on other sites

http://www.pokerinspector.com/forum/viewto...e98d347fbf2e963

this shows examples of a bot i believe. if possible, maybe i could modify it down to do what i ask. a poker bot doesnt really help u win, maybe against beginners, and it usually means u get kicked from the site if its detected, so its no good for me. i just want something to help protect my bankroll from myself.

Link to comment
Share on other sites

Opt('MustDeclareVars', 1)
Opt('MouseCoordMode', 0)

HotKeySet('{ESC}', '_Exit')
HotKeySet('^p', '_Pause')

Dim $szPokerTitle, $hPokerWin, $szInput, $Pause = False

$szPokerTitle = InputBox('PokerStars AutoIt', 'Please enter the window title', 'PokerStars')
If Not $szPokerTitle Or Not WinExists($szPokerTitle) Then Exit

WinActivate($szPokerTitle)
WinWaitActive($szPokerTitle)

While 1
    Local $pCol = PixelGetColor(0x28, 0x40)
    
    Select
        Case $pCol = 0x00FF00FF
            Func1()
            
    EndSelect
    
    Sleep(20)
WEnd

Func Func1()
    ; Do something here...
EndFunc

Func _Pause()
    $Pause = Not $Pause
    
    While $Pause
        ToolTip('Press F7 to resume', @DesktopWidth-100, @DesktopHeight-35)
        Sleep(100)
    WEnd
    
    ToolTip('')
EndFunc

Func _Exit()
    ToolTip('')
    Exit
EndFunc

It's quite same in it's general structure to the one on the site. What you should now be searching for is relative amount of pixel from the top and left of the window because you use Opt('MouseCoordMode', 0) which make pixel interpreting according to the active window and use the functions mentioned above like Control* or Win* etc... Sorry if I can't help better, Good-luck.

Link to comment
Share on other sites

How do I find the information for the part of the table that displays how much money i have and read that? also, would it be easier to set this up using the keyboard instead of the mouse? by that I mean that alt f4 closes out the windows at pokerstars, like clicking the x.

if i can get it to read the amount i start with, then all i would have to do is enter in the amounts i would want to quit at after i won/loss that amount.

is there a good example of a script that is associated with reading an amount and then acting upon when it reaches a certain amount?

Link to comment
Share on other sites

How do I find the information for the part of the table that displays how much money i have and read that? also, would it be easier to set this up using the keyboard instead of the mouse? by that I mean that alt f4 closes out the windows at pokerstars, like clicking the x.

if i can get it to read the amount i start with, then all i would have to do is enter in the amounts i would want to quit at after i won/loss that amount.

is there a good example of a script that is associated with reading an amount and then acting upon when it reaches a certain amount?

Opt('MustDeclareVars', 1)

Opt('MouseCoordMode', 0)

HotKeySet('{ESC}', '_Exit')

HotKeySet('^p', '_Pause')

Dim $szPokerTitle, $hPokerWin, $szInput, $Pause = False

$szPokerTitle = InputBox('PokerStars AutoIt', 'Please enter the window title', 'PokerStars')

If Not $szPokerTitle Or Not WinExists($szPokerTitle) Then Exit

WinActivate($szPokerTitle)

WinWaitActive($szPokerTitle)

While 1

Local $pCol = PixelGetColor(0x28, 0x40)

Select

Case $pCol = 0x00FF00FF

Func1()

EndSelect

Sleep(20)

WEnd

Func Func1()

WinWait, Charlois - $3/$6 - Limit Hold'em,

IfWinNotActive, Charlois - $3/$6 - Limit Hold'em, , WinActivate, Charlois - $3/$6 - Limit Hold'em,

WinWaitActive, Charlois - $3/$6 - Limit Hold'em,

MouseClick, left, 743, 13

Sleep, 100

MouseClick, left, 1297, 13

Sleep, 100

WinWait, PokerStars Lobby,

IfWinNotActive, PokerStars Lobby, , WinActivate, PokerStars Lobby,

WinWaitActive, PokerStars Lobby,

MouseClick, left, 765, 6

Sleep, 100

EndFunc

Func _Pause()

$Pause = Not $Pause

While $Pause

ToolTip('Press F7 to resume', @DesktopWidth-100, @DesktopHeight-35)

Sleep(100)

WEnd

ToolTip('')

EndFunc

Func _Exit()

ToolTip('')

Exit

EndFunc

am i on the right track?

(the name of the table, in this case Charlois, is an example)

Edited by Birthritual576
Link to comment
Share on other sites

How do I find the information for the part of the table that displays how much money i have and read that? also, would it be easier to set this up using the keyboard instead of the mouse? by that I mean that alt f4 closes out the windows at pokerstars, like clicking the x.

if i can get it to read the amount i start with, then all i would have to do is enter in the amounts i would want to quit at after i won/loss that amount.

is there a good example of a script that is associated with reading an amount and then acting upon when it reaches a certain amount?

Try:

HotKeySet('{F4}', '_ExitPoker')

Func _ExitPoker()
WinClose($szPokerTitle)
EndFunc

About the other part of your second reply I can't really be of help because I don't know what the poker game is using to keep user reaction but perhaps for many cases it's enough to use some of the Win* functions or Control* function and maybe play around with the Opt options... Don't forget about the tool "AutoIt Window Info". Good-luck

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