Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Internet Poker > Software > Free Software

Notices

Free Software Discussion of Free / Freeware / Donationware / Open Source poker software and Free Graphics mods

Reply
 
Thread Tools Display Modes
Old 12-08-2010, 12:49 AM   #1
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,889
New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

I made this the other day since I dunno of a similarly working TimeOut Helper. Added Auto-Timebank since I may as well since it's a sensible way to do it.

It reads the ps log file so timebank works for PF All-Ins (UrgentTable does not). Also no pixel scanning so should work on any theme. x/y coordinates may need edited for themes other than Hyper Simple / Classic, not sure. Works for tournaments and cash games.

I've not tested on anything but my own machine so there may be problems, try at your own risk and so on.

You can test if it'll sit you back in by joining a cash table and "sit out next hand" (don't have to have posted a blind yet).

It seems not to sit you back in if you choose "sit out next big blind" which is handy

Code:
#NoEnv
#Persistent
SetBatchLines -1


CheckTime := 500   ; Check every n MilliSeconds
sitin_x := 532
sitin_y := 468

timebank_x := 520
timebank_y := 460

_FILE := A_ProgramFiles . "\PokerStars\PokerStars.log.0"
;_FILE := "E:\sitout.txt"
SysGet, border, 32
SysGet, caption, 4
SetTimer, FILE_CHECK, %CheckTime%
return


FILE_CHECK:
If (_NEWLINES := CheckFile(_FILE))
{
  ;msgbox, %_NEWLINES%
  Loop, Parse, _NEWLINES, `n
  {
    if(regExMatch(a_loopfield, "MSG_TABLE_SITTING_STATUS\s(\w{8})\s1", m))
    {
      ;msgbox, %m1%
      PostStarsClick(sitin_x, sitin_y, ("0x" . m1))
      
    }
    else if (regExMatch(a_loopfield, "MSG_TABLE_TIMEBANK\s(\w{8})\stime=", m))
    {
      ;msgbox, %m1%
      PostStarsClick(timebank_x, timebank_y, ("0x" . m1))
    }
  }
;msgbox, %m1%
   
}
Return


CheckFile(File) {
   ; THX Sean for File.ahk : http://www.autohotkey.com/forum/post-124759.html
   Static CF := ""   ; Current File
   Static FP := 0    ; File Pointer
   Static OPEN_EXISTING := 3
   Static GENERIC_READ := 0x80000000
   Static FILE_SHARE_READ := 1
   Static FILE_SHARE_WRITE := 2
   Static FILE_SHARE_DELETE := 4
   Static FILE_BEGIN := 0
   BatchLines := A_BatchLines
   SetBatchLines, -1
   If (File != CF) {
      CF := File
      FP := 0
   }
   hFile := DllCall("CreateFile"
                  , "Str",  File
                  , "Uint", GENERIC_READ
                  , "Uint", FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE
                  , "Uint", 0
                  , "Uint", OPEN_EXISTING
                  , "Uint", 0
                  , "Uint", 0)
   If (!hFile) {
      CF := ""
      FP := 0
      SetBatchLines, %BatchLines%
      Return False
   }
   DllCall("GetFileSizeEx"
         , "Uint",   hFile
         , "Int64P", nSize)
   If (FP = 0 Or nSize <= FP) {
      FP := nSize
      SetBatchLines, %BatchLines%
      DllCall("CloseHandle", "Uint", hFile) ; close file
     Return False
   }
   DllCall("SetFilePointerEx"
         , "Uint",  hFile
         , "Int64", FP
         , "Uint",  0
         , "Uint",  FILE_BEGIN)
   VarSetCapacity(Tail, Length := nSize - FP, 0)
   DllCall("ReadFile"
         , "Uint",  hFile
         , "Str",   Tail
         , "Uint",  Length
         , "UintP", Length
         , "Uint",  0)
   DllCall("CloseHandle", "Uint", hFile)
   VarSetCapacity(Tail, -1)
   FP := nSize
   SetBatchLines, %BatchLines%
   Return Tail
}

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  )
  
}

;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%
}

PostStarsClick(x, y, id)
{
  relStarsClientPoint(id, x, y)
  PostLeftClick(x, y, id)
}
_dave_ is offline   Reply With Quote
Old 12-08-2010, 11:58 AM   #2
newbie
 
Join Date: Jul 2007
Location: Exeter
Posts: 42
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

This is great thanks
gruey1 is offline   Reply With Quote
Old 12-08-2010, 08:33 PM   #3
newbie
 
Join Date: Oct 2008
Posts: 35
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

Yeah very cool, wish WA players could still play on stars
elcacheman is offline   Reply With Quote
Old 12-09-2010, 03:47 PM   #4
Pooh-Bah
 
Baobhan-Sith's Avatar
 
Join Date: Oct 2009
Location: ✮✮✮✮
Posts: 4,075
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

Wow that's awesome, tyvm! Been looking for a working auto timebank for so long...

Auto sitback works perfectly, but unfortunately auto timebank does not. I tried replacing the modded button with the original one, and I also made sure the timebank_x and _y are correct, as follows:

I added MouseMove timebank_x, timebank_y right before PostStarsClick to verify the coordinates I put in, and the mouse is moved exactly over the timebank button - but it doesn't click it. I also tried the timebank coordinates the script came with since sitback works well despite of its coordinates being way off (didn't change these).

I am using a slightly modded Slick Base theme, and my OS is WinXP. Please let me know what other information you need, if any, in order to get the issue fixed.

TIA

Last edited by Baobhan-Sith; 12-09-2010 at 03:53 PM.
Baobhan-Sith is offline   Reply With Quote
Old 12-09-2010, 04:58 PM   #5
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,889
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

I'll take a look at slick base later on tonight - I figure if the sitback looks off to you but works, you're maybe getting the coordinates from a wrongly sized table? (it needs to be dafault size)
_dave_ is offline   Reply With Quote
Old 12-09-2010, 05:13 PM   #6
Pooh-Bah
 
Baobhan-Sith's Avatar
 
Join Date: Oct 2009
Location: ✮✮✮✮
Posts: 4,075
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

Oh great, that did the trick, ty so much!
Baobhan-Sith is offline   Reply With Quote
Old 12-09-2010, 06:20 PM   #7
grinder
 
spellofmaya's Avatar
 
Join Date: May 2006
Location: Friday nights are killing me
Posts: 500
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

_dave_ could this be modified to close the table when sitting out rather than sitting back in?
spellofmaya is offline   Reply With Quote
Old 12-09-2010, 06:30 PM   #8
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,889
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

easily I would think dangerous tho!
_dave_ is offline   Reply With Quote
Old 12-09-2010, 08:11 PM   #9
grinder
 
spellofmaya's Avatar
 
Join Date: May 2006
Location: Friday nights are killing me
Posts: 500
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

How so? I usually play short sessions so the only time i sit out is to get on a new table or to end my session.
spellofmaya is offline   Reply With Quote
Old 12-09-2010, 08:19 PM   #10
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,889
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

Well it's not really dangerous if that's the behaviour you want and expect. just like for example you are sat in a game with great position a big fish spewing money your way, and there is a waitlist - timing out would be instant loss of seat rather than just folding a hand.

If you change the coordinates of sitin_x and sitin_y to somewhere top-right of the table (where it will hit the "leave table" button), that'll do the job.

It unfortunately won't work if you use the "sit out next Big Blind" option, for some reason that produces a different message in the log file I'd have to identify (for auto sit-in but still being able to cleanly exit a table, it's quite handy to not flag these sit-outs. but for your purposes I think not)
_dave_ is offline   Reply With Quote
Old 12-09-2010, 08:33 PM   #11
grinder
 
spellofmaya's Avatar
 
Join Date: May 2006
Location: Friday nights are killing me
Posts: 500
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

I generally use sit out next bb so I guess this wouldn't work anyways, Thanks tho.
spellofmaya is offline   Reply With Quote
Old 12-09-2010, 08:41 PM   #12
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,889
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

well not quite - all I'm saying there is changing the coordinates won't work - we need a different "trigger". I'll have a look later on and see if I can spot what message shows from "sitout next BB". I didn't look previously because I thought behaviour was reasonable as-is. If you want it to auto-close a table only after "sitout next BB", hopefully that is possible
_dave_ is offline   Reply With Quote
Old 12-09-2010, 11:24 PM   #13
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,889
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

Ugh doesn't look too likely - the Stars table seems to post MSG_TABLE_FORCE_SITOUT after sitout next BB, but this also gets posted for a timeout. Difference is for the next BB option it is posted without the MSG_TABLE_SITTING_STATUS a moment later, which is what I'm looking for.

If you don't care how the sitout occurs it's easy to make it auto-close tables, if you only want that to happen after a "sitout next BB" selection that'll take more thinking

ETA: actually it posts "sitOutNextBigBlindCheck set to 1" to the log file, it is possible to keep a list of windows with that option set and auto-close only them if need be.
_dave_ is offline   Reply With Quote
Old 12-10-2010, 11:26 AM   #14
Pooh-Bah
 
Join Date: Nov 2005
Location: Equal rights for Orcs!
Posts: 5,484
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

Awesome. I haven't gotten it working yet- my log files/hand histories are stored in a totally different directory than c:\program files\pokerstars- could that be the problem?
Brian O'Nolan is offline   Reply With Quote
Old 12-10-2010, 02:36 PM   #15
_Pooh_Bah_
 
Join Date: Feb 2005
Location: UK
Posts: 9,889
Re: New AHK: TimeOut Helper (Instant Sit Back In) and Auto Timebank for PokerStars

The file PokerStars.log.0 is theonly one this script reads - if it isn't in Program Files (like you have PokerStars installed elsewhere, or maybe Win7 writes it elsewhere) line ~13 will need editing to the correct location.

Also if you uncomment (remove the ";") the first msgbox line, the script will alert you of any new lines in the log file, so simply starting pokerstars lobby will be enough to see if you have the right log file location.
_dave_ is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 01:25 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright 2008-2010, Two Plus Two Interactive