Open Side Menu Go to the Top
Register
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima)

05-14-2008 , 05:42 PM
Quote:
Originally Posted by _dave_
Looks fine

See if CTRL+ Middle mouse (full pot) or CTRL+ALT+ Middle mouse (push) work at all?
Neither work.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 05:50 PM
Here's my betpot script itself
Code:
; GENERAL SETTINGS
debug := 0
act_only_on_active_table := 0
fix_blinds := 1
deduct_rake := 1
fold_to_any := 0

; IPOKER SPECIFIC
Ipoker_miniview := 0
Ipoker_BetBoxColor = 0xFFFFFF  ;most of the iPoker skins use a white background for the bet box, if yours doesn't then you need to change this value
Ipoker_ShowBetBoxColor := 0  ;set this to 1 to pop up a message box with the bet box color when you bet pot, replace 0xFFFFFF with this.

; PARTY SPECIFIC
party_uses_commas_for_decimals := 0
fphg_party_hh_folder := "C:\FreePHG_HandHistories\"
; **** SET TO 0 (zero) if using old FPHG without "live" folder, else 1 (one)
fphg_uselive = 1

;FTP SPECIFIC
; **** SET TO 0 (zero) if using FTP official client, 1 (one) if using the Beta
; THERE IS NO LONGER AN NEED TO CHANGE THIS... BETA IS THE NEW OFFICIAL
FTP_Beta := 1

;STARS SPECIFIC
use_old_stars_buttons := 0
stars_editbox = PokerStarsSliderEditorClass1
;Uncomment for PokerStars Client version < 2.286
;stars_editbox = Edit7

;AHK STUFF, DO NOT EDIT
#MaxHotkeysPerInterval 300
#SingleInstance, Force
SendMode Input
SetTitleMatchMode 2
caller_hwnd := ""
SysGet, border, 32
SysGet, caption, 4
caption := border + caption
#NoEnv
;END OF AHK STUFF

;--------------- Copy / Paste --- Add other Crypto skins here ---------------;
WinGet, interpoker, pid,  InterPoker - Lobby
if (interpoker)
{
  GroupAdd, CryptoTables, ahk_pid%interpoker%,,, Lobby
}

WinGet, sunpoker, pid,  SunPoker.com - Lobby
if (sunpoker)
{
  GroupAdd, CryptoTables, ahk_pid%sunpoker%,,, Lobby
}

WinGet, willhill, pid,  William Hill Poker - Lobby
if (willhill)
{
  GroupAdd, CryptoTables, ahk_pid%willhill%,,, Lobby
}

WinGet, betsafe, pid, Betsafe Poker - Lobby
if (betsafe)
{
  GroupAdd, CryptoTables, ahk_pid%betsafe%,,, Lobby
}

WinGet, parbet, pid, Parbet.com Poker - Lobby
if (parbet)
{
  GroupAdd, CryptoTables, ahk_pid%parbet%,,, Lobby
}


WinGet, lw, pid, Littlewoods Poker - Lobby
if (lw)
{
  GroupAdd, CryptoTables, ahk_pid%lw%,,, Lobby
}

WinGet, dtd, pid, DTD Poker - Lobby
if (dtd)
{
  GroupAdd, CryptoTables, ahk_pid%dtd%,,, Lobby
}

;----------- END OF CRYPTO SKINS --------------


WinGet, ub, pid, UltimateBet  
if (ub)
{
  GroupAdd, UBTables, ahk_pid%,,, UltimateBet
}


GroupAdd, StarsTables, Logged In as ,,, PokerStars Lobby
GroupAdd, PartyTables, Good Luck ahk_class #32770,,, : Poker Lobby
GroupAdd, FullTiltTables, ahk_class FTC_TableViewFull
GroupAdd, PrimaTables, ahk_class POPUP_INT_DLG_WINDOW
GroupAdd, MiniFT, MiniFT ahk_class AutoHotkeyGUI
GroupAdd, iPokerTables, ahk_class PTIODEVICE,,, : Nickname:

;--------- IPOKER COORDINATES -------------------
iPokerX := 557 + border
iPokerY := 462 + caption

iPokerChat := 550
iPokerRaiseX := 554
iPokerRaiseY := 545
ipokerCallx := 445
ipokerCallY:= 550
iPokerFoldX := 300
iPokerFoldY := 550

if iPoker_miniview
{
  iPokerX := 400 + border
  iPokerY := 265 + caption

  iPokerChat := 300
  iPokerRaiseX := 400
  iPokerRaiseY := 325
  ipokerCallx := 310
  ipokerCallY:= 325
  iPokerFoldX := 220
  iPokerFoldY := 325
}

return

#include betpot_default_hotkeys.ahk

Fold(id)
{
  IfWinExist, ahk_id%id% ahk_group MiniFT
  {
    WinGetTitle, t, ahk_id%id%
    StringTrimLeft, t, t, Instr(t, "hwnd:", true, 0)+4
    id := t
  }

  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    FoldStars(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    FoldFT(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group PartyTables
  {
    FoldParty(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group CryptoTables
  {
    FoldCrypto(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group UBTables
  {
    FoldUB(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group iPokerTables
  {
    FoldIPoker(id)
  }
}
  
Call(id)
{
  IfWinExist, ahk_id%id% ahk_group MiniFT
  {
    WinGetTitle, t, ahk_id%id%
    StringTrimLeft, t, t, Instr(t, "hwnd:", true, 0)+4
    id := t
  }

  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    CallStars(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    CallFT(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group PartyTables
  {
    CallParty(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group CryptoTables
  {
    CallCrypto(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group UBTables
  {
    CallUB(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group iPokerTables
  {
    CallIPoker(id)
  }
}

Raise(id)
{
  IfWinExist, ahk_id%id% ahk_group MiniFT
  {
    WinGetTitle, t, ahk_id%id%
    StringTrimLeft, t, t, Instr(t, "hwnd:", true, 0)+4
    id := t
  }

  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    RaiseStars(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    RaiseFT(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group PartyTables
  {
    RaiseParty(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group CryptoTables
  {
    RaiseCrypto(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group UBTables
  {
    RaiseUB(id)
  }
  Else IfWinExist, ahk_id%id% ahk_group IPokerTables
  {
    RaiseIPoker(id)
  }
}

 
AlterAmount(id, dir="", frac=1, unit="")
{
  global party_uses_commas_for_decimals, stars_editbox

  IfWinExist, ahk_id%id% ahk_group MiniFT
  {
    WinGetTitle, t, ahk_id%id%
    StringTrimLeft, t, t, Instr(t, "hwnd:", true, 0)+4
    id := t
  }
  
  WinGetTitle, title, ahk_id%id%
  amount := 0
  
  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    If ((InStr(title, "No Limit") OR InStr(title, "Pot Limit")) AND InStr(title, "Tournament") = 0)
    {
      StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
    }
    else if (InStr(title, "No Limit") <> 0 AND InStr(title, "Tournament") <> 0)
    {
      StringMid, bb, title, InStr(title, "/", "", InStr(title, "Blinds")) + 1, InStr(title, a_space, "", InStr(title, "Blinds") + 8) - InStr(title, "/", "", InStr(title, "Blinds")) - 1 ;___so we retrieve the big blind instead
    }
    
  }
   
  Else IfWinExist, ahk_id%id% ahk_group PartyTables
  {
    If (InStr(title, "NL") <> 0 AND InStr(title, "Buy-in") = 0)
    {
      StringMid, bb, title, InStr(title, "/")+1, InStr(title, ". ", InStr(title,"/")) - InStr(title, "/") -1
      
    }
    else if (InStr(title, "NL") <> 0 AND InStr(title, "Buy-in") <> 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
      }
    }
    if (party_uses_commas_for_decimals)
    {
      StringReplace, bb, bb, `,,., All
    }
  }
  
  Else IfWinExist, ahk_id%id% ahk_group CryptoTables
  {
    StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
    
  }
  
  Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  }
  
  Else IfWinExist, ahk_id%id% ahk_group PrimaTables
  {
    StringTrimLeft, bb, title, InStr(title, "$", true, 0) 
    StringMid, bb, bb, InStr(bb, " ")-1,, L
  }
  
  Else IfWinExist, ahk_id%id% ahk_group UBTables
  {
    StringTrimLeft, bb, title, InStr(title, "$", true, 0)-1 
    StringTrimRight, bb, bb, Strlen(bb) - InStr(bb, A_Space)
    StringReplace, bb, bb, $., $0., All
    StringReplace, bb, bb, $,, All
    StringReplace, bb, bb, %A_Space%,, All
    
    ;StringMid, bb, bb, InStr(bb, "$")-1,, L
    ;MsgBox, %bb%
  }
  
  Else IfWinExist, ahk_id%id% ahk_group iPokerTables
  {
  	StringTrimLeft, bb, title, InStr(title, "/$")
  }
  
  Else
  {
    Send {%A_ThisHotkey%}
    return
  }
  
  StringReplace,bb,bb,$,,1
  StringReplace,bb,bb,£,,1
  StringReplace,bb,bb,€,,1
  
  sb := sb(bb)
  
  If (unit = "" or unit = "bb")
  {
    unit := bb
  }
  Else If (unit = "sb")
  {
    unit := sb
  }
  Else If (unit = "pot")
  {
    pot := 0
    call := 0
    hero_bet := 0
    street := "pre"
    hero_position := ""
    open := 0
    max := 10000000
    IfWinExist, ahk_id%id% ahk_group StarsTables
    {
      PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    } 
    Else IfWinExist, ahk_id%id% ahk_group PartyTables
    {
      PotSizeParty(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
      if (party_uses_commas_for_decimals)
      {
        StringReplace, call, call, `,,., All
      }
    }
    Else IfWinExist, ahk_id%id% ahk_group CryptoTables
    {
      PotSizeCrypto(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    }
    Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
    {
      ControlGet, v, Visible, , Edit1, ahk_id%id%
      if (v)
      {
        PotSizeFullTilt2(id, pot, call, sb, bb, hero_bet, street, hero_position, open, max)
      }
      else
      {
        return
      }
      ;msgbox, %pot%
    }
    Else IfWinExist, ahk_id%id% ahk_group PrimaTables
    {
      PotSizePrima(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    }
    Else IfWinExist, ahk_id%id% ahk_group iPokerTables
    {
      PotSizeIPoker(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    }    

    pot := ((pot + call + hero_bet) )+ call
    ;Msgbox, %pot%
    unit := pot
  }
  amount := unit * frac
  
  if (dir="down")
  {
    amount := amount - (2*amount)
  }
  
  
  
  ;Msgbox, %sb%/%bb%
  /*
  IfWinExist, ahk_id%id% ahk_group MiniFT
  {
    ControlGet, v, Visible, , Edit1, ahk_id%id%
    if (v)
    {
      ControlGetText, t, Edit1, ahk_id%id%
      t := t + amount
      if (t < 0)
      {
        t := 0
      }
      t := Round(t, 2)
      ControlSetText, Edit1, %t%, ahk_id%id%
      WinSet, Redraw,, ahk_id%id%
    }
  }
  */
  
  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    ControlGetText, t, %stars_editbox%, ahk_id%id%
    ;Msgbox, %t%
    t := t + amount
    if (t < 0)
    {
      t := 0
    }
    t := Round(t, 2)
    ControlSetText, %stars_editbox%, %t%, ahk_id%id%
    Sleep, -1
    ;ControlGetText, t, %stars_editbox%, ahk_id%id%
    WinSet, Redraw,, ahk_id%id%
  } 
  Else IfWinExist, ahk_id%id% ahk_group PartyTables
  {
    ControlGetText, t, Edit3, ahk_id%id%
    if (party_uses_commas_for_decimals)
    {
      StringReplace, t, t, `,,., All
    }
    t := t + amount
    if (t < 0)
    {
      t := 0
    }
    t := Round(t, 2)
    if (party_uses_commas_for_decimals)
    {
      StringReplace, t, t, .,`,, All
    }
    ControlSetText, Edit3, %t%, ahk_id%id%
    ;WinSet, Redraw,, ahk_id%id%
  }
  Else IfWinExist, ahk_id%id% ahk_group CryptoTables
  {
    ControlGetText, t, Edit3, ahk_id%id%
    t := t + amount
    if (t < 0)
    {
      t := 0
    }
    t := Round(t, 2)
    ControlSetText, Edit3, %t%, ahk_id%id%
    WinSet, Redraw,, ahk_id%id%
  }
  Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    ControlGet, v, Visible, , Edit1, ahk_id%id%
    if (v)
    {
      ControlGetText, t, Edit1, ahk_id%id%
      t := t + amount
      if (t < 0)
      {
        t := 0
      }
      t := Round(t, 2)
      ControlSetText, Edit1, %t%, ahk_id%id%
      ;WinSet, Redraw,, ahk_id%id%
    }
  }
  Else IfWinExist, ahk_id%id% ahk_group PrimaTables
  {
    ControlGetText, t, Edit1, ahk_id%id%
    t := t + amount
    if (t < 0)
    {
      t := 0
    }
    t := Round(t, 2)
    ControlSetText, Edit1, %t%, ahk_id%id%
    WinSet, Redraw,, ahk_id%id%
  }
  Else IfWinExist, ahk_id%id% ahk_group UBTables
  {
    ControlGetText, t, Edit1, ahk_id%id%
    t := t + amount
    if (t < 0)
    {
      t := 0
    }
    t := Round(t, 2)
    ControlSetText, Edit1, %t%, ahk_id%id%
    ;WinSet, Redraw,, ahk_id%id%
  }

  Else IfWinExist, ahk_id%id% ahk_group iPokerTables
  {
	t := ReadBetBoxIPoker(id)
	t := t + amount

	if (t <= 0)
    	  return

	t := Round(t, 2)
	
	WriteBetBoxIPoker(id, t)
   }
}

Pot(id, frac=1, round_bet=0.2, open_adjust="", autoBet=0)
{
  global debug
  global fix_blinds
  global caller_hwnd
  global party_uses_commas_for_decimals
  global ipokerchat, iPokerRaiseX, iPokerRaiseY
  global stars_editbox
  caller_hwnd := ""
  pot := 0
  call := 0
  sb := 0
  bb := 0
  hero_bet := 0
  street := ""
  hero_position := ""
  open := 1
  max := 10000000
  
  IfWinExist, ahk_id%id% ahk_group MiniFT
  {
    WinGetTitle, t, ahk_id%id%
    caller_hwnd := id
    StringTrimLeft, t, t, Instr(t, "hwnd:", true, 0)+4
    id := t
  }

  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    PotSizeStars(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
  } 
  Else IfWinExist, ahk_id%id% ahk_group PartyTables
  {
    PotSizeParty(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    if (party_uses_commas_for_decimals)
    {
      StringReplace, call, call, `,,., All
    }
  }
  Else IfWinExist, ahk_id%id% ahk_group CryptoTables
  {
    PotSizeCrypto(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
  }
  Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    ControlGet, v, Visible, , Edit1, ahk_id%id%
    if (v)
    {
      PotSizeFullTilt2(id, pot, call, sb, bb, hero_bet, street, hero_position, open, max)
    }
    else
    {
      return
    }
    ;msgbox, %pot%
  }
  Else IfWinExist, ahk_id%id% ahk_group PrimaTables
  {
    PotSizePrima(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
  }
  Else IfWinExist, ahk_id%id% ahk_group UBTables
  {
    ControlGet, v, Visible, , Edit1, ahk_id%id%
    if (v)
    {
      PotSizeUB(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
    }
    else
    {
      return
    }
  }

  Else IfWinExist, ahk_id%id% ahk_group iPokerTables
  {
    PotSizeIPoker(id, pot, call, sb, bb, hero_bet, street, hero_position, open)
  }

  Else
  {
    return
  }
 
  StringSplit, fr, frac, %A_SPACE%
  if (fr0 < 4)
  {
    times := 4 - fr0
    Loop, %times%
    {
      n := 5 - A_Index
      fr%n% := fr%fr0% 
    }
  }
  
  if (street = "pre")
  {
    frac = %fr1%
  }
  else if (street = "flop")
  {
    frac = %fr2%
  }
  else if (street = "turn")
  {
    frac = %fr3%
  }
  else if (street = "river")
  {
    frac = %fr4%
  }

  if (debug)
  {
    TrayTip, BetPot, Pot:`t`t%pot%`nCall:`t`t%call%`nHero_bet:`t%hero_bet%`n`nBlinds:`t$%sb%/$%bb%`n`nStreet:`t%street%`n`n%fr0%`n%fr1% %fr2% %fr3% %fr4%`n`n%frac%,10,17
  }
    
  if (fix_blinds AND open AND street="pre")
  {
    if (hero_position = "sb" )
    {
      pot := pot - sb
      call := call + sb
    }
    else if (hero_position = "bb")
    {
      pot := pot - bb
      call := call + bb
    }
  }

  ;msgbox, %pot%
  pot := ((pot + call + hero_bet)* (frac) )+ call
  ;msgbox, %pot%
  
  if (open=1 AND open_adjust="ssnl" )
  {
    pot := pot + bb - sb
  }
  else if (open=1 AND open_adjust="tourney" )
  {
    pot := pot - bb
  }
  else if (open=1 AND open_adjust="mix" )
  {
    if (bb=2)
    {
      pot := pot + bb - sb
    }
  }
  
  if(round_bet = "smallblind")
  {
    pot := Round((Floor((pot / sb)) * sb),2)
  }
  else if(round_bet = "bigblind")
  {
    pot := Round((Floor((pot / bb)) * bb),2)
  }
  else if (round_bet < 1)
  {
    places := round_bet*10
    pot := Round(pot, (places))
  }
  else if (round_bet >= 1)
  {
    pot := Floor(pot / round_bet) * round_bet
  }
  ;msgbox, %pot%
  
  
     
  IfWinExist, ahk_id%id% ahk_group StarsTables
  {
    ControlSetText, %stars_editbox%, %pot%, ahk_id%id%
    Sleep, -1
    if (autobet)
    {
      RaiseStars(id)
    }
  }
  Else IfWinExist, ahk_id%id% ahk_group PartyTables
  {
    if (party_uses_commas_for_decimals)
    {
      StringReplace, pot, pot, .,`,, All
    }
    ;Msgbox, %pot%
    ControlSetText, Edit3, %pot%, ahk_id%id%
    Sleep -1
    Sleep, 50
    WinSet, Redraw,, ahk_id%id%
    If(autobet)
    {
      ControlClick, AfxWnd42u19, ahk_id%id%
    } 
  }
  Else IfWinExist, ahk_id%id% ahk_group CryptoTables
  {
    ControlSetText, Edit3, %pot%, ahk_id%id%
    Sleep -1
    WinSet, Redraw,, ahk_id%id%
    If(autobet)
    {
      PostLeftClick(730, 540, id)
    } 
  }
  Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    ControlGet, v, Visible, , Edit1, ahk_id%id%
    if (v)
    {
      ;Msgbox, %pot%
      if (pot > max)
      {
        pot := max
      }
      ControlSetText, Edit1, %pot%, ahk_id%id%
      Sleep -1
      ;WinSet, Redraw,, ahk_id%id%
      If(autobet)
      {
        ab := 0
        Loop, 20
        {
          ControlGetText, t, Edit1, ahk_id%id%
          if (t < pot || t > pot)
          {
            Sleep, 100
          }
          else
          {
            ;TrayTip, ,  %ab% %t% %pot%
            Sleep, 200
            
            RaiseFT(id)
            
            /*
            if (FTP_Beta)
            {
              ControlFocus, FTCButton14, ahk_id%id%
              Sleep, -1
              ControlClick, FTCButton14, ahk_id%id%
            }
            else
            {
              ControlFocus, FTCButton13, ahk_id%id%
              Sleep, -1
              ControlClick, FTCButton13, ahk_id%id%
            }
            */
            
            break
          }
        }
        ;TrayTip, ,  %ab% %t% %pot%
        ;if (ab)
        ;{
        ;  ControlFocus, FTCButton11, ahk_id%id%
        ;  Sleep, -1
        ;  ControlClick, FTCButton11, ahk_id%id%
        ;}
      }
    }
  }
  Else IfWinExist, ahk_id%id% ahk_group PrimaTables
  {
    ControlFocus, Edit1, ahk_id%id%
    ControlSetText, Edit1, %pot%, ahk_id%id%
    Sleep, -1
    WinSet, Redraw,, ahk_id%id%
    If(autobet)
    {
      WinActivate, ahk_id%id%
      WinWaitActive, ahk_id%id%, , 1
      If (errorlevel<>1)
      {
        Send, {ENTER}
      }
      
    } 
  }
  Else IfWinExist, ahk_id%id% ahk_group UBTables
  {
    ControlSetText, Edit1, %pot%, ahk_id%id%
    Sleep -1
    WinSet, Redraw,, ahk_id%id%
    If(autobet)
    {
      RaiseUB(id)
    } 
  }

  Else IfWinExist, ahk_id%id% ahk_group iPokerTables
  {
     if pot != 0
     {
	;try to write the bet five times
	attempts := 0

	loop
	{
        	if (readPot = pot OR attempts > 5)
		  break

		WriteBetBoxIpoker(id, pot)
		readPot := ReadBetBoxIpoker(id)
		attempts++
	}

	If(autobet)
	   {
	      if (readPot = pot)
	      {
	      	WinActivate, ahk_id%id%
	      	WinWaitActive, ahk_id%id%, , 1
	      	If (errorlevel<>1)
	      	{
	      	  Send, {ENTER}
	     	}
	      } 
	  }

	Click, 75, %ipokerchat%
	MouseMove, %ipokerraisex%, %ipokerraisey%
      }
   }
}


PotSizeFullTilt2(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open, ByRef max)
{
  global deduct_rake
  global FTP_Beta
  rake := 0
  notraked := 0
  maxrake := 3
  max := 7654321
  
  ftp_btn_max = FTCSkinButton24
  ftp_btn_max_pl = FTCSkinButton24
  ftp_btn_max_cap = FTCSkinButton28
  ftp_btn_min = FTCSkinButton23
  ftp_btn_pot = FTCSkinButton25
  ftp_btn_pot_pl = FTCSkinButton27
  
  WinGetTitle, title, ahk_id%id%
  StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  StringReplace,bb,bb,$,,1
  sb := sb(bb)
  ;msgbox, %bb%`n%sb%
  ControlGetText, t, Edit1, ahk_id%id%

  min := sb
  

    if (InStr(title, "Pot Limit"))
    {
      ControlGet, v, Visible, , %ftp_btn_pot_pl%, ahk_id%id% 
      if (v)
      {
        ;TrayTip, BetPot,`nPOT to zero,10,17
        x := ""
        ControlSetText, Edit1,%min%, ahk_id%id%
        Loop, 50
        {
          ControlGetText, x, Edit1, ahk_id%id%
          if (x = min)
          {
            break
            ;Traytip
          }
          sleep, 40
          ;Traytip
        }
        
        
        Loop, 50
        {
         ; TrayTip, BetPot,`nPOT result,10,17
          ControlFocus, %ftp_btn_pot_pl%, ahk_id%id%
          ControlClick, %ftp_btn_pot_pl%, ahk_id%id%
          Sleep, -1
          ControlGetText, pot, Edit1, ahk_id%id%
          if (pot != "")
          {
            break
            ;Traytip
          }
          sleep, 40
         ; TrayTip
        }
      }
    }
    else  ;unlimited betting
    {
      ControlGet, v, Visible, , %ftp_btn_pot%, ahk_id%id%
      if (v)
      {
        ;TrayTip, BetPot,`nPOT to zero,10,17
        x := ""
        ControlSetText, Edit1,%min%, ahk_id%id%
        Loop, 50
        {
          ControlGetText, x, Edit1, ahk_id%id%
          if (x = min)
          {
            break
            ;Traytip
          }
          sleep, 40
          ;Traytip
        }
        
        
        Loop, 50
        {
         ; TrayTip, BetPot,`nPOT result,10,17
          ControlFocus, %ftp_btn_pot%, ahk_id%id%
          ControlClick, %ftp_btn_pot%, ahk_id%id%
          Sleep, -1
          ControlGetText, pot, Edit1, ahk_id%id%
          if (pot != "")
          {
            break
            ;Traytip
          }
          sleep, 40
         ; TrayTip
        }
      }
      
    
    ControlGet, v, Visible, , %ftp_btn_min%, ahk_id%id%
      if (v)
      {
        ;TrayTip, BetPot,`nMIN to zero,10,17
        x := ""
        ControlSetText, Edit1,%pot%, ahk_id%id%
        Loop, 50
        {
          ControlGetText, x, Edit1, ahk_id%id%
          if (x = pot)
          {
            break
            ;Traytip
          }
          sleep, 40
          ;Traytip
        }
        
        
        Loop, 50
        {
          ;TrayTip, BetPot,`nMIN result,10,17
          ControlFocus, %ftp_btn_min%, ahk_id%id%
          ControlClick, %ftp_btn_min%, ahk_id%id%
          Sleep, -1
          ControlGetText, min, Edit1, ahk_id%id%
          if (min != pot)
          {
            break
            ;TrayTip
          }
          sleep, 40
          ;TrayTip
        }
      }
    }
    
    
  
  
  ControlSetText, Edit1, %t%, ahk_id%id%
  
  
  street := "pre"
  
  street := GetStreetFT(id)
  
  
  if (min = bb)
  {
    call := 0
  }
  else if (min > bb)
  {
    call := min / 2
  }
  else if (street != "pre")
  {
    call := bb
  }
  
  if (call != bb || street != "pre")
  {
    open := 0
  }
  
  pot := pot - (2 * call)
  
  
  
  /*
  if (deduct_rake AND street<>"pre")
  {
    rake := Floor(pot - notraked) * 0.05
    if (rake > maxrake)
    {
      rake := maxrake
    }
    pot := pot - rake
  }
  */
  
  ;Msgbox, Pot: %pot%`nRake: %rake%`nNot Raked: %notraked%
  
  
  return
}



PotSizeFullTilt2_old(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open, ByRef max)
{
  global deduct_rake
  global FTP_Beta
  rake := 0
  notraked := 0
  maxrake := 3
  
  ftp_btn_max = FTCSkinButton24
  ftp_btn_max_pl = FTCSkinButton24
  ftp_btn_max_cap = FTCSkinButton28
  ftp_btn_min = FTCSkinButton23
  ftp_btn_pot = FTCSkinButton25
  ftp_btn_pot_pl = FTCSkinButton27
  
  WinGetTitle, title, ahk_id%id%
  StringMid, bb, title, InStr(title, "/") + 1, InStr(title, a_space,"", InStr(title, "/")) - InStr(title, "/") - 1
  StringReplace,bb,bb,$,,1
  sb := sb(bb)
  ;msgbox, %bb%`n%sb%
  ControlGetText, t, Edit1, ahk_id%id%

  min := sb
  

  if (FTP_Beta)
  {    
    ControlGet, v, Visible, , %ftp_btn_max%, ahk_id%id%
    if (v)
    {
      ;TrayTip, BetPot,`nMAX,10,17
      x := ""
      ControlSetText, Edit1,, ahk_id%id%
      Loop, 50
      {
        ControlGetText, x, Edit1, ahk_id%id%
        if (x = "")
        {
          break
        }
        else
        {
          sleep, 40
        }
      }
      /*  ;NOT SURE WE NEED MAX ANYMORE
      ControlClick, %ftp_btn_max%, ahk_id%id%
      Loop, 50
      {
        ControlGetText, max, Edit1, ahk_id%id%
        if (max != "")
        {
          
          break
        }
        else
        {
          sleep, 40
        }
      }
      ;ControlGetText, max, Edit1, ahk_id%id%
      */
    }
    else if (InStr(title, "Cap No Limit") || InStr(title, "Pot Limit"))
    {
      ControlGet, v, Visible, , %ftp_btn_max_cap%, ahk_id%id%  ; CAP
      if (v)
      {
        ;TrayTip, BetPot,`nCAP MAX,10,17
        x := ""
        ControlSetText, Edit1,, ahk_id%id%
        Loop, 50
        {
          ControlGetText, x, Edit1, ahk_id%id%
          if (x = "")
          {
            break
          }
          else
          {
            sleep, 40
          }
        }
        ControlClick, %ftp_btn_max_cap%, ahk_id%id%
        Loop, 50
        {
          ControlGetText, max, Edit1, ahk_id%id%
          if (max != "")
          {
            ;if (max = "")
            ;{
            ;  continue
            ;}
            break
          }
          else
          {
            sleep, 40
          }
        }
        
      ;ControlClick, FTCButton24, ahk_id%id%
      ;  Sleep, -1
      ;  ControlGetText, max, Edit1, ahk_id%id%
      }
      else
      {
        ControlGet, v, Visible, , %ftp_btn_pot_pl%, ahk_id%id% 
        if (v)
        {
          ;TrayTip, BetPot,`nPL MAX,10,17
          x := ""
          ControlSetText, Edit1,, ahk_id%id%
          Loop, 50
          {
            ControlGetText, x, Edit1, ahk_id%id%
            if (x = "")
            {
              break
            }
            else
            {
              sleep, 40
            }
          }
          ControlClick, %ftp_btn_pot_pl%, ahk_id%id%
          Loop, 50
          {
            ControlGetText, max, Edit1, ahk_id%id%
            if (max != "")
            {
              ;if (max = "")
              ;{
              ;  continue
              ;}
              break
            }
            else
            {
              sleep, 40
            }
          }
        }
      }
    }
    /*
  
    ControlGet, v, Visible, , %ftp_btn_pot%, ahk_id%id%
    if (v)
    {
      ;TrayTip, BetPot,`nPOT,10,17
      x := ""
      ControlSetText, Edit1,, ahk_id%id%
      Loop, 50
      {
        ControlGetText, x, Edit1, ahk_id%id%
        if (x = "")
        {
          break
        }
        else
        {
          sleep, 40
        }
      }
      
      ControlClick, %ftp_btn_pot%, ahk_id%id%
      
      Loop, 50
      {
        ControlGetText, pot, Edit1, ahk_id%id%
        if (pot != "")
        {
          
          ;MsgBox, %A_Index%
          break
        }
        else
        {
          sleep, 40
        }
      }
      ;ControlClick, FTCButton22, ahk_id%id%
      ;Sleep, -1
      ;ControlGetText, pot, Edit1, ahk_id%id%
    }
    
    /*
    else if (InStr(title, "Pot Limit"))
    {
      ;TrayTip, BetPot,`nPL POT,10,17
      ControlGet, v, Visible, , %ftp_btn_pot_pl%, ahk_id%id% 
      if (v)
      {
        x := ""
        ControlSetText, Edit1,, ahk_id%id%
        Loop, 50
        {
          ControlGetText, x, Edit1, ahk_id%id%
          if (x = "")
          {
            break
          }
          else
          {
            sleep, 40
          }
        }
        ControlClick, %ftp_btn_pot_pl%, ahk_id%id%
        Loop, 50
        {
          ControlGetText, pot, Edit1, ahk_id%id%
          if (pot != "")
          {
            ;if (pot = "")
            ;{
            ;  continue
            ;}
            break
          }
          else
          {
            sleep, 40
          }
        }
      }
    }
    */
    
    ; AGAIN NOT SURE
    ;else
    ;{
    ;  pot := max
    ;}
    
    ControlGet, v, Visible, , %ftp_btn_min%, ahk_id%id%
    if (v)
    {
      ;TrayTip, BetPot,`nMIN,10,17
      x := ""
      ControlSetText, Edit1,%pot%, ahk_id%id%
      Loop, 50
      {
        ControlGetText, x, Edit1, ahk_id%id%
        if (x = pot)
        {
          ;MsgBox, %A_Index%
          break
        }
        else
        {
          sleep, 40
        }
      }
      
      ControlFocus, %ftp_btn_min%, ahk_id%id%
      ControlClick, %ftp_btn_min%, ahk_id%id%
      ;TrayTip, BetPot,`nWAITING MIN,10,17
      Sleep, -1
      Sleep, 40
      ;Msgbox, %min%
      min := ""
      Loop, 50
      {
        ControlGetText, min, Edit1, ahk_id%id%
        if (min != pot)
        {
          break
        }
        else
        {
          ControlFocus, %ftp_btn_min%, ahk_id%id%
          ControlClick, %ftp_btn_min%, ahk_id%id%
          sleep, 40
          ;TrayTip, BetPot,`nMIN %A_Index%,10,17
          
        }
      }
      ;TrayTip, BetPot,`n%min%,10,17
          
      ;ControlClick, FTCButton20, ahk_id%id%
      ;Sleep, -1
      ;ControlGetText, min, Edit1, ahk_id%id%
    }
    if (!min)
    {
      min := bb
    }
    ;TrayTip, BetPot,`nDONE,10,17
          
  
  }
  else  ; FTP OFFICIAL
  {
    /*
    ControlGet, v, Visible, , FTCButton20, ahk_id%id%
    if (v)
    {
      ControlClick, FTCButton20, ahk_id%id%
      Sleep, -1
      ControlGetText, max, Edit1, ahk_id%id%
    }
    else
    {
      ControlGet, v, Visible, , FTCButton24, ahk_id%id%
      if (v)
      {
        ControlClick, FTCButton24, ahk_id%id%
        Sleep, -1
        ControlGetText, max, Edit1, ahk_id%id%
      }
    }
  
  
    ControlClick, FTCButton21, ahk_id%id%
    Sleep, -1
    ControlGetText, pot, Edit1, ahk_id%id%
    
    ControlClick, FTCButton19, ahk_id%id%
    Sleep, -1
    ControlGetText, min, Edit1, ahk_id%id%
    */
  }
  
  ;ControlSetText, Edit1, %t%, ahk_id%id%
  street := "pre"
  
  street := GetStreetFT(id)
  
  
  if (min = bb)
  {
    call := 0
  }
  else if (min > bb)
  {
    call := min / 2
  }
  ;else if (street != "pre")
  ;{
  ;  call := bb
  ;}
  
  if (call != bb || street != "pre")
  {
    open := 0
  }
  
  pot := pot - (2 * call)
  
  
  
  /*
  if (deduct_rake AND street<>"pre")
  {
    rake := Floor(pot - notraked) * 0.05
    if (rake > maxrake)
    {
      rake := maxrake
    }
    pot := pot - rake
  }
  */
  
  ;Msgbox, Pot: %pot%`nRake: %rake%`nNot Raked: %notraked%
  
  
  return
}



PotSizePrima(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  global deduct_rake
  rake := 0
  notraked := 0
  maxrake := 3

  
  
  ;Msgbox %title%
  nl_actions = called for $,raised for $,bet for $,went all-in for $,posted small blind,posted big blind
  
  
  WinGetTitle, title, ahk_id%id%
  StringMid, hero, title, InStr(title, " - Blinds ")-1, , L
  StringTrimLeft, hero, hero, InStr(hero, " - ", true, 0)+2
  ;Msgbox %hero%
  
  ;ControlGetText, hh, RichEdit20W3, ahk_id%id%
  Loop, 10
  {
    ControlGetText, hh, RichEdit20W3, ahk_id%id%
    If hh
    {
      break
    }
    Sleep, 80
  }
  StringTrimLeft, hh, hh, InStr(hh, " wins ", true, 0)
  
  ;Msgbox, %hh%
  
  Loop, Parse, hh, `n
  {
    If a_loopfield contains %nl_actions%
    {
      StringMid, amount, a_loopfield, InStr(a_loopfield, "$")+1
      StringReplace, amount, amount, )
      StringReplace, amount, amount, `,,, All
      StringReplace, amount, amount, `n
      StringReplace, amount, amount, `r
      pot += amount
      
      IfInString, a_loopfield, raised for $
      {
        open := 0
      }
      
      IfInString, a_loopfield, posted small blind
      {
        sb := amount
        If a_loopfield contains %hero%
        {
          hero_position := "sb"
        }  
      }
      Else IfInString, a_loopfield, posted big blind
      {
        bb := amount
        If a_loopfield contains %hero%
        {
          hero_position := "bb"
        }
      }
      
    }
  }
   
  street := "pre"
  
  If InStr(hh, "> Dealing the river(")
  {
    StringTrimLeft, hh2, hh, InStr(hh, "> Dealing the river(", true, 0)
    street := "river"
    open := 0
  }
  Else If InStr(hh, "> Dealing the turn(")
  {
    StringTrimLeft, hh2, hh, InStr(hh, "> Dealing the turn(", true, 0)
    street := "turn"
    open := 0
  }
  Else If InStr(hh, "> Dealing the Flop(")
  {
    StringTrimLeft, hh2, hh, InStr(hh, "> Dealing the Flop(", true, 0)
    street := "flop"
    open := 0
  }
  Else
  {
    hh2 := hh
  }

  Loop, Parse, hh2, `n
  {
    ;Msgbox %hh2%
    If a_loopfield contains %nl_actions%
    {
      StringMid, amount, a_loopfield, InStr(a_loopfield, "$")+1
      StringReplace, amount, amount, `)
      Stringreplace, amount, amount, `n
      Stringreplace, amount, amount, `,,, All
      
      notraked += amount
         
      IfInString, a_loopfield, > %hero%
      {
        hero_bet += amount
      }
      Else
      {
        call := amount
      }
        
    }
  }
  
  if(hero_bet >= call)
  { 
    call := 0
  }
  Else
  {
    call -= hero_bet
  }
  call := iif( call, call, 0 )

  
  if(deduct_rake AND street<>"pre")  
  {
    rake := Floor(pot - notraked) * 0.05
    If (rake > maxrake)
    {
      rake := maxrake
    }
    pot := pot - rake
  }
  return
}


PotSizeCrypto(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  global deduct_rake
  rake := 0
  notraked := 0
  maxrake := 3
  
  nl_actions = calls $,raises to $,bets $,posts ante $,posts small blind $,posts big blind $
  WinGetTitle, title, ahk_id%id%
  StringMid, hero, title, InStr(title, "logged in as ") + 13
  
  ControlGetText, hh, RICHEDIT1, ahk_id%id%
  StringTrimLeft, hh, hh, InStr(hh, "Starting new hand: #", true, 0)
  StringReplace, hh, hh, €,$, All
  StringReplace, hh, hh, £,$, All
  Loop, Parse, hh, `n
  {
    If a_loopfield contains %nl_actions%
    {
      StringMid, amount, a_loopfield, InStr(a_loopfield, "$") + 1
      StringReplace, amount, amount, `r,, All
      StringReplace, amount, amount, `n,, All
      StringReplace, amount, amount, %A_SPACE%,, All
      StringReplace, amount, amount, %A_TAB%,, All
      
      pot += amount
      
      IfInString, a_loopfield, raises to $
      {
        open := 0  
      }
     
      IfInString, a_loopfield, posts small blind $
      {
        sb := amount
        If a_loopfield contains %hero%
        {
          hero_position := "sb"
        }  
      }
      Else IfInString, a_loopfield, posts big blind $
      {
        bb := amount
        If a_loopfield contains %hero%
        {
          hero_position := "bb"
        }
      }
    }
  }
  ;Msgbox, %sb% %bb%
  hh2 := hh
  street := "pre"
  If InStr(hh2, "Dealer: Dealing River:")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "Dealer: Dealing River:", true, 0)
    open := 0
    street := "river"
  }
  Else If InStr(hh2, "Dealer: Dealing Turn:")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "Dealer: Dealing Turn:", true, 0)
    open := 0
    street := "turn"
  }
  Else If InStr(hh2, "Dealer: Dealing Flop:")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "Dealer: Dealing Flop:", true, 0)
    open := 0
    street := "flop"
  }

  ;Msgbox, %hh2%
  Loop, Parse, hh2, `n
  {
    If a_loopfield contains %nl_actions%
    {
      StringMid, amount, a_loopfield, InStr(a_loopfield, "$") + 1
      StringReplace, amount, amount, `r,, All
      StringReplace, amount, amount, `n,, All
      StringReplace, amount, amount, %A_SPACE%,, All
      StringReplace, amount, amount, %A_TAB%,, All
      notraked += amount
      If a_loopfield contains %hero%
      {
        hero_bet += amount
      }
      Else
      {
        call := amount
      }
    }
  
    if(hero_bet >= call)
    { 
      call := 0
    }
    Else
    {
      call -= hero_bet
    }
  }
  call := iif( call, call, 0 )

  if (deduct_rake AND street<>"pre")
  {
    rake := Floor(pot - notraked) * 0.05
    if (rake > maxrake)
    {
      rake := maxrake
    }
    pot := pot - rake
  }
  
  return
}


PotSizeParty(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  global deduct_rake
  global fphg_party_hh_folder
  global debug
  global fphg_uselive
  WinGetTitle, title, ahk_id%id%
  
  nl_actions = calls [,raises [,bets [,all-In  [,posts ante [,posts small blind [,posts big blind [, posts big blind + dead [
  
  notraked := 0
  maxrake := 3
  tourney := 0
  
  StringTrimRight, tablename, title, ( StrLen(title) - (InStr(title, " - ")-1) )
  
  
  ;Get hero's screen name from the window title
  StringMid, hero, title, InStr(title, "Luck ") + 5
  StringMid, hero, hero, InStr(hero, "!")-2,, L
  StringReplace, hero, hero, %A_SPACE%,, All
  ;Msgbox %hero%
  hhf := fphg_party_hh_folder . tablename . ".hhf"
  
  if (fphg_uselive)
  {
    ControlGetText, handnum, Static11, ahk_id%id%
    StringTrimLeft, handnum, handnum, InStr(handnum, "#")
    StringReplace, handnum, handnum, `,,, All
    StringReplace, handnum, handnum, .,, All
    StringReplace, handnum, handnum, %A_SPACE%,, All
    ;Msgbox, %handnum%
    hhf := fphg_party_hh_folder . "live\" . handnum . ".live"
  }
  
  ;Msgbox %hhf%
  FileRead, hh, %hhf%
  if not ErrorLevel
  {
    ControlGetText, currenthand, Static11, ahk_id%id%
    StringReplace, currenthand, currenthand, `,,, All
    StringTrimLeft, currenthand, currenthand, InStr(currenthand, "#")
    StringReplace, currenthand, currenthand, %A_SPACE%,, All
    currenthand := "Hand History for Game " . currenthand
    ;Msgbox, %currenthand%
    StringTrimLeft, hh, hh, InStr(hh, currenthand, true, 0)-1
    IfNotInString, hh, %currenthand%
    {
      TrayTip, BetPot,`nParty HHF reader`n`n%currenthand% not found in file %hhf%,10,17
      Exit
    }
    ;Msgbox, %hh%
  }
  else
  {
    if (fphg_uselive)
    {
      TrayTip, BetPot,`nParty HHF reader`n`nFPHG live file not found for game# %handnum%,10,17
      Exit
    }
    else
    {
      TrayTip, BetPot,`nParty HHF reader`n`nTable %tablename% hand history not found,10,17
      Exit
    }
  }
   
  Loop, Parse, hh, `n
   {
    If a_loopfield contains %nl_actions%
     {
      StringMid, amount, a_loopfield, InStr(a_loopfield, "[") + 1, (InStr(a_loopfield, "]")-0) - InStr(a_loopfield, "[") - 1
      StringReplace, amount, amount, €
      StringReplace, amount, amount, £
      StringReplace, amount, amount, $
      StringReplace, amount, amount, `,,, All
      StringReplace, amount, amount, A_SPACE
      amount := RegExReplace(amount, "[A-Za-z]")
      pot += amount
      IfInString, a_loopfield, posts small blind [
      {
        ;StringMid, amount, a_loopfield, InStr(a_loopfield, "[") + 1, (InStr(a_loopfield, "]")-0) - InStr(a_loopfield, "[") - 1
        ;StringReplace, amount, amount, $
        sb := amount
        If a_loopfield contains %hero%
        {
          hero_position := "sb"
        }  
      }
      Else IfInString, a_loopfield, posts big blind [
      {
        ;StringMid, amount, a_loopfield, InStr(a_loopfield, "[") + 1, (InStr(a_loopfield, "]")-0) - InStr(a_loopfield, "[") - 1
        ;StringReplace, amount, amount, $
        bb := amount
        If a_loopfield contains %hero%
        {
          hero_position := "bb"
        }
      }
      Else If(open = 1 AND InStr(a_loopfield, "raises [", true, 0))
      {
        open := 0
        ;Msgbox "Pre flop Raise"
      }
      Else If(open = 1 AND InStr(a_loopfield, "all-In  [", true, 0))
      {
        open := 0
        ;Msgbox "Pre flop All-In"
      }
      ;msgbox, %amount%
      ;msgbox, %pot%
     }
   }

  if(bb = 0)
  {
    tourney := 1
    ControlGetText, text, Static6, ahk_id%id%
    ;msgbox, %text%
    IfNotInString, text, Blinds-Antes
      StringMid, bb, text, InStr(text, "/") + 1, InStr(text, ")") - InStr(text, "/") - 1 ;___so we retrieve the big blind from the static instead
    else
      StringMid, bb, text, InStr(text, "/") + 1, InStr(text, "-","",InStr(text, "/")) - InStr(text, "/") - 1
    ;msgbox, %bb%
    
    sb := bb / 2
  
  }
  ;Msgbox, %bb%
  ;Msgbox, %sb%
  
  hh2 := hh
  street := "pre"
  If InStr(hh2, "** Dealing River **")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "** Dealing River **", true, 0)
    open := 0
    street := "river"
  }
  Else If InStr(hh2, "** Dealing Turn **")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "** Dealing Turn **", true, 0)
    open := 0
    street := "turn"
  }
  Else If InStr(hh2, "** Dealing Flop **")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "** Dealing Flop **", true, 0)
    open := 0
    street := "flop"
  }
  
  ;Msgbox, %hero%`n`n`n%hh2%
  Loop, Parse, hh2, `n
  {
    If a_loopfield contains %hero%
    {
      ;Msgbox %a_loopfield%
      If a_loopfield contains %nl_actions%
      {
        StringMid, amount, a_loopfield, InStr(a_loopfield, "[") + 1, (InStr(a_loopfield, "]")-0) - InStr(a_loopfield, "[") - 1
        StringReplace, amount, amount, $
        StringReplace, amount, amount, €
        StringReplace, amount, amount, £
        StringReplace, amount, amount, A_SPACE
        amount := RegExReplace(amount, "[A-Za-z]")
        hero_bet += amount
      }
    }
  }
  
  
  If (tourney <> 1)
  {
    If(deduct_rake <> 0 AND InStr(hh, "** Dealing Flop"))  
    {
      StringTrimLeft, hh, hh, InStr(hh, "** Dealing ", true, 0)
      c := InStr, hh, "** Dealing "
      ;Msgbox %hh%
      Loop, Parse, hh, `n
      {
        If a_loopfield contains %nl_actions%
        {
          StringMid, amount, a_loopfield, InStr(a_loopfield, "[") + 1, (InStr(a_loopfield, "]")-0) - InStr(a_loopfield, "[") - 1
          StringReplace, amount, amount, $
          StringReplace, amount, amount, €
          StringReplace, amount, amount, £
          amount := RegExReplace(amount, "[A-Za-z]")
          notraked += amount
        }
      }

      rake := Floor(pot - notraked) * 0.05
      If rake > %maxrake%
      {
        rake := maxrake
      }

      If(rake >= 0.25 AND InStr(tablename, "Jackpot"))
	rake += 0.5

      ;msgbox, rake = %rake%
      If (tourney <> 1)
      {
        pot := pot - rake
      }
    }
  }
  
  ;Msgbox %pot% 
  
  If (tourney = 1)
  {
    pot := pot + sb + bb
  }
    
  match_mode = %a_titlematchmode%
  SettitleMatchMode 2
  ControlGetText, call, Call, ahk_id%id%
  SettitleMatchMode %match_mode%
  StringMid, call, call, InStr(call, "(") + 1, InStr(call, ")") - InStr(call, "(") - 1
  StringReplace, call, call, $
  StringReplace, call, call, €
  StringReplace, call, call, £
  call := iif( call, call, 0 )
    
  ;Msgbox %pot%
  return
}

PotSizeIPoker(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  global deduct_rake, IPokerX, IPokerY, IPokerChat, IPoker_BetBoxColor, IPoker_ShowBetBoxColor

  rake := 0
  notraked := 0
  maxrake := 3
  tourney := 0

  WinActivate, ahk_id %id%
  WinWaitActive, ahk_id %id%

  CoordMode, pixel, screen
  WinGetPos, x, y, , , ahk_id %id%
  X += iPokerX
  y += iPokerY

  PixelGetColor, col, x,  y

  if IPoker_ShowBetBoxColor
	Msgbox Ipoker bet box color: %col%

  if (col != iPoker_BetBoxColor)
    return

  nl_actions = calls $, raises $, bets $, All-In $, posts Small Blind $, posts Big Blind $
  
  StringMid, tablename, title, (InStr(title, ": ")+2), (InStr(title, " - ")-(InStr(title, ": ")+2))
  
  ;Get hero's screen name from the lobby title
  WinGetTitle, lobby, Nickname: ahk_class PTIODEVICE
  StringTrimLeft, hero, lobby, InStr(lobby, "Nickname:") + 9
  StringLeft, hero, hero, InStr(hero, A_space)
  ;Msgbox %hero%
 
  ;grab HH from chat box
  hh :=
  oldClipboard = %clipboard%
  clipboard =

  attempts := 0

  loop
  {
  	WinActivate, ahk_id %id%
  	WinWaitActive, ahk_id %id%

	Click, 75, %ipokerchat%
 	sleep, 150
	SendInput, ^a^c
	ClipWait, 0.5
	if !errorlevel or attempts > 3
		break
	attempts++
  }

  hh := clipboard
  ;msgbox %hh%
  clipboard = %oldClipBoard%

  if hh =
  {
    TrayTip, BetPot,`nError reading chat box on iPoker table: %tableName%, 10, 17
    return
  }

  StringGetPos, pos, hh, (#, R
  StringTrimLeft, hh, hh, pos

  Loop, Parse, hh, `n
  {
    If a_loopfield contains %nl_actions%
     {	
	StringTrimRight, amount, a_loopfield, 2
	StringGetPos, pos, amount,%a_space%, R	
	StringRight, amount, amount, StrLen(amount) - pos
	StringReplace, amount, amount, `,,, All
	StringReplace, amount, amount, %a_space%
	StringReplace, amount, amount, $,,All
	pot += amount
	;msgbox %amount%
      IfInString, a_loopfield, posts Small Blind $
      {       
        sb := amount
        If a_loopfield contains %hero%
        {
          hero_position := "sb"
        }  
      }
      Else IfInString, a_loopfield, posts Big Blind $
      {
        bb := amount
        If a_loopfield contains %hero%
        {
          hero_position := "bb"
        }
      }
      Else If(open = 1 AND InStr(a_loopfield, "raises $", true, 0))
      {
        open := 0
        ;Msgbox "Pre flop Raise"
      }
      Else If(open = 1 AND InStr(a_loopfield, "All-in $", true, 0))
      {
        open := 0
        ;Msgbox "Pre flop All-In"
      }
      ;msgbox, %amount%
      ;msgbox, %pot%
     }
   }

  IfNotInString, hh, $
    tourney := 1
   
  ;msgbox tourney: %tourney%
 
  ;Msgbox, BB: %bb%
  ;Msgbox, SB: %sb%
  
  hh2 := hh
  street := "pre"
  If InStr(hh2, "Dealing River")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "Dealing River", true, 0)
    open := 0
    street := "river"
  }
  Else If InStr(hh2, "Dealing Turn")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "Dealing Turn", true, 0)
    open := 0
    street := "turn"
  }
  Else If InStr(hh2, "Dealing Flop")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "Dealing Flop", true, 0)
    open := 0
    street := "flop"
  }
  ;msgbox %street%
  ;Msgbox, %hero%`n`n`n%hh2%
  Loop, Parse, hh2, `n
  {    
      ;Msgbox %a_loopfield%
      If a_loopfield contains %nl_actions%
      {
	StringTrimRight, amount, a_loopfield, 2
	StringGetPos, pos, amount,%a_space%, R	
	StringRight, amount, amount, StrLen(amount) - pos
	StringReplace, amount, amount, `,,, All
	StringReplace, amount, amount, %a_space%
	StringReplace, amount, amount, $,,All
	notraked += amount       

	If a_loopfield contains %hero%
   	{
		 hero_bet += amount
      }
	Else
        {
        	call := amount
        }
     }
 } 
     if(hero_bet >= call)
     {
       call := 0
     }
     Else
     {
       call -= hero_bet
     }
  
  call := iif( call, call, 0 )

  If (tourney <> 1)
  {
    If(deduct_rake AND street <>"pre")  
    {

      rake := Floor(pot - notraked) * 0.05
      If (rake > maxrake)
      {
        rake := maxrake
      }
      pot := pot - rake
    }
  }
  ;Msgbox Pot: %pot%`nrake:%rake%`nhero bet:%hero_bet%`ncall:%call%
  return
}

;returns the amount currently written into the ipoker bet box
ReadBetBoxIPoker(id)
{
	global ipokerx, ipokery
	oldClipboard = %clipboard%
	clipboard =

	WinActivate, ahk_id %id%
	WinWaitActive, ahk_id %id%
   	Click, %ipokerx%, %ipokery%
	;Sleep 50
	Send {HOME}+{END}^c

	ClipWait, 0.3
	If !ErrorLevel
	    t := clipboard

        clipboard = %oldClipBoard%
	return t
}

;writes the bet amount into the bet box then moves the cursor to the raise button
WriteBetBoxIpoker(id, amount)
{
	global iPokerX, iPokerY, iPokerRaiseX, iPokerRaiseY
	
	WinActivate ahk_id %id%
	WinWaitActive ahk_id %id%
	Click, %iPokerX%, %iPokerY%
	;sleep 50
	Send {HOME}+{END}%amount%
	MouseMove, iPokerRaiseX, iPokerRaiseY
}

PotSizeStars(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  global use_old_stars_buttons, stars_editbox
  CoordMode, Pixel, Screen
  WinGetPos, x, y, w, h, ahk_id%id%

  x1 := 700
  y1 := 440
  x2 := 770
  y2 := 450
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)  

  col := GetPredominateColor(x1, y1, x2, y2)
  ;Msgbox, %col%
  if (col = "0x00327F")
  {
    ;ThemeDir := "normal"
    PotThemeDir := "classic"
    CallThemeDir := "classic"
  
  }
  else if (col = "0xDDD7CC")
  {
    PotThemeDir := "hypersimple"
    CallThemeDir := "hypersimple"
  
  }
  else
  {
    if (debug)
    {
      Msgbox, Unable to match slider colour: %col% to a known theme
    }
    return
  }
  if (use_old_stars_buttons)
  {
    CallThemeDir := CallThemeDir . "\old"
  }
 
  street := GetStreetStars(id)

  if (w <= 526)
  {
    SizeDir := 0
  }
  else if (w <= 621)
  {
    SizeDir := 1
  }
  else if (w <= 736)
  {
    SizeDir := 2
  }
  else if (w <= 875)
  {
    SizeDir := 3
  }
  else if (w <= 1037)
  {
    SizeDir := 4
  }
  else if (w <= 1227)
  {
    SizeDir := 5
  }
  else
  {
    SizeDir := 6
  } 

 
  PicDir := "StarsPics"
  potPicDir := PicDir . "\" . PotThemeDir . "\pot\" . SizeDir
  buttonPicDir := PicDir . "\" . CallThemeDir . "\call\" . SizeDir
  ;Msgbox, %potPicDir%`n%buttonPicDir%

  pot_x1 := 380
  pot_y1 := 8
  pot_x2 := 460
  pot_y2 := 32
  relStarsWindowPoint(id, pot_x1, pot_y1)
  relStarsWindowPoint(id, pot_x2, pot_y2)
  pot := DigitSearch(pot_x1, pot_y1, pot_x2, pot_y2, id, potPicDir, "", 50)
  
  call_x1 := 550
  call_y1 := 510
  call_x2 := 645
  call_y2 := 533
  relStarsWindowPoint(id, call_x1, call_y1)
  relStarsWindowPoint(id, call_x2, call_y2)
  call := DigitSearch(call_x1, call_y1, call_x2, call_y2, id, buttonPicDir, "", 50)
  call := iif( call, call, 0 )

  bb := GetBBStars(id, GameTypeStars(WinGetTitle(id)))
  sb := sb(bb)
  
  
  if (street = "pre")
  {
    ControlGetText, t, %stars_editbox%, ahk_id%id%
    ControlSetText, %stars_editbox%, 0, ahk_id%id%
    raise_x1 := 675
    raise_y1 := 510
    raise_x2 := 770
    raise_y2 := 533
    relStarsWindowPoint(id, raise_x1, raise_y1)
    relStarsWindowPoint(id, raise_x2, raise_y2)
    minraise := DigitSearch(raise_x1, raise_y1, raise_x2, raise_y2, id, buttonPicDir, "", 50)
    t := Round(t, 2)
    ControlSetText, %stars_editbox%, %t%, ahk_id%id%
    Sleep, -1
    
    if (minraise > (2*bb))
    {
      ;pot has been raised
      if (call = bb)
      {
        ;pot was minraised, and we are the BB
        hero_bet := bb
        hero_position := "bb"
      }
      else if (call < (bb*2))
      {
        ;pot was minraised, and we are the SB
        hero_bet := sb
        hero_position := "sb"
      }
    }
    else if (call = bb)
    {
      ;hero is not a blind, unraised pot, do nothing
    }
    else if (call = 0)
    {
      ;unraised pot, hero is the BB
      hero_bet := bb
      hero_position := "bb"
    }
    else if (call < bb)
    {
      ;unraised pot, hero is the SB
      hero_bet := sb
      hero_position := "sb"
    }
    else
    {
      ;pot has been raised, we are not opening
      open := 0
    }
  }
  else
  {
    ;not pre-flop, no need for open adjustment
    open := 0
  }
 
  return
}


PotSizeUB(id, ByRef pot, ByRef call, ByRef sb, ByRef bb, ByRef hero_bet, ByRef street, ByRef hero_position, ByRef open)
{
  
  
  CoordMode, Pixel, Screen
  WinGetPos, x, y, w, h, ahk_id%id%

  
  street := GetStreetStars(id)

 
 
  PicDir := "UBPics"
  potPicDir := PicDir  ;. "\" . PotThemeDir . "\pot\" . SizeDir
  buttonPicDir := PicDir ;. "\" . CallThemeDir . "\call\" . SizeDir
  ;Msgbox, %potPicDir%`n%buttonPicDir%

  pot_x1 := 580
  pot_y1 := 460
  pot_x2 := 700
  pot_y2 := 480
  relStarsWindowPoint(id, pot_x1, pot_y1)
  relStarsWindowPoint(id, pot_x2, pot_y2)
  pot := DigitSearch(pot_x1, pot_y1, pot_x2, pot_y2, id, potPicDir, "", 50)
  
  call_x1 := 350
  call_y1 := 460
  call_x2 := 460
  call_y2 := 480
  relStarsWindowPoint(id, call_x1, call_y1)
  relStarsWindowPoint(id, call_x2, call_y2)
  call := DigitSearch(call_x1, call_y1, call_x2, call_y2, id, buttonPicDir, "", 50)
  call := iif( call, call, 0 )


  WinGetTitle, title, ahk_id%id%
  
  StringTrimLeft, bb, title, InStr(title, "$", true, 0)-1 
  StringTrimRight, bb, bb, Strlen(bb) - InStr(bb, A_Space)
  StringReplace, bb, bb, $., $0., All
  StringReplace, bb, bb, $,, All
  StringReplace, bb, bb, %A_Space%,, All

  ;bb := GetBBStars(id, GameTypeStars(WinGetTitle(id)))
  sb := sb(bb)
  
  
  if (street = "pre")
  {
    ControlGetText, t, Edit1, ahk_id%id%
    ControlSetText, Edit1, 0, ahk_id%id%
    raise_x1 := 460
    raise_y1 := 460
    raise_x2 := 580
    raise_y2 := 480
    relStarsWindowPoint(id, raise_x1, raise_y1)
    relStarsWindowPoint(id, raise_x2, raise_y2)
    minraise := DigitSearch(raise_x1, raise_y1, raise_x2, raise_y2, id, buttonPicDir, "", 50)
    t := Round(t, 2)
    ControlSetText, Edit1, %t%, ahk_id%id%
    Sleep, -1
    
    if (minraise > (2*bb))
    {
      ;pot has been raised
      if (call = bb)
      {
        ;pot was minraised, and we are the BB
        hero_bet := bb
        hero_position := "bb"
      }
      else if (call < (bb*2))
      {
        ;pot was minraised, and we are the SB
        hero_bet := sb
        hero_position := "sb"
      }
    }
    else if (call = bb)
    {
      ;hero is not a blind, unraised pot, do nothing
    }
    else if (call = 0)
    {
      ;unraised pot, hero is the BB
      hero_bet := bb
      hero_position := "bb"
    }
    else if (call < bb)
    {
      ;unraised pot, hero is the SB
      hero_bet := sb
      hero_position := "sb"
    }
    else
    {
      ;pot has been raised, we are not opening
      open := 0
    }
  }
  else
  {
    ;not pre-flop, no need for open adjustment
    open := 0
  }
  ;pot := pot - (2*hero_bet)
  pot := pot - (2 * call) - hero_bet
  return
}



DigitSearch(startX,startY,endX,endY,win,dir,ex="",shades=1) {

global debug

If ex =
 ex = bmp
batchlines = %A_BatchLines%
SetBatchLines -1
;WinGetPos,Xwin,Ywin,,,ahk_id%win%
WinGetPos,Xwin,Ywin,w,h,ahk_id%win%

;Msgbox, %startX%,%startY%`n%endX% %endY%


CoordMode, Pixel, Screen
Loop, 11 {
  i = %a_index%
  If i = 10
    i = 0
  else if i = 11
    i = -1
  lastXpos := startX + Xwin
  Loop {
    
    
    
    
    x1 := lastXpos + 1
    y1 := startY + Ywin
    x2 :=  endX + Xwin
    y2 := endY + Ywin
    
    if (debug)
    {
      debug_gui(id, x1, y1, x2, y2, 50)
    }
    
    ImageSearch, lastXpos,, x1, y1, x2, y2, *%shades% %dir%\%i%.%ex%
    
    
    If ( errorLevel )
    {
      break
    }
    p++
    p%p% = %lastXpos%
    If i = -1
      t = .
    else
      t = %i%
    StringReplace, xpos, lastXpos, -, _
    c%xpos% = %t%
   }
 }

Loop, %p%
 p_all := p_all "," p%a_index%

Sort, p_all, N D, U
;Msgbox %p_all%
Loop, Parse, p_all, `,
{
 StringReplace, xpos, a_loopfield, -, _
    
 amount := amount "" c%xpos%
 ;Msgbox,%amount%
} 
CoordMode, Pixel, Relative
SetBatchLines %batchlines%
return amount
}



;Juks rocks
PostLeftClick(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, 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)
}




GetBBStars(id, game_type) {
WinGetTitle, title, ahk_id%id%
game_type = NL Ring
If (game_type = "NL Ring")
 return StrRep(StrMid(title,"/",a_space), "$")
else if (game_type = "NL Tourney")
 return StrRep(StrMid(title,"/",a_space,InStr(title," - Blinds")),"$")
}


GameTypeStars(title) {
If InStr(title, " - Limit Stud")
 return "Stud"
else if ((InStr(title, " - No Limit Hold'em") || InStr(title, " - Pot Limit Hold'em"))
  && InStr(title, "Tournament"))
 return "NL Tourney"
else if (InStr(title, " - No Limit Hold'em") || InStr(title, " - Pot Limit Hold'em"))
 return "NL Ring"
else
 return "Limit"
}

sb(bb) {
If bb = .25
 sb := .10
else if bb = 15
 sb = 10
else if bb = 0.05
 sb = 0.02
else
 sb := bb/2
 
if (sb > 1)
{
  sb := Round(sb, 0)
}
else
{
  sb := Round(sb, 2)
}
return sb
}






GetStreetStars(id)
{
  global debug
  CoordMode, Pixel, Screen

  street := "pre"
  
  x1 := 490
  y1 := 155
  x2 := 525
  y2 := 205
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  
  
  
  
  if (debug)
    {
      debug_gui(id, x1, y1, x2, y2)
    }
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "river"
    return street
  }
  
  x1 := 435
  y1 := 155
  x2 := 470
  y2 := 205
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  if (debug)
    {
      debug_gui(id, x1, y1, x2, y2)
    }
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "turn"
    return street
  }



  x1 := 382
  y1 := 155
  x2 := 415
  y2 := 205
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  if (debug)
    {
      debug_gui(id, x1, y1, x2, y2)
    }
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "flop"
  }

  return street
}

GetStreetFT(id)
{
  global debug
  global caller_hwnd
  if (caller_hwnd != "")
  {
    id := caller_hwnd
  }
  CoordMode, Pixel, Screen

  street := "pre"
  
  x1 := 485
  y1 := 214
  x2 := 520
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  
  
  
  
  if (debug)
    {
      debug_gui(id, x1, y1, x2, y2)
    }
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "river"
    return street
  }
  
  x1 := 431
  y1 := 214
  x2 := 461
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  if (debug)
    {
      debug_gui(id, x1, y1, x2, y2)
    }
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "turn"
    return street
  }



  x1 := 378
  y1 := 214
  x2 := 414
  y2 := 260
  relStarsScreenPoint(id, x1, y1)
  relStarsScreenPoint(id, x2, y2)
  if (debug)
    {
      debug_gui(id, x1, y1, x2, y2)
    }
  If ( GetPixelCount(x1, y1, x2, y2, 0xffffff) > 5 )
  {
    street := "flop"
  }

  return street
}





StrRep(str,char,rep_char="",all=1)
{
  StringReplace,str,str,%char%,%rep_char%,%all%
  return str
}

StrMid(str,str1,str2,startPos1=1,startPos2=1,caseSense=0){
If startPos1 =
 startPos1 = 1
If startPos2 =
 startPos2 = 1
StringTrimLeft,o,str,InStr(str,str1,cS,startPos1) + StrLen(str1) - 1
StringLeft,o,o,InStr(o,str2,caseSense,startPos2)-1
return o
}

IIf(_boolExpr, _exprTrue, _exprFalse) {
If _boolExpr
 Return _exprTrue
else
 return _exprFalse
}


WinGetTitle(win) {
WinGetTitle, title, ahk_id%win%
return title
}

; finds number of specified pixels in a region
GetPixelCount(x1, y1, x2, y2, color, options="")
{
  CoordMode, Pixel, Screen
  pixels := (x2 - x1 + 1)*(y2 - y1 + 1)
  If ( pixels <= 0 )
  {
    ErrorLevel = 1
    return
  }
  count = 0
  x = %x1%
  Loop
  {
    If ( x > x2 )
    {
      break
    }
    y = %y1%
    Loop
    {
      If ( y > y2 )
      {
        break
      }
      PixelGetColor, c, x, y, %options%
      If ( c = color )
      {
        count++
      }
      y++
    }
    x++
  }
  return count
}
; finds the predomatinate color in a region
GetPredominateColor(x1,y1,x2,y2,options="") {
global debug

if (debug)
  {
    debug_gui(id, x1, y1, x2, y2)
  }  
pixels := (x2 - x1 + 1)*(y2 - y1 + 1)
If ( pixels <= 0 ) {
        ErrorLevel = -1
        return
 }
x = %x1%
Loop {
        If ( x > x2 )
                break
        y = %y1%
        Loop {
                        If ( y > y2 )
                                break
                        PixelGetColor, c, x, y, %options%
                        num%c%++
                        all_colors = %all_colors%|%c%
                        y++
                        ;done++
                        ;Tooltip % Floor((done/pixels)*100) "%"
         }
        x++
 }
StringTrimLeft, all_colors, all_colors, 1
num%pred_c% = 0
Loop, Parse, all_colors, |
 {
        If ( num%a_loopfield% > num%pred_c% )
                pred_c = %a_loopfield%
 }
ErrorLevel := num%pred_c%
return pred_c
}



getid()
{
  global act_only_on_active_table
  ;ut := UrgentTable()
  ;if (ut)
  ;{
  ;  id := ut
  ;}
  ;else
  ;{
    tn := TableNav()
    if (tn)
    {
      id := tn
    }
    else
    {
      id := ""
      if (act_only_on_active_table = 1)
      {
        ;MsgBox, Active Table Mode
        WinGet,id,,A
      }
      else
      {
        ;MsgBox, Table Under Cursor Mode
        MouseGetPos, , , id
      }
    }
  ;}
  return id
}

TableNav()
{
  If ! WinExist("blue_bar ahk_class AutoHotkeyGUI")
    return 0
  SendMessage, 0x5555
  return WinExist("ahk_id" errorLevel )
}

UrgentTable()
{
  If ! WinExist("urgent_table ahk_class AutoHotkeyGUI")
    return 0
  SendMessage, 0x5555
  return WinExist("ahk_id" errorLevel )
}


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

relStarsWindowPoint(id, ByRef x, ByRef y)
{
  global border
  global caption
  relStarsClientPoint(id, x, y)
  x := x + border
  y := y + border + caption
}

relStarsScreenPoint(id, ByRef x, ByRef y)
{
  relStarsWindowPoint(id, x, y)
  WinGetPos, x1, y1, , , ahk_id%id%
  x += x1
  y += y1
}


reverse_calc_stars_client_area(cw, ByRef w, ByRef h)
{
  global border
  global caption
  w := cw + (2*border) 
  h := Floor(cw / 1.45) + (2*border) + caption
}

client_area(id, ByRef x, Byref y, ByRef w, Byref h)
{
  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
  return
}


debug_gui(id, x1, y1, x2, y2, delay=500)
{
  Gui, 2: +Alwaysontop +Lastfound +Owner
  Gui, 2: Color, ffffff
  WinSet, Transparent, 200
  Gui, 2: -Caption
  w1 := x2 - x1
  h1 := y2 - y1
  Gui, 2: Show, w%w1% h%h1% x%x1% y%y1% NoActivate
  Sleep, %delay%
  Gui,2: Destroy
}

FoldUB(id)
{
  ControlGet, v, Visible, , Button29, ahk_id%id%
  if (v)
  {
    ControlFocus, Button29, ahk_id%id%
    Sleep, -1
    ControlClick, Button29, ahk_id%id%
  }
  else
  {
    ControlGet, v, Visible, , Button16, ahk_id%id%
    if (v)
    {
      ControlFocus, Button16, ahk_id%id%
      Sleep, -1
      ControlClick, Button16, ahk_id%id%
    }
    else
    {
      ControlGet, v, Visible, , Button18, ahk_id%id%
      if (v)
      {
        ControlFocus, Button18, ahk_id%id%
        Sleep, -1
        ControlClick, Button18, ahk_id%id%
      }
      else
      {
        ControlGet, v, Visible, , Button13, ahk_id%id%
        if (v)
        {
          ControlFocus, Button13, ahk_id%id%
          Sleep, -1
          ControlClick, Button13, ahk_id%id%
        }
      }
    }
  }
}

CallUB(id)
{
  ControlGet, v, Visible, , Button19, ahk_id%id%
  if (v)
  {
    ControlFocus, Button19, ahk_id%id%
    Sleep, -1
    ControlClick, Button19, ahk_id%id%
  }
}

RaiseUB(id)
{
  ControlGet, v, Visible, , Button51, ahk_id%id%
  if (v)
  {
    ControlFocus, Button51, ahk_id%id%
    Sleep, -1
    ControlClick, Button51, ahk_id%id%
  }
}

FoldStars(id)
{
  PostStarsClick(415,501,id)
}

CallStars(id)
{
  PostStarsClick(600,533,id)
}
RaiseStars(id)
{
  PostStarsClick(730,520,id)
}

FoldIPoker(id)
{
  global iPokerFoldX, iPokerFoldY
  Click, %iPokerFoldx%, %iPokerFoldY%
}

CallIPoker(id)
{
  global iPokerCallx, ipokerCally
  Click, %iPokerCallX%, %iPokerCallY%
}

RaiseIPoker(id)
{
  global iPokerRaiseX, ipokerRaiseY
  Click, %ipokerRaiseX%, %iPokerRaiseY%
}

FoldCrypto(id)
{
  PostStarsClick(480,500,id)
}

CallCrypto(id)
{
  PostStarsClick(602,534,id)
}
RaiseCrypto(id)
{
  PostStarsClick(726,534,id)
}


FoldFT(id)
{
  global FTP_Beta
  global fold_to_any
  
  if (FTP_Beta)
  {
    if (fold_to_any)
    {
      ControlGet, v, Visible, , FTCSkinButton35, ahk_id%id%
      if (v)
      {
        ControlFocus, FTCSkinButton35, ahk_id%id%
        Sleep, -1
        ControlClick, FTCSkinButton35, ahk_id%id%
      }
    }
    
    else
    {
      ControlGet, v, Visible, , FTCSkinButton29, ahk_id%id%
      if (v)
      {
        ControlFocus, FTCSkinButton29, ahk_id%id%
        Sleep, -1
        ControlClick, FTCSkinButton29, ahk_id%id%
      }
      else
      {
        ControlGet, v, Visible, , FTCSkinButton11, ahk_id%id%
        if (v)
        {
          ControlFocus, FTCSkinButton11, ahk_id%id%
          Sleep, -1
          ControlClick, FTCSkinButton11, ahk_id%id%
        }
      }
    }
  }
  else
  {
    /*
    ControlGet, v, Visible, , FTCButton31, ahk_id%id%
    if (v)
    {
      ControlFocus, FTCButton31, ahk_id%id%
      Sleep, -1
      ControlClick, FTCButton31, ahk_id%id%
    }
    */
  }
}

CallFT(id)
{
  global FTP_Beta
  if (FTP_Beta)
  {
    ControlGet, v, Visible, , FTCSkinButton12, ahk_id%id%
    if (v)
    {
      ControlFocus, FTCSkinButton12, ahk_id%id%
      Sleep, -1
      ControlClick, FTCSkinButton12, ahk_id%id%
    }
  }
  /*
  else
  {
    ControlGet, v, Visible, , FTCButton11, ahk_id%id%
    if (v)
    {
      ControlFocus, FTCButton11, ahk_id%id%
      Sleep, -1
      ControlClick, FTCButton11, ahk_id%id%
    }
    else
    {
      ControlGet, v, Visible, , FTCButton11, ahk_id%id%
      if (v)
      {
        ControlFocus, FTCButton11, ahk_id%id%
        Sleep, -1
        ControlClick, FTCButton11, ahk_id%id%
      }
    }
  }
  */
}

RaiseFT(id)
{
  global FTP_Beta
  if (FTP_Beta)
  {
    ControlGet, v, Visible, , FTCSkinButton13, ahk_id%id%
    if (v)
    {
      ControlFocus, FTCSkinButton13, ahk_id%id%
      Sleep, -1
      ControlClick, FTCSkinButton13, ahk_id%id%
    }
  }
  /*
  else
  {
    ControlGet, v, Visible, , FTCButton13, ahk_id%id%
    if (v)
    {
      ControlFocus, FTCButton13, ahk_id%id%
      Sleep, -1
      ControlClick, FTCButton13, ahk_id%id%
    }
  }
  */
}


FoldParty(id)
{
  ControlGet, v, Visible, , AfxWnd42u22, ahk_id%id%
  if (v)
  {
    ControlFocus, AfxWnd42u22, ahk_id%id%
    Sleep, -1
    ControlClick, AfxWnd42u22, ahk_id%id%
  }
  else
  {
  ControlGet, v, Visible, , AfxWnd42u17, ahk_id%id%
    if (v)
    {
      ControlFocus, AfxWnd42u17, ahk_id%id%
      Sleep, -1
      ControlClick, AfxWnd42u17, ahk_id%id%
    }
  }
}

CallParty(id)
{
  ControlGet, v, Visible, , AfxWnd42u18, ahk_id%id%
  if (v)
  {
    ControlFocus, AfxWnd42u18, ahk_id%id%
    Sleep, -1
    ControlClick, AfxWnd42u18, ahk_id%id%
  }
}

RaiseParty(id)
{
  ControlGet, v, Visible, , AfxWnd42u19, ahk_id%id%
  if (v)
  {
    ControlFocus, AfxWnd42u19, ahk_id%id%
    Sleep, -1
    ControlClick, AfxWnd42u19, ahk_id%id%
  }
}

/*

ControlClick, AfxWnd42u19, ahk_id%id%
    } 
  }
  Else IfWinExist, ahk_id%id% ahk_group CryptoTables
  {
    ControlSetText, Edit3, %pot%, ahk_id%id%
    Sleep -1
    WinSet, Redraw,, ahk_id%id%
    If(autobet)
    {
      PostLeftClick(730, 540, id)
    } 
  }
  Else IfWinExist, ahk_id%id% ahk_group FullTiltTables
  {
    ControlGet, v, Visible, , Edit1, ahk_id%id%
    if (v)
    {
      ;Msgbox, %pot%
      if (pot > max)
      {
        pot := max
      }
      ControlSetText, Edit1, %pot%, ahk_id%id%
      Sleep -1
      ;WinSet, Redraw,, ahk_id%id%
      If(autobet)
      {
        ab := 0
        Loop, 20
        {
          ControlGetText, t, Edit1, ahk_id%id%
          if (t < pot || t > pot)
          {
            Sleep, 100
          }
          else
          {
            ;TrayTip, ,  %ab% %t% %pot%
            Sleep, 200
            ControlFocus, FTCButton11, ahk_id%id%
            Sleep, -1
            ControlClick, FTCButton11, ahk_id%id%
            ;ab := 1
            break
          }
        }
        ;TrayTip, ,  %ab% %t% %pot%
        ;if (ab)
        ;{
        ;  ControlFocus, FTCButton11, ahk_id%id%
        ;  Sleep, -1
        ;  ControlClick, FTCButton11, ahk_id%id%
        ;}
      }
    }
  }
  Else IfWinExist, ahk_id%id% ahk_group PrimaTables
  {
    ControlFocus, Edit1, ahk_id%id%
    ControlSetText, Edit1, %pot%, ahk_id%id%
    Sleep, -1
    WinSet, Redraw,, ahk_id%id%
    If(autobet)
    {
      WinActivate, ahk_id%id%
      WinWaitActive, ahk_id%id%, , 1
      If (errorlevel<>1)
      {
        Send, {ENTER}
      }   
    } 
  }
}

Last edited by _dave_; 05-14-2008 at 05:55 PM. Reason: code tags please
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 05:58 PM
Quote:
Originally Posted by udbrky
Neither work.
but they do postflop?

I am stumped... there is no sensible reason why either of those two should fail pre but work post.

Capture / post a screenshot of the debug info pop-up if you can, preflop and postflop please. Let us see if there is a difference.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 06:28 PM
Here's pre:



Here's post:

BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 06:32 PM
Those both show it sucessfully reading all the info (pot amount, call amount, blind values), and having the correct value in the bet-box... what do you get in the bet-box when it is not working?
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 06:47 PM
I get the default bet amount. It works, I just have to click numerous times.

When I click, I get gray boxes around the screen. They start at approximately where the river card is, then the turn, each of the flop cards, then another spot, then finally the pot amount up top, then it will go to the action spots.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 06:55 PM
OK, you should never need to click numerous times. Doing so will not help, I do not think. Once triggered, a hotkey will not be triggered again until it is complete.

The boxes are debug mode showing where on the table it is scanning.

Pkease try clicking once (with debug off) and see how long it takes to change the bet amount - scroll it to zero first so it is obvious.

EDIT: I still don't get it, because it *works perfectly* postflop?
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 07:24 PM
Quote:
Originally Posted by _dave_
OK, you should never need to click numerous times. Doing so will not help, I do not think. Once triggered, a hotkey will not be triggered again until it is complete.

The boxes are debug mode showing where on the table it is scanning.

Pkease try clicking once (with debug off) and see how long it takes to change the bet amount - scroll it to zero first so it is obvious.

EDIT: I still don't get it, because it *works perfectly* postflop?
The time bank activates, I'd say maybe 12 seconds.

I just counted, it is about 12 seconds pre and post. It's at least working now. Or maybe I just wasn't waiting long enough.

This is with debug off.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 07:31 PM
OK.. getting somewhere.

Do you run SnoopFree (or a similar "security-type" application)?

bleh, it can't be that.. or postflop would be slow too - I really have no idea why this is happening
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 07:36 PM
I do run snoop free. It's been slow postflop the last few runs. At first it was going instantly postflop.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 07:42 PM
Quote:
Originally Posted by udbrky
I do run snoop free. It's been slow postflop the last few runs. At first it was going instantly postflop.
It is snoopfree. It makes the OCR stupid slow - I guess something was stopping it from working properly on those occasions BetPot worked fast postflop. Which is a little worrying.

There is nothing can be done but uninstall snoopfree at this time (and it must be uninstalled, not just disabled) - one day I'll rewrite Stars/BetPot code so it should be faster - but Stars tends to lock up with any other techniques I have tried over the past year or two

I do have another technique that may work I learnt a few days ago, fingers crossed.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 07:44 PM
Ok, thanks. I guess all this time I thought it wasn't working, it was just going slow.

So, now I decide which one I want to run, eh? Thanks for your help Dave.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-14-2008 , 08:13 PM
dave can you help me out? sent you a pm a few days ago. i can send you $10 on stars.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 02:24 AM
Quote:
Originally Posted by sputnik365
somelocation\FreePHG\FreePHG.ini
OUTPUT_LIVE = 1
hey dont quite get this?? can you expand a little?
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 04:15 AM
Dave, if you could get bet pot script to make correct calculations on all streets @ Prima, I´ll ship you $10. And I think other Prima players would to.

Also, if you could implement a Raise(id) (RaisePrima(id)) function, a Fold(id) (FoldPrima(id)) function and a Call(id) (CallPrima(id)) function for use of keyboard bet, raise and fold @ Prima, I´ll ship you an additional $20.

If you feel that the $$ amount is to low for the job at hand, I´ll pay you more.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 06:56 AM
Quote:
Originally Posted by dscotch
hey dont quite get this?? can you expand a little?
the folder where you installed FPHG has a file called FreePHG.ini
It has a line OUTPUT_LIVE = 0 or 1
open with notepad, it needs to be 1 with the spaces round the =

By default FPHG creates a folder C:\FreePHG_HandHistories\live where it writes partial HHs which betpot needs.
So check that OUTPUT_LIVE = 1 and that the live folder is being written to.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 08:44 AM
Quote:
Originally Posted by PoPr
Dave, if you could get bet pot script to make correct calculations on all streets @ Prima, I´ll ship you $10. And I think other Prima players would to.

Also, if you could implement a Raise(id) (RaisePrima(id)) function, a Fold(id) (FoldPrima(id)) function and a Call(id) (CallPrima(id)) function for use of keyboard bet, raise and fold @ Prima, I´ll ship you an additional $20.

If you feel that the $$ amount is to low for the job at hand, I´ll pay you more.
I'd pay for it too I love your script, please fix it for Prima.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 10:00 AM
Hi,

I'm using the BetPot iPoker Test2 and I have changed the amount of tabs, but when I use the script it just highlights the bet amount and doesn't change it Any thoughts ?
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 02:22 PM
Ok so whats the latest working version for ipoker?
The one I have, I think its some modified beta, works all right but its kinda wired and screwed up in random places postflop and when 3betting preflop.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 02:34 PM
the modified betas are about as good as I can do until Noble *eventually* update their software... until they do that I am purely guesing, and won't get anything approaching perfect.

Once I have access to the new iPoker software however, it shouldn't be a problem at all, and I'll have a decent version within a day...

I keep contemplating making an account on one of the "updated" skins, but I figure Noble has to update at some point... what is so special about carlospoker? I see many playing ther (and it has the new software) but their website doesn't look like it is a particularly good iPoker deal... am I missing something here?
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 02:59 PM
Yes, you are missing about half of the best part.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 03:08 PM
I think I understand, will do some research
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 06:58 PM
I have no clue how to get this to work I downloaded Auto hot key and downloaded the Bet Pot AHK but can't get them to work. Could someone please help me with this.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 09:11 PM
Install AutoHotkey - you do not need to 'run' it, it just has to be installed.

Extract contents of betpot zip to a new folder - I have a folder called AHK on my D partition.

Then double-click BetPot-v0.2s.ahk and you should see one (and only one) 'Green H' Icon in the system tray, to show that it is running.

Middle Mouse click and Right Click are the 2 most used hotkeys for betting. You can see all the hotkeys by going to: betpot_default_hotkeys.ahk and Right Click > Edit Script.
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote
05-15-2008 , 09:54 PM
Thank you fozzy, btw for those free card mods you made on psthemes.com
BetPot AHK (Stars/Party/iPoker/FTP/Crypto/Prima) Quote

      
m