View Single Post
  #2  
Old 06-30-2006, 12:06 AM
_dave_ _dave_ is offline
Senior Member
 
Join Date: Feb 2005
Location: UK
Posts: 2,628
Default Re: AHK: NL_SeatSnagger - A PST-like script with extra NL goodness

;_________________________________________________ _________________________________________
;_________________________________________________ _________________________________________
;
; NL_SeatSnagger.AHK
;
; In an effort to learn some AHK basics, I wrote this - with a little help from reading
; Poker Seat Taker, and other fine scripts by Roland, Adde, SamIam, Juk, Mogobu and
; any others I have forgotten right now.
;
; This is kinda similar to Poker-Seat-Taker, but with somewhat of an NL bias - I hate
; to open a table to find it infested with short-stacks, so these are detected and
; skipped past - also, I prefer to get in on the action right away rater than join a
; waitlist, as PST does so well - so I made this.
;
; Also, I wanted to automate buddy searces somewhat, and most of all I wanted to
; practice some basic AHK techniques. If anyone has any AHK advice - e.g I have done
; some part of this in a most inefficient manner, please let me know so I may learn.
;
; Enjoy!
;
; _dave_
;
;
; No guarantees provided, use this at your own risk, YMMV, etc etc....




;_______ Hot Key Mappings

F1::
getatable(1, 80) ;____ get a 6-max table with 1/2 open seats,
return ;____ 80bb minimum stack requirement (dreaming, no...)

F2::
getatable(1, 65) ;____ get a 6-max table with 1/2 open seats,
return ;____ 65bb minimum stack requirement (kinda more likely)

F3::
getatable(1, 50) ;____ get a 6-max table with 1/2 open seats,
return ;____ 50bb minimum stack (my shortstack tolerance threshold)

F4:: ;____ damn the short-stacks, just get me a six max table,
getatable(1) ;____ with at one or two open seats...
return



F5:: ;____ get any table, so long as it has one of my favourite
getatable(0, 0, 1) ;____ "buddies" sitting down - LOL - I may learn something
return ;____ if I watch these guys long enough (he says hopefully)


;_______ END Hot Key Mappings





getatable(find_seating=1,minstack=0, find_buddies=0)
{
;_________ SET PREFERENCES HERE



seating = 5/6, 4/6
buddies = loloTRICKEDu,NoreasteR_,Gamble4You,samoleous,sheca ntsayno,Fukken_Eh,akshawnd

;_________ These "Buddies" are not recommended, unless you really dislike money...
;_________ DO NOT use spaces between buddies - it won't work if you do...



;_________ DO NOT EDIT BELOW HERE (unless you know you want to....)






;_________ let's check if we have Empire or Party....

WinGet, id, ID, EmpirePoker: Poker Lobby
If (id)
{
;msgbox "got Empire"
playertab := AfxWnd428
}
Else
{
WinGet, id, ID, PartyPoker.com
If (id)
{
;msgbox "got Party"
playertab := AfxWnd4214
}
Else
{
MsgBox, Failed to detect Party or Empire
return
}
}

;__________ Well, we have one or the other - let's go

WinGetTitle, title, ahk_id%id%

SetTitleMatchMode, 2
WinGet, opentables, List, Good Luck, , Lobby
;msgbox %opentables%



WinActivate, ahk_id%id%
ControlFocus, SysListView321, ahk_id%id%
ControlGet, row, List, Col2, SysListView321, ahk_id%id%
StringMid, bb, row, InStr(row, "/$")+2
StringMid, bb, bb, InStr(bb, "`n")-1,,L
;msgbox %bb%
first_pass := 0

Loop
{
table_is_good := 0

WinActivate, ahk_id%id%

ControlFocus, SysListView321, ahk_id%id%
ControlGet, result1, List, Count, SysListView321, ahk_id%id%
ControlGet, result2, List, Count Focused, SysListView321, ahk_id%id%

if (result1 = result2) ;________ we have hit the end of the list
{
break
}

if (result2 <> 1 || first_pass = 1)
{
Send {DOWN}
Sleep -1
}
first_pass := 1

;__________ get the name of this table

ControlGet, tablerow, List, Selected, SysListView321, ahk_id%id%
StringMid, selected_table, tablerow, InStr(tablerow, "$")-2,, L
;Msgbox %selected_table%

IfInString, selected_table, pvt table
{
continue
}

;__________ check if table is open already

already_open := 0


Loop, %opentables%
{
curr_id := % opentables%A_index%
WinGetTitle, anopentable, ahk_id%curr_id%
StringMid, tablename, anopentable, InStr(anopentable, "-")-2,, L
If (selected_table = tablename)
{
already_open := 1
break
}

}
If already_open = 1
{
continue
}

IfInString, tablerow, 0/10
{
IfInString, tablerow, 10/10
{
;___ do nothing
}
else
{
continue
}
}
IfInString, tablerow, 0/6
{
continue
}


If find_seating = 1
{
If tablerow contains %seating%
{
table_is_good := 1
}
else
{
continue
}
}

If (minstack > 0)
{
ControlClick, ahk_class%playertab%, ahk_id%id%
Loop
{
gotstacks := 0
Sleep, 333
ControlGet, stacksizes, List, Col3, SysListView322, ahk_id%id%
IfInString, stacksizes, $
{
break
}
}

min := minstack * bb
;msgbox % "$" . min
;msgbox %stacksizes%
table_is_good := 1
Loop, Parse, stacksizes, `n
{
IfInString, A_Loopfield, $
{
;msgbox %A_Loopfield%
StringMid, chips, A_Loopfield, 2
;msgbox % A_Loopfield . " - " . chips

If (chips <= min )
{
table_is_good := 0
;msgbox % chips
}
}
}
If table_is_good <> 1
{
continue
}
}

If (find_buddies = 1)
{
ControlClick, ahk_class%playertab%, ahk_id%id%
Loop
{
buddy := 0
Sleep, 333
ControlGet, playernames, List, Col2, SysListView322, ahk_id%id%
letters = a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y, z
If playernames contains %letters%
{
break
}
}
;msgbox %playernames%
Loop, Parse, playernames, `n
{

If A_Loopfield contains %buddies%
{
table_is_good := 1
;msgbox %A_loopfield%
}
}

If table_is_good <> 1
{
continue
}
}

If table_is_good = 1
{

Send {ENTER}


break

}
}

;__________ after we are done
;__________ go back to the top

Loop
{
WinActivate, ahk_id%id%
ControlFocus, SysListView321, ahk_id%id%
ControlGet, result2, List, Count Focused, SysListView321, ahk_id%id%
if (result2 = 1)
{
break
}
Send {PGUP}
}

Sleep, 2000
WinActivate, ahk_id%id%
;Msgbox %tablelist%

}
Reply With Quote