Quote:
Originally Posted by gwai lo
this... all of the ones i found via search didn't work.
Sure they work.
This one works in Miniview, Racetrack View, Blaze tables, NL,
Play Money. Don't know if it works in Real Money tables, PLO, MTT, SNG, etc, because i didn't test it, but it should work. It doesn't work on Arcade View.
Code:
;Prima Auto Time Bank v0.1
;writen by boske @ 2+2 forums
;settings
clearChat := 1 ;set to 0 for use with the grabber
;start of code
#persistent
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#SingleInstance Force
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
SysGet, border, 32
SysGet, caption, 4
caption := border + caption
tableSize := 0
SetControlDelay -1
player_action = bet, called, raised, went all-in, posted, wins, returned, folded, shows, mucked, checked
SetTimer, UpdateTables, 1000
return
UpdateTables:
SetTitleMatchMode 2
winget, tables, list, ahk_class GFX_INT_DLG_WINDOW_GAME
loop, %tables%
{
id := tables%a_index%
clicked_%id% := clicked_%id%
WinGetTitle, title, ahk_id%id%
StringReplace, title, title, €, $, All
StringReplace, title, title, Ł,$,All
if(!hero)
{
StringMid, hero, title, InStr(title, " - $")-1, , L
StringTrimLeft, hero, hero, InStr(hero, " - ", true, 0)+2
}
tablename := SubStr(title,Instr(title, "$"))
tablename := SubStr(tablename,Instr(tablename, " ")+3)
StringLeft, tablename, tablename, Instr(tablename,"[")-2
WinGet, maximized, MinMax, ahk_id %id%
if (maximized = -1)
continue ;check other tables
tablesize := GetTableSize(id)
checkTable(id)
}
return
checkTable(id)
{
global tablesize, hero, player_action, ClearChat
ControlGetText, hh, RichEdit20W1, ahk_id%id%
if(ClearChat)
{
ControlSetText, RichEdit20W1, , ahk_id%id% ; blank the chat so any changes to the chatbox can be easily detected and appended in future SetText commands
}
loop, Parse, hh, `n
{
if InStr(a_loopfield, "posted small blind")
{
first_line := a_index ; first line of current hand
}
if(InStr(a_loopfield, hero) && InStr(a_loopfield, "to respond"))
{
; > hero, you have 10 seconds to respond
StringTrimLeft, timeleft, a_loopfield, InStr(a_loopfield, "have ")+4
timeleft := SubStr(timeleft, 1, InStr(timeleft, " ")-1)
;msgbox %timeleft%
if(timeleft == 10 && clicked_%id% == 0)
{
timeNeeded := 1
}
}
else
{ ;only if last action
if( a_loopfield contains player_action )
{
timeNeeded := 0
clicked_%id% := 0
}
}
}
if(timeNeeded)
{
clickTimeBank(id)
clicked_%id% := 1
}
if(ClearChat)
{
loop, Parse, hh, `n
{
if(a_index >= first_line) ;current hand
{
if (hh3 == "")
hh3 := a_loopfield
else
hh3 := hh3 . "`n" . a_loopfield ; append lines of active hand
}
}
;detect changes to the chatbox since blanked
ControlGetText, hh4, RichEdit20W1, ahk_id%id%
If hh4 <> ""
hh3 := hh3 . hh4 ; append any changes in the chatbox to hh3
ControlSetText, RichEdit20W1, %hh3%, ahk_id%id%
}
}
clickTimeBank(id)
{
global tablesize, border
if(tablesize == 2)
{
PostLeftClick(345,200,id,0)
}
if(tablesize == 3)
{
PostLeftClick(440,395,id,0)
}
if(tablesize == 1)
{
x := 440
y := 400
WinGetPos, , ,w , , ahk_id %id%
w := w - (2*border)
factor := w/808
x := Round(x*factor)
y := Round(y*factor)
PostLeftClick(x,y,id,0)
}
}
;returns 1 if normal table, 2 if mini table, 3 if large table
getTableSize(id)
{
WinGetPos, , ,w ,h , ahk_id %id%
if (h == 367)
return 2
if (w == 1024)
return 3
else
return 1
}
;Juks rocks
PostLeftClick(x, y, table_id, activate=0) {
; ### 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, 0x201, 0x0001, ((y<<16)^x), , ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), , ahk_id%table_id%
}