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

Party Bet Pot

*************************

IMPORTANT: THIS SCRIPT IS NOW OBSOLETE, IT DOES NOT WORK. use BetPot (new version of this script) instead.

*************************

This script creates a customizable "bet-pot" button for Party / Empire Poker.

Read through it and try to understand what it will do.

By default, the Hotkeys set up will be:

Wheel Up: +1BB to bet amount

Wheel Down: -1BB to bet amount

Ctrl + Wheel Up: +10BB to bet amount

Ctrl + Wheel Down: -5BB to bet amount

Shift + Wheel Up: + 1/4 Pot to bet amount

Shift + Wheel Down: - 1/4 Pot to bet amount

Middle (Wheel) Click: Bet full pot, -rake, 4xBB+1/limper if opening preflop.

Right Click: Bet 3/4 pot, -rake, rounded to neareat multiple of SB.

Ctrl + Alt + Middle (Wheel) Click: PUSH (9999x pot)

Version 0.5 changes:

I have been messing with these alterations to the script for a little while now - the Party / Empire update today prompted me fix the changes they made (Edit2 -> Edit3) and to check everything worked OK in this new version, here it is.

** Some fixes to the Pot() Function - Was incorrectly adding on too much $$ when in a blind - I think this is sorted now. Also updated to cope with Party / Empire changes today. Added a new option (-1) to the auto_bet parameter - This makes it NOT fill in the bet amount anywhere, just calculate & return it, so the Pot() function can be called from others now, e.g. the Wheel Up/Down code can now use pot-sizes if desired.

** Tidied up the wheel up/down code, for several reasons. The original code base was from Roland's fine TableNavigator script, and was designed to work on several sites - since this is a Party / Empire only script, much of the wheel code was not really needed - I also wanted to add some useful features. Firstly I changed it so that repeated downward scrolling will always get to zero.

Wheel Up/Down should now correctly work on the beginner ($0.02/$0.04 NL) tables.

New parameters for wheel up/down function SetText: 3: frac - Default 1 - allows you to specify a fraction or multiple to scroll bet amounts with. 4: unit - Default 1BB - you can specify anything here, eg "sb", or 5, or a Pot() function call - see my hotkey setup for some examples.

Version 0.6 changes:

Updated to now work with SNGs & Multi-Table Tourneys in addition to NL cash games.

Default hotkey assignments now changed - does not auto-bet now by default (safer for testing).

Enjoy!

dave.

Code - Version 0.6

;;;;;;;;;;;;;;;;;  CODE STARTS HERE

;___ FOR Auto Hotkey n00bs:
;___ Any line that contains a ";" - this is the symbol for "comment"
;___ Anything following the ";", until the next line, is not processed.
;___ These lines are comments, for example - as are all the Msgbox
;___ commands present in this script. You can uncomment the Msgbox lines
;___ if you are altering the script and want to see what values are at
;___ that point of the function.
;___
;___ Enjoy!,
;___
;___ _dave_

#NoEnv 
SendMode Input



SetTitleMatchMode 2
GroupAdd, tables, Good Luck,,, : Poker Lobby

;___ Change below to change how the table to act upon is detected.
;___ Default is 0 - table under cursor - set to 1 so that the
;___ active window recieves the commands - try changing this if  
;___ you have problems with the bet-pot / wheel not working at all.

act_only_on_active_table :=0

return
;___  END AUTO EXECUTE SECTION



;____ SET HOTKEY BUTTONS BELOW

~WheelUp::    ;_______ Increase bet by 1 BB
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    SetText(id,"up")
    Sleep -1
  }
return

~WheelDown::  ;_______ Decrease bet by 1 BB
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    SetText(id,"down")
    Sleep -1
  }
return

~^WheelUp::    ;_______ CTRL & WheelUp - Increase bet by 10 BB
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    SetText(id,"up",10)
    Sleep -1
  }
return

~^WheelDown::  ;_______ CTRL & WheelDown - Decrease bet by 5 BB
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    SetText(id,"down",5)
    Sleep -1
  }
return

~+WheelUp::    ;_______ Shift & WheelUp - Increase bet by 1/4 pot
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    SetText(id,"up",1/4, Pot(id,1,2,-1,1,0))
    Sleep -1
  }
return

~+WheelDown::  ;___  Shift & WheelDown - Decrease bet by 1/4 pot
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    SetText(id,"down",1/4, Pot(id,1,2,-1,1,0))
    Sleep -1
  }
return


~RButton::    ;___  Bet 3/4 pot, round to SB, no autobet, deduct rake.
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    Pot(id, 3/4, "smallblind", 0, 1)
  }
return


~MButton::    ;___  Bet full pot, round to 2dp, no autobet, deduct rake, use 4xBB+1/limper
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    Pot(id, 1, 2, 0, 0, "ssnl")
  }
return

~^!MButton::    ;__  CTRL & ALT & Middle click - Auto-Bet ALL-IN!!!  9999x the pot should enough :)
  id := getid()
  IfWinExist, ahk_id%id% ahk_group tables
  {
    Pot(id, 9999, 2, 0)
  }
return

;SPACE::
;Msgbox %tables%
;return

;___  END HOTKEY DEFENITIONS



;___          ____POT FUNCTION INSTRUCTIONS____
;___
;___ Function:    Pot(id, frac=1, round_bet=2, auto_bet=0, deduct_rake=1, open_adjust=0)
;
;___ The Pot() function takes up to 6 paremeters.
;___ The first paremeter is Required, the rest are optional (may be omitted)
;___ You do however need to specify optional paremeters if you wish to
;___ set a value for a later paremeter.
;___
;___ These paremeters are as follows:
;___
;___ 1. id - unique ID# of the table to act on - retrieved via getid() function
;___         in this script
;___
;___ 2. frac - Amount of pot to bet, can be fraction or decimal notation
;___           eg 1 = full-pot, 3/4 or 0.75 = 3/4 pot, and so on.
;___           DEFAULT is 1 (full pot)
;___
;___ 3. round_bet - Decimal places to round to. Specify 0 to always bet whole
;___                Dollars. Specify 1 to round to the nearest 10c.
;___                DEFAULT is 2 (two decimal places, eg $3.43)
;___                SPECIAL OPTIONS: specify "smallblind" or "bigblind"
;___                (with quotes) to round to multiple of the current SB / BB
;___ 
;___ 4. auto_bet - Set to 1 to auto-hit the bet/raise button - useful if you
;___               are confident in the size of bets this script makes...
;___               Set to -1 to not set anything, just calculate then return
;___               the pot-size - useful if using Pot() within other functions,
;___               such as the wheel up/down SetText() function :)
;___               DEFAULT is 0 - do not auto-bet (just fill in the textbox)
;___ 
;___ 5. deduct rake - takes account of rake during potsize calculations.
;___                  capped by the max_rake variable inside the pot() function.
;___                  DEFAULT is 0 - no rake adjustment. Set to 1 to enable this,
;___                  and take a look at max_rake, set as appropriate (default $3)
;___                  
;___ 6. open_adjust - allows an ovverride of the pot-sized bet should action be 
;___                  pre-flop, and no one has raised - limpers are ignored.
;___                  this allows for players to set a preferred adjustment
;___                  in $ to apply when they are the opener.
;___                  DEFAULT is 0 - no adjustment.  
;___                  SPECIAL OPTIONS: specify "ssnl" (with quotes) to adjust an
;___                  openraise by 4xBB + 1 / limper - standard SSNL guidelines
;___ 
;___ 


;___          ____SetText FUNCTION INSTRUCTIONS____
;___
;___ Function:    SetText(id, dir, frac=1, unit="")
;___
;___ The Pot() function takes up to 6 paremeters.
;___ The first paremeter is Required, the rest are optional (may be omitted)
;___ You do however need to specify optional paremeters if you wish to
;___ set a value for a later paremeter.
;___
;___ These paremeters are as follows:
;___
;___ 1. id - unique ID# of the table to act on - retrieved via getid() function
;___         in this script
;___
;___ 2. frac - Amount of pot to bet, can be fraction or decimal notation
;___           eg 1 = full-pot, 3/4 or 0.75 = 3/4 pot, and so on.
;___           DEFAULT is 1 (full pot)
;___
;___ 3. round_bet - Decimal places to round to. Specify 0 to always bet whole
;___                Dollars. Specify 1 to round to the nearest 10c.
;___                DEFAULT is 2 (two decimal places, eg $3.43)
;___                SPECIAL OPTIONS: specify "smallblind" or "bigblind"
;___                (with quotes) to round to multiple of the current SB / BB
;___ 
;___ 4. auto_bet - Set to 1 to auto-hit the bet/raise button - useful if you
;___               are confident in the size of bets this script makes...
;___               Set to -1 to not set anything, just calculate then return
;___               the pot-size - useful if using Pot() within other functions,
;___               such as the wheel up/down SetText() function :)
;___               DEFAULT is 0 - do not auto-bet (just fill in the textbox)
;___ 



;____ FUNCTIONS BELOW - DO NOT EDIT (unless you want to change behaviour)


;____ this function returns the size of the pot
;____ with rake (optionally) subtracted
;____ and pot fraction as an (optional) argument

Pot(id, frac=1, round_bet=2, auto_bet=0, deduct_rake=1, open_adjust=0 )
{
  
  WinGetTitle, title, ahk_id%id%
  
  ;Msgbox %round_bet%
  nl_actions = calls [,raises [,bets [,all-In  [,posts ante [,posts small blind [,posts big blind [, posts big blind + dead [
  
  pot := 0
  notraked := 0
  maxrake := 3
  preflop_openraise := 1
  hero_bet := 0
  bb := 0
  sb := 0
  tourney := 0
  
  ;______ Get hero's screen name from the window title
  StringMid, hero, title, InStr(title, "Luck ") + 5
  StringMid, hero, hero, InStr(hero, "!")-2,, L
  ;Msgbox %hero%
  
  

  targetStr := "No player chat"
  ControlGet, currStr, Choice,, Combobox1, ahk_id%id%
  If currStr <> %targetStr%
  {
    Control, ChooseString, %targetStr%, Combobox1, ahk_id%id%
    Loop
    {
      ControlGetText, hh, RICHEDIT1, ahk_id%id%
      If hh
      {
        break
      }
    }
    Control, ChooseString, %currStr%, Combobox1, ahk_id%id%
  }
  else
  {
    ControlGetText, hh, RICHEDIT1, ahk_id%id%
  }
  
  StringTrimLeft, hh, hh, InStr(hh, "starts.", true, 0)
  ;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, $
      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
      }
      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
      }
      Else If(open_adjust <> 0 AND preflop_openraise = 1 AND InStr(a_loopfield, "raises [", true, 0))
      {
        preflop_openraise := 0
        ;Msgbox "Pre flop Raise"
      }
      Else If(open_adjust <> 0 AND preflop_openraise = 1 AND InStr(a_loopfield, "all-In  [", true, 0))
      {
        preflop_openraise := 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
  If InStr(hh2, "** Dealing River **")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "** Dealing River **", true, 0)
    preflop_openraise := 0
  }
  Else If InStr(hh2, "** Dealing Turn **")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "** Dealing Turn **", true, 0)
    preflop_openraise := 0
  }
  Else If InStr(hh2, "** Dealing Flop **")
  {
    StringTrimLeft, hh2, hh2, InStr(hh, "** Dealing Flop **", true, 0)
    preflop_openraise := 0
  }

  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, $
        hero_bet += amount
      }
    }
  }
  ;Msgbox %hero_bet%
  ;Msgbox %deduct_rake%
  ;msgbox, %tourney%
  
  
  ;Msgbox %pot%
  
  
  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, $
          notraked += amount
        }
      }

      rake := Floor(pot - notraked) * 0.05
      If rake > %maxrake%
      {
        rake := maxrake
      }
      ;msgbox, rake = %rake%
      If (tourney <> 1)
      {
        pot := pot - rake
      }
    }
  }
  
  ;Msgbox %pot% 
  
  If (tourney = 1)
  {
    pot := pot + sb + bb
  }
  ;MsgBox %pot%
  ;Msgbox hero contributions - $%hero_bet%
  
  
  If(preflop_openraise = 1 AND open_adjust = "ssnl") 
  {
    ;Msgbox, "Adjusting PFR to SSNL style 4bb+1/limper" 
    pot := pot + bb - sb
    ;msgbox adjust %bb% - %sb%
  }
  Else If(preflop_openraise = 1 AND open_adjust <> 0)  
  {
    ;Msgbox, Adjusting PFR by $%open_adjust%
    pot := pot + open_adjust
  }
  
  
  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
  If call <>
  {
    ;Msgbox to call - $%call%
    pot := ((pot + call + hero_bet)*frac )+ call ;+ hero_bet
  }
  else
  {
    pot := ((pot + hero_bet)*frac) ;+ hero_bet
  }
  ;Msgbox %pot%
  
  If(round_bet = "smallblind")
  {
    ;Msgbox "Rounding to SMALL blind"
    pot := Floor(pot / sb) * sb
  }
  Else If(round_bet = "bigblind")
  {
    ;Msgbox "Rounding to BIG blind"
    pot := Floor(pot / bb) * bb
  }
  Else
  {
    ;Msgbox Rounding to %round_bet% decimal places
    pot := Round(pot, round_bet)
  }
  ;msgbox, %pot%
  If (auto_bet > -1)
  {  
    ControlSetText, Edit3, %pot%, ahk_id%id%
    Sleep -1
    ;ControlFocus, Edit3
    ;WinActivate, ahk_id%id%
    ;Sleep, -1
    ;Send {ENTER}
    Sleep, 50
    Controlsend, Edit3, {ENTER}, ahk_id%id%
  
  }
  If(auto_bet = 1)
  {
    
    ControlClick, AfxWnd4219, ahk_id%id%
  } 
  
  ;Msgbox %pot%
  return pot
}
 






SetText(id, dir, frac=1, unit="")
{
  WinGetTitle, title, ahk_id%id%

  If (InStr(title, "NL  Hold'em - $") <> 0 AND InStr(title, "Buy-in") = 0) ;___if "NL" is in the title but "Buy-in" isn't...
  {
    StringMid, buyin, title, InStr(title, "$")+1, (InStr(title, ".") - InStr(title,"$") - 0)
    ;Msgbox, %bb%
    bb := buyin / 100
    
  }
  else if (InStr(title, "NL")) 
  {
    ControlGetText, text, Static6, %title%
    ;msgbox, %text%
    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
    ;msgbox, %bb%
  }
  Else
  {
    return
  }
  
  sb := bb / 2
  

  If(bb = 0.25) ;___this is for .10/.25 (unusual small SB)
  {
    sb := 0.1
  }
  Else If(bb = 0.05) ;___this is for .02/.04 (beginner's game plays 125bb deep???)
  {
    bb := 0.04
    sb := 0.02
  }

  If (unit = "" or unit = "bb")
  {
    unit := bb
  }
  Else If (unit = = "sb")
  {
    unit := sb
  }
  
  amount := unit * frac
  
  ;Msgbox, %amount%

  ControlGetText, t, Edit3, ahk_id%id% 


  If(dir = "up")
  {
    t := t + amount
  }
  Else If (dir = "down")
   {
    t := t - amount
  }
  If (t < 0)
  {
    t := 0
  }
  If(t >= 0)
  {
    t := Round(t, 3)
    ControlSetText, Edit3, %t%, ahk_id%id%
    Sleep, 50
    Controlsend, Edit3, {ENTER}, ahk_id%id%
  }
}



;___ This function is used to select method of table detection
getid()
{
  global act_only_on_active_table
  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
}
  


;;;;;;;;;;;;;;;;;  CODE ENDS HERE

CategoryAutoHotKey

PartyBetPot (last edited 2007-03-22 02:14:46 by 85-210-21-153)