PokerStars Urgent Table & Auto Time Bank Clicker

By _dave_ at 2+2 forums. The corresponding thread on 2+2 is here.

This script automatically highlights the most urgent table on PokerStars, and moves the mouse to the center of it. In addition, it will click the timebank button on all tables that have been awaiting your input long enough.

I suggest the use of both BetPot script and StarsPlanner in addition to this script to assist in the ease of multi-tabling on PokerStars.com.

There may be errors, problems etc. with this script - Please let me know about them so I may fix them - I can't fix a problem I do not know about :)

WARNING!!! This script uses the slider-bar to find tables awaiting action - so it can't see a table where people are all-in - YOU MUST NOTICE THESE YOURSELF, for now...

Enjoy!

dave.

Version 0.75 relocates the mouse pointer to the .75 by .75 position of the active table, lower right corner, just above the bet buttons. I found that I'd be moving the mouse pointer when the table activated and moved the pointer back to the center of the active table and I didn't like having to cover the same ground twice. I figured giving a choice was better than replacing.

Cheers!

Bret (Jetpilot86)

Download Here

StarsUrgentTable-v0.01a.ahk

StarsUrgentTable-v0.75a.ahk

Instructions

Download the script, and run it :)

If you like, edit the script in notepad. There are a few settings right at the start of the script - these control thhe colour, transparency level, timing ewtc of the highlight box, and the time window the script should click the timebank button (default settings (10 - 13 seconds) are for "fast" cash tables / turbo tournies).

Version History

0.01

0.75

0.75a and 0.1a - 09-Aug-2007

Code - Version 0.01a


; AHK version: 1.0.46.03
; date: January 13, 2007
; version: 0.01
; author: _dave_ @ 2p2 forums
; thx to Roland & JukofYork for some of the functions


;--------------- SETTINGS -----------------------

border_colour := "ff0000"
border_size := 5
trans := 255
timebank_min := 10
timebank_max := 13
refresh_interval := 333

;--------------- END OF SETTINGS ----------------


#NoEnv
#SingleInstance, Force
SendMode Input
SysGet, border, 32
SysGet, caption, 4
last_table_id := ""
tablequeue := ""
SetTimer, refreshqueue, %refresh_interval%
return

refreshqueue:
ids := TableIDListStars()
Loop, Parse, tablequeue, `,
{
  StringTrimLeft, this_id, A_LoopField, InStr(A_LoopField, "_")
  if (!InStr(ids, this_id))
  {
    StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
  }
}
Loop, Parse, ids, `,
{
  ControlGet, v, Visible, , PokerStarsSliderEditorClass1, ahk_id%A_LoopField%
  if (v)
  {  
    ;table is waiting
    if (!InStr(tablequeue, A_LoopField))
    {
      DllCall("QueryPerformanceCounter", "Int64 *", CurrentQPC)
      tablequeue := tablequeue . "," . CurrentQPC . "-" . A_TickCount . "_" . A_LoopField
    }
  }
  else
  {
    if (InStr(tablequeue, A_LoopField))
    {
      StringReplace, tablequeue, tablequeue, %A_LoopField%, , All
    }
  }
}
tmp := ""
Loop, Parse, tablequeue, `,
{
  if (InStr(A_LoopField, "0x"))
  {
    tmp := tmp . "," . A_LoopField 
  }
}
Sort, tmp, N D`,
tablequeue := CleanList(tmp)

;Msgbox, %tablequeue%
most_urgent_table := ""
Loop, Parse, tablequeue, `,
{
  StringTrimLeft, most_urgent_table, A_LoopField, InStr(A_LoopField, "_")
  break
}
tc := A_TickCount
Loop, Parse, tablequeue, `,
{
  StringTrimLeft, waiting_time, A_LoopField, InStr(A_LoopField, "-")
  StringTrimRight, waiting_time, waiting_time, ( StrLen(waiting_time) - (InStr(waiting_time, "_")-1) )
  waiting_time := (tc - waiting_time) / 1000
  ;MsgBox, %waiting_time%
  if (waiting_time > 10 && waiting_time < 13)
  {
    StringTrimLeft, waiting_table, A_LoopField, InStr(A_LoopField, "_")
    timebank_x := 570
    timebank_y := 440
    relStarsClientPoint(waiting_table, timebank_x, timebank_y)
    PostLeftClick(timebank_x, timebank_y, waiting_table, 0)
  }
  
}

;Msgbox, %most_urgent_table%
makegui(most_urgent_table)
return





TableIDListStars()
{
  SetTitleMatchMode 2
  WinGet, id, id, PokerStars Lobby
  WinGet, pid, PID, ahk_id%id%
  WinGet, list, list, $ ahk_pid%pid%
  Loop %list%
  {
    this_id := list%a_index%
    If (this_id != id)
    {
      ids = %ids%,%this_id%
    }
  }
  WinGet, list, list, MiniFT ahk_class AutoHotkeyGUI
  Loop %list%
  {
    this_id := list%a_index%
    ids = %ids%,%this_id%
    
  }
  StringTrimLeft, ids, ids, 1
  return ids
}

;removes empty items (and trailing delimiters)
CleanList(list, del="") {
del := del="" ? "," : del
Loop {
  StringReplace, list, list, %del%%del%, %del%, UseErrorLevel
  If ! ErrorLevel
   break
 }
If InStr(list, del) = 1
 StringTrimLeft, list, list, 1
If InStr(list, del,0,0) = StrLen(list)
 StringTrimRight, list, list, 1
return list
}

makegui(id="")
{
  ;Msgbox, %id%
  global last_table_id
  global border_colour
  global border_size
  global trans
  
  if (id != last_table_id)
  {
    last_table_id := id
    
    if(!id)
    {
      Gui, 1: Cancel
      Gui, 2: Cancel
      Gui, 3: Cancel
      Gui, 4: Cancel
      return
    }
  
    WinGetPos, x, y, w, h, ahk_id%id%
    global border
    global caption
    x := x + border
    y := y + border + caption
    w := w - (2*border)
    h := h - (2*border) - caption
    
    
    
    ;top
    guinum := 1
    Gui, %guinum%: +Alwaysontop +Lastfound +Owner
    Gui, %guinum%: Color, %border_colour%
    WinSet, Transparent, %trans%
    Gui, %guinum%: -Caption
    Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y% NoActivate  
    
    ;left
    guinum++
    Gui, %guinum%: +Alwaysontop +Lastfound +Owner
    Gui, %guinum%: Color, %border_colour%
    WinSet, Transparent, %trans%
    Gui, %guinum%: -Caption
    Gui, %guinum%: Show, w%border_size% h%h% x%x% y%y% NoActivate  
    
    ;bottom
    guinum++
    Gui, %guinum%: +Alwaysontop +Lastfound +Owner
    Gui, %guinum%: Color, %border_colour%
    WinSet, Transparent, %trans%
    Gui, %guinum%: -Caption
    y2 := y + h - border_size
    Gui, %guinum%: Show, w%w% h%border_size% x%x% y%y2% NoActivate  
    
    ;right
    guinum++
    Gui, %guinum%: +Alwaysontop +Lastfound +Owner
    Gui, %guinum%: Color, %border_colour%
    WinSet, Transparent, %trans%
    Gui, %guinum%: -Caption
    x2 := x + w - border_size
    Gui, %guinum%: Show, w%border_size% h%h% x%x2% y%y% NoActivate
    
    x3 := x + (w/2)
    y3 := y + (h/2)
    ;SoundBeep, 750, 100
    Coordmode, Mouse, Screen
    MouseMove, x3, y3, 0
  }
}


PostLeftClick(x, y, table_id, activate=1, control_class="") {
; ### 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), %control_class%, ahk_id%table_id%
PostMessage, 0x202 , 0, ((y<<16)^x), %control_class%, ahk_id%table_id%
}

relStarsClientPoint(id, ByRef x, ByRef y)
{
  global border
  global caption
  rw := 792
  rh := 546
  WinGetPos, , , w, h, ahk_id%id%
  w := w - (2*border)
  h := h - (2*border) - caption
  
  x := Floor( (x / rw ) * w )
  y := Floor( (y / rh) * h  )
  
}



CategoryAutoHotKey

StarsUrgentTable (last edited 2008-09-23 03:46:07 by colossk)