View Single Post
  #10  
Old 01-20-2007, 03:42 PM
jukofyork jukofyork is offline
Senior Member
 
Join Date: Sep 2004
Location: Leeds, UK.
Posts: 2,551
Default Re: AHK script for Party Poker SNGs - ALL-IN

[ QUOTE ]
[ QUOTE ]
Okay I used tested script. Worked good [img]/images/graemlins/smile.gif[/img] I have few suggestions if you dont mind.

[/ QUOTE ]
Yep, ideas welcome - so far seems to be working fine for me too.

[ QUOTE ]
1. When in BB when I click RButton it would be neat if it checked the "Check/Fold" button and not the "Fold".

[/ QUOTE ]
I just noticed the same - I don't often click "Check/Fold" in the BB, but sometimes I was pressing it postflop by accident and saw it was checking the "Fold" by accident. I'll fix that for the next version.

[ QUOTE ]
2. How do I make notes when I can't right click?

[/ QUOTE ]
I've been playing too many tables and not really had chance for note taking, but it didn't occur to me about notes. What would be ideal is to steal the right mouse button away from Party notes and use it for folding, and then use another hotkey (like F11 or F12, etc) to simulate a right mouse button press as Party wants it. I'm no AHK expert but I'll try and find out if this is possible using PostMessage (I might be able to slyly post a message to Party which AHK doesn't see).

[ QUOTE ]
3. From level 3 on I make the initial bet 2,5xBB. Any solution to that?

[/ QUOTE ]
A quick hack would be to just use 0.5BB increments, but it might be possible to have it change as the blind level changes in the future. To use 0.5BB you need to make these changes:

amount := <font color="red">(bb / 2)</font>
.
.
.
t := Round(t, <font color="red">1</font>)


[ QUOTE ]
4. When it comes to automatically closing the tables (when finished)... the checkboxes for "auto post blind", "muck losing hands" and "deal me out" disappear. Could you work on from that?

[/ QUOTE ]
Yep, I'm going to give it a try, but I just hope they don't ever disappear for a fraction of a second (I guess we'll get the "Do you really want to leave the table?" dialog box then though, so it should be safe).

I'll have a go at implementing these now and see how I get on.

[/ QUOTE ]
All done:

* F12 does the "fake" right mouse click to allow for note taking.

* You might want to set "increment_half_bb = 1" so you can increment the slider in 0.5BB amounts.

<font class="small">Code:</font><hr /><pre>;---------------------------------------------------------
;----------------- Party SNG Helper v1.01 ----------------
;---------------------------------------------------------
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: jukofyork (reused code and thanks to: _dave_ &amp; Roland!)

; Features:
; =========
; 1. Push with/without autobet using middle mouse mutton.
; 2. Check or fold (ie: check if we can, else fold) using right mouse button.
; 3. Scroll wheel moved bet amount up/down in big bets.
; 4. Auto-confirm and check the buying box so all that will be needed is to click on an empty seat to join a SNG.
; 5. Auto-timebank clicker.
; 6. Auto-confirm the "Would you like a summary sent" box after being knocked out of a SNG.

; New for v1.01:
; ==============
; 1. Now will click Check/Fold checkbox if visible.
; 2. Pressing F12 over a player's name will simulate a right mouse click so we can takes notes, etc.
; 3. Have made it so that AlterAmount amount can take another argument to increment in 0.5BB amounts.
; 4. Have made it so we will close finished SNGs.
; 5. Have changed the timings to be 1000ms rather than 500ms to try to save on CPU time.

#Persistent
#NoEnv

SendMode Input

SetTitleMatchMode 2

; Set the options.
autobet = 1 ; Do we want to actually hit raise after we set the edit box to all-in?
increment_half_bb = 0 ; Set this to use 0.5BB increments with the scroll wheel, rather than 1BB.


; Start the timers.
SetTimer, AutoClickTimeBank, 1000
SetTimer, AutoBuyin, 1000
SetTimer, AutoRequestSummaryAndCloseFinishedSNGs, 1000

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

~F12::
id := ""
MouseGetPos, x, y, id
if (id &lt;&gt; "")
PostRightClick(x, y, id)
return

~RButton::
CheckFold(getid())
return

~MButton::
Push(getid(),autobet)
return

~WheelUp::
AlterAmount(getid(),"up",increment_half_bb)
return

~WheelDown::
AlterAmount(getid(),"down",increment_half_bb)
return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

AutoClickTimeBank:

checkfield = AfxWnd42u37 ; AfxWnd42u37 is timebank control
LobbyWindowTitle = Poker Lobby ; identify poker lobby substring
TableWindowTitle = Buy-in. ; identify pokertable substring

WinGet, lobbyID, ID, %LobbyWindowTitle%

WinGet, pid, PID, ahk_id%lobbyID%
WinGet, rlist, LIST, %TableWindowTitle% ahk_pid%pid%
Loop %rlist%
{
this_id := rlist%a_index%
If this_id != %lobbyID%
{
WinGetTitle, name, ahk_id%this_id%
ControlGet, result, Visible, , %checkfield%, ahk_id%this_id%
if (result)
{
ControlClick %checkfield%, ahk_id%this_id% ;Click timebank
}
}
}

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

AutoBuyin:

IfWinExist, ahk_class #32770, Tournament Buy-in
{
WinGet, idList, List, ahk_class #32770, Tournament Buy-in
Loop, %idList%
{
winID := idList%a_index%
ControlSend, Button2, {SPACE}, ahk_id%winID%
Sleep, 40
ControlSend, Button5, {SPACE}, ahk_id%winID%
}
}

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

AutoRequestSummaryAndCloseFinishedSNGs:

; Lets try requesting the summary BEFORE we try closing the table.
IfWinExist, ahk_class #32770, Would you like a tournament summary
{
WinGet, idList, List, ahk_class #32770, Would you like a tournament summary
Loop, %idList%
{
winID := idList%a_index%
ControlSend, Button1, {ENTER}, ahk_id%winID%
}
}

; Now lets try closing the SNGs.
checkfield = Button3 ; Button3 is the "Auto Post Blind" checkbox.
LobbyWindowTitle = Poker Lobby ; identify poker lobby substring
TableWindowTitle = Buy-in. ; identify pokertable substring

WinGet, lobbyID, ID, %LobbyWindowTitle%

WinGet, pid, PID, ahk_id%lobbyID%
WinGet, rlist, LIST, %TableWindowTitle% ahk_pid%pid%
Loop %rlist%
{
this_id := rlist%a_index%
If this_id != %lobbyID%
{
WinGetTitle, name, ahk_id%this_id%

; Make sure we are not seating.
ControlGet, result, Visible, , Seat Open, ahk_id%this_id%
if (result = 0)
{

; Is it not visible?
ControlGet, result, Visible, , %checkfield%, ahk_id%this_id%
if (result = 0)
{
; Lets make 100% sure and try again incase of a graphics delay.
Sleep, 150
ControlGet, result, Visible, , %checkfield%, ahk_id%this_id%
if (result = 0)
{
WinClose, ahk_id%this_id% ; Close the table.
}
}
}
}
}

return

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

getid()
{
id := ""
MouseGetPos, , , id
return id
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

PostRightClick(x, y, table_id, activate=1) {
; ### JUK: Send the down left click, then the mouse-up messages.
; NOTE: This is relative to the top left of the client area and NOT the top left of the
; window (ie: It *doesn't* include the title-bar like AHK's MouseClick does!!!).
If activate
WinActivate, ahk_id%table_id%
PostMessage, 0x204, 0x0001, ((y&lt;&lt;16)^x), , ahk_id%table_id%
PostMessage, 0x205 , 0, ((y&lt;&lt;16)^x), , ahk_id%table_id%
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

; This will set the edit box to the maximum amount.
Push(id, autobet=0)
{
pot := 10000000
ControlSetText, Edit3, %pot%, ahk_id%id%
Sleep -1
Sleep 50
WinSet, Redraw,, ahk_id%id%
If(autobet)
{
ControlClick, AfxWnd42u19, ahk_id%id%
}
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

; Clicks Check/Fold-in-turn or fold-in-turn button if sees it, else clicks check if sees
; it, else clicks fold.
CheckFold(id)
{

; Check/Fold checkbox.
ControlGet, v, Visible, , AfxWnd42u23, ahk_id%id%
if (v)
{
ControlFocus, AfxWnd42u23, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd42u23, ahk_id%id%
return
}

; Fold checkbox.
ControlGet, v, Visible, , AfxWnd42u22, ahk_id%id%
if (v)
{
ControlFocus, AfxWnd42u22, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd42u22, ahk_id%id%
return
}

; Lets see if we can see the check button.
ControlGet, v, Visible, , AfxWnd42u18, ahk_id%id%
if (v)
{
ControlGetText, text, AfxWnd42u18, ahk_id%id%
IfInString, text, Check
{
ControlFocus, AfxWnd42u18, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd42u18, ahk_id%id%
return
}
}

; Lets try for fold then.
ControlGet, v, Visible, , AfxWnd42u17, ahk_id%id%
if (v)
{
ControlFocus, AfxWnd42u17, ahk_id%id%
Sleep, -1
ControlClick, AfxWnd42u17, ahk_id%id%
}

}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;

AlterAmount(id, dir="",increment_half_bb=1)
{
WinGetTitle, title, ahk_id%id%
amount := 0

; Get the current BB amount.
if (InStr(title, "NL") &lt;&gt; 0 AND InStr(title, "Buy-in") &lt;&gt; 0)
{
ControlGetText, text, Static6, ahk_id%id%
IfNotInString, text, Blinds-Antes
{
StringMid, bb, text, InStr(text, "/") + 1, InStr(text, ")") - InStr(text, "/") - 1
}
else
{
StringMid, bb, text, InStr(text, "/") + 1, InStr(text, "-","",InStr(text, "/")) - InStr(text, "/") - 1
}
;msgbox, %bb%
}

; Do we want to increment by a whole or a half BB?
if (increment_half_bb = 1)
amount := bb / 2
else
amount := bb

if (dir="down")
{
amount := amount - (2*amount)
}

ControlGetText, t, Edit3, ahk_id%id%
t := t + amount
if (t &lt; 0)
{
t := 0
}

; Lets round to 0DP or 1DP.
if (increment_half_bb = 1)
t := Round(t, 1)
else
t := Round(t, 0)

; Alter the edit-box.
ControlSetText, Edit3, %t%, ahk_id%id%
;WinSet, Redraw,, ahk_id%id%

}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;</pre><hr />
Tell us how you get on with it, as I've not tested it all that well yet and just about to get something to eat before starting playing again.

Juk [img]/images/graemlins/smile.gif[/img]

EDIT: Fixed a bug where I was forgetting to check if we were seating causing the tables to get closed as soon as we opened them.
Reply With Quote