I have this script, its from the PotOddsHUD NG but it wont detect the site. Any idea of how to make it work?
HTML Code:
; PotOddsHUD NG
; date: August 26, 2007
; AHK version: 1.0.47.03
; author: Chris
#NoEnv
#SingleInstance force
#Include %a_scriptDir%
SetWorkingDir %a_scriptDir%
OnExit exitSub
version:="0.91"
SetBatchLines, -1
SetWinDelay, -1
SetMouseDelay, -1
SendMode, Input
CoordMode, Pixel, Screen
DetectHiddenText, Off
SetTitleMatchMode, 2
;;;;;;;;;;;;;;;;;;;;;;;;;; Autoexec ;;;;;;;;;;;;;;;;;;;;;;;;;;
settings()
trayMenu()
buildGui()
TableRefreshTime:=5333
HUDRefreshTime:=500
RemovePopUpTime:=10000
lobby:=lobby()
if ! ( lobby = 0) {
GuiControl, 1:,recSite, %site%
if ( AutoOn = 1 ) {
Gosub, ButtonOn
}
}
return
;;;;;;;;;;;;;;;;;;;;;;;;;; GUI ;;;;;;;;;;;;;;;;;;;;;;;;;;
settings() {
global
ini:="settings.ini"
iniRead, AutoOn, %ini%, Prefs, AutoOn, 0
}
trayMenu() {
global
Menu, Tray, Icon, podng.ico
Menu, Tray, noStandard
Menu, Tray, Add, &Show, Show
Menu, Tray, default, &Show
Menu, Tray, Add
Menu, Tray, Add, &About, About
Menu, Tray, Add, &Help, Help
Menu, Tray, Add
Menu, Tray, Add, E&xit, Exit
Menu, Tray, Tip, PodOddsHUD NG v%version%
}
buildGui() {
global
Gui 1:Default
Gui, +toolwindow
Gui, Margin, 5, 5
Gui, Font,, Verdena
Gui, Add, Text, section, Site:
Gui, Add, Text, vrecSite w60 xp+25, not found
Gui, Add, Button, vOn xs h20 section w55 center, &On
Gui, Add, Button, vOff h20 disabled w55 xp xp+55 center, &Off
Gui, Add, Button, vConfigHUD h20 center w110 section xs ys+23, &Config HUD
Gui, Add, Button, vTableScan h20 center w110 section xs ys+23 disabled, &TableScan Off
Gui, Add, Checkbox, checked%AutoOn% vAutoOn xs+2, &Auto on
if ( site = "Party" )
Gui, Add, Checkbox, checked%usdec% vUSdec gSubmit xs+2, &dot as dec. place
if ( site = "iPoker" ) {
Gui, Add, Checkbox, checked%ButtonsOnLeft% vButtonsOnLeft gSubmit xs+2, &ButtonsOnLeft
Gui, Add, Checkbox, checked%LimitTourney% vLimitTourney gSubmit xs+2, &Limit Tourney
}
IniRead, x, % ini, Gui, x, center
IniRead, y, % ini, Gui, y, center
Gui, Show, x%x% y%y% w120, PodOddsHUD NG
}
;;;;;;;;;;;;;;;;;;;;;;;;;; Buttons ;;;;;;;;;;;;;;;;;;;;;;;;;;
ButtonOn:
lobby:=0
lobby:=lobby()
if ! ( lobby = 0) {
lastnum:=0
lasttables:=0
HUDSettings(site)
Gosub, RefreshTables
SetTimer, RefreshTables, % TableRefreshTime
GuiControl, 1:Enable, Off
GuiControl, 1:Enable, TableScan
GuiControl, 1:Disable, On
GuiControl, 1:Disable, ConfigHUD
GuiControl, 1:,recSite, %site%
}
else
msgbox, 0, PodOddsHUD NG, No poker client found., 60
return
ButtonOff:
pressed:=0
SetTimer, RefreshHUD, Off
SetTimer, RefreshTables, Off
RemoveHUD()
RemovePopUp()
GuiControl, 1:Enable, On
GuiControl, 1:Enable, ConfigHUD
GuiControl, 1:Disable, Off
GuiControl, 1:Disable, TableScan
GuiControl,, tablescan, &TableScan Off
return
ButtonConfigHUD:
Run, %a_scriptDir%\confighud.ahk, %a_scriptDir%
Gosub, exitSub
return
ButtonTableScanOff:
if ! ( pressed = 1 ) {
SetTimer, RefreshTables, off
GuiControl,, tablescan, &TableScan On
pressed:=1
}
else {
SetTimer, RefreshTables, % TableRefreshTime
GuiControl,, tablescan, &TableScan Off
pressed:=0
}
return
;;;;;;;;;;;;;;;;;;;;;;;;;; Subs ;;;;;;;;;;;;;;;;;;;;;;;;;;
Show:
Gui, 1:Show
return
Help:
Run % web() "http://www.overcards.com/wiki/moin.cgi/PodOddsHUD_NG"
return
About:
Msgbox,, PodOddsHUD NG, PodOddsHUD NG v%version% `nAuthor: Chris`nE-Mail: [email]chris228@gmx.de[/email]`n`nIf you like my program I would be happy`nabout a donation. My screenname on `nPokerStars is 'mr.cray'.`nThank you!
return
Exit:
exitApp
GuiClose:
Gui 1:Cancel
return
exitSub:
Gui 1:Default
Gui, Submit
Gui +lastfound
WinGetPos, x, y
IniWrite, % x, % ini, Gui, x
IniWrite, % y, % ini, Gui, y
IniWrite, % AutoOn, % ini, Prefs, AutoOn
if ( site = "Party" ) {
IniWrite, % USdec, % ini, Prefs, USdec
}
if ( site = "iPoker" ) {
IniWrite, % ButtonsOnLeft, % ini, Prefs, ButtonsOnLeft
IniWrite, % LimitTourney, % ini, Prefs, LimitTourney
}
exitApp
RefreshTables:
tables:=tables(lobby, site)
if ! ( tables = lasttables ) {
SetTimer, RefreshHUD, Off
RemoveHUD()
Gosub, RefreshHUD
SetTimer, RefreshHUD, % HUDRefreshTime
lasttables:=tables
}
return
RefreshHUD:
CreateHUD(tables, site)
return
Submit:
Gui, 1:Submit, NoHide
if ( site = "iPoker")
ButtonOffset:=-18*ButtonsOnLeft
return
RefreshPopup:
CreatePopUp(site)
SetTimer, RemovePopUp, -%RemovePopUpTime%
return
RemovePopUp:
RemovePopUp()
return
;;;;;;;;;;;;;;;;;;;;;;;;;; HUD ;;;;;;;;;;;;;;;;;;;;;;;;;;
CreateHUD(tables, site) {
global lastnum, xr, yr, xr_mini, yr_mini, font, fsize, fcolor, bgcolor, trans, showpot, showodds, showperc, showouts, hudwidth, hudheight, usdec, TableSize
Loop, Parse, tables, `,
{
WinGetPos, x, y,, h, ahk_id%a_loopfield%
if ( site = "Ongame" ) {
WinGetText, wintext, ahk_id%a_loopfield%
pot:=get$_Ongame(wintext, "Pot: ")
bet:=get$_Ongame(wintext, "Bet: ")
}
if ( site = "Party" ) {
WinGetText, wintext, ahk_id%a_loopfield%
pot:=get$_Party(wintext, " Pot:", usdec)
bet:=getBet_Party(wintext, "Call ", usdec)
}
if ( site = "iPoker" ) {
TableSize:=GetTableSize(a_loopfield)
pot:=Pot_iPoker()
bet:=Bet_iPoker()
}
if ( h <= 392 ) {
xHUD:=x+xr_mini
yHUD:=y+yr_mini
}
else {
xHUD:=x+xr
yHUD:=y+yr
}
if ( lastnum > 20 ) {
num1:=a_index+1
num2:=a_index+21
}
else {
num1:=a_index+21
num2:=a_index+1
}
odds:=Round(pot/bet, 2)
if ( odds = 0.00 )
odds=oo
Gui %num1%:Default
Gui, Color, %bgcolor%
Gui +AlwaysOnTop +ToolWindow +Lastfound -Caption
Gui, Margin, 1, 1
Gui, font, s%fsize% c%fcolor%, %font%
if ( showpot = 1 ) {
if ( pot <= 100)
pot:=Round(pot, 2)
if ( pot > 100 )
pot:=Round(pot, 1)
if ( pot > 1000 )
pot:=Round(pot, 0)
Gui, Add, Text, gRefreshPopUp yp+%hh% center w%hudwidth%, %pot% $
hh:=hudheight
}
if ( showodds = 1 ) {
Gui, Add, Text, gRefreshPopUp yp+%hh% center w%hudwidth%, %odds%:1
hh:=hudheight
}
if ( showperc = 1 ) {
perc:=Round(100/(odds+1), 1)
Gui, Add, Text, gRefreshPopUp yp+%hh% center w%hudwidth%, %perc%`%
hh:=hudheight
}
if ( showouts = 1 ) {
outs:=Round(46.5/(odds+1), 1)
Gui, Add, Text, gRefreshPopUp yp+%hh% center w%hudwidth%, %outs%
hh:=hudheight
}
if ( trans = 1 )
WinSet, TransColor, %bgcolor%
Gui, Show, x%xHUD% y%yHUD% NoActivate, %pot%_%bet%-%a_loopfield%
Gui, %num2%:destroy
hh:=0
}
lastnum:=num1
}
RemoveHUD() {
loop 50 {
num:=a_index+1
Gui, %num%:destroy
}
}
HUDSettings(site) {
global
iniRead, ShowPot, %ini%, HUD-%site%, ShowPot, 0
iniRead, ShowOdds, %ini%, HUD-%site%, ShowOdds, 1
iniRead, ShowPerc, %ini%, HUD-%site%, ShowPerc, 1
iniRead, ShowOuts, %ini%, HUD-%site%, ShowOuts, 0
iniRead, xr, %ini%, HUD-%site%, xr, -1
iniRead, yr, %ini%, HUD-%site%, yr, 0
iniRead, xr_mini, %ini%, HUD-%site%, xr_mini, -1
iniRead, yr_mini, %ini%, HUD-%site%, yr_mini, 0
iniRead, font, %ini%, HUD-%site%, font, Verdena
iniRead, fsize, %ini%, HUD-%site%, fsize, 8
iniRead, fcolor, %ini%, HUD-%site%, fcolor, ffffff
iniRead, bgcolor, %ini%, HUD-%site%, bgcolor, 000000
iniRead, trans, %ini%, HUD-%site%, trans, 0
hudwidth:=5*fsize
hudheight:=5+(1.1*fsize)
if ( site = "Ongame" )
if ( xr = -1 ) {
xr:=549
yr:=246
}
if ( xr_mini = -1 ) {
xr_mini:=350
yr_mini:=156
}
if ( site = "Party" )
if ( xr = -1 ) {
xr:=548
yr:=214
}
if ( xr_mini = -1 ) {
xr_mini:=334
yr_mini:=148
}
if ( site = "iPoker" ) {
if ( xr = -1 ) {
xr:=535
yr:=223
}
if ( xr_mini = -1 ) {
xr_mini:=334
yr_mini:=148
}
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;; Popup ;;;;;;;;;;;;;;;;;;;;;;;;;;;
CreatePopUP(site) {
global hudwidth
MouseGetPos,,, id
WinGetTitle, hudtitle, ahk_id %id%
WinGetPos, xh, yh, wh,, ahk_id %id%
StringLen, len, hudtitle
pos1:=InStr(hudtitle, "_")
pos2:=InStr(hudtitle, "-")
StringLeft, pot, hudtitle, pos1-1
StringRight, tableid, hudtitle, len-pos2
bet:=SubStr(hudtitle, pos1+1, pos2-pos1-1)
SysGet, MonitorWorkArea, MonitorWorkArea, 1
WinGetTitle, tabletitle, ahk_id%tableid%
if ( site = "Ongame" ) {
gametype:=GameType_Ongame(tabletitle)
}
if ( site = "Party" ) {
gametype:=GameType_Party(tabletitle)
}
if ( site = "iPoker" ) {
gametype:=GameType_iPoker(tabletitle)
if ( gametype = "Tourney" )
if (LimitTourney = 1 )
gametype=Limit tourney
else
gametype=NL tourney
}
pw0:=3
pw1:=hudwidth+8
pw2:=hudwidth
pw3:=hudwidth
pw4:=hudwidth-12
hh:=0
wpopup:=pw1+pw2+pw3+pw4+pw0+pw0+1
xPop:=xh+hudwidth+3
yPop:=yh
if ( xPop+wpopup > MonitorWorkAreaRight )
xPop:=xh-wpopup-2
if ( gametype = "NL tourney" || gametype = "NL cash" )
NLPopup(bet, pot, site, pw0, pw1, pw2, pw3, pw4, hh, xpop, ypop)
if ( gametype = "PL tourney" || gametype = "PL cash" )
NLPopup(bet, pot, site, pw0, pw1, pw2, pw3, pw4, hh, xpop, ypop)
if ( gametype = "Limit tourney" || gametype = "Limit cash" )
LimitPopup(bet, pot, site, tabletitle, tableid, gametype, pw0, pw1, pw2, pw3, pw4, hh, xpop, ypop)
}
NLPopup(bet, pot, site, pw0, pw1, pw2, pw3, pw4, hh, xpop, ypop) {
global font, fsize, fcolor, bgcolor, hudheight
Gui 99:Default
Gui, destroy
Gui, Color, %bgcolor%
Gui +AlwaysOnTop +ToolWindow +Lastfound -Caption
Gui, Margin, 1, 1
Gui, font, s%fsize% c%fcolor%, %font%
loop {
if ( a_index = 1 ) {
x=1/3
xx=0.33
}
if ( a_index = 2 ) {
x=1/2
xx=0.50
}
if ( a_index = 3 ) {
x=2/3
xx=0.66
}
if ( a_index = 4 ) {
x=3/3
xx=1.00
}
if ( a_index = 5 ) {
x=4/3
xx=1.33
}
if ( a_index = 6 ) {
x=3/2
xx=1.50
}
odds:=round(((pot+bet)*(1+xx)/bet)-1, 2)
if ( odds = 0.00 )
odds=oo
Gui, Add, Text, gRemovePopUp section xs yp+%hh% center, +%x% Pot:
Gui, Add, Text, gRemovePopUp xp+%pw1% w%pw2% center, %odds%:1
perc:=Round(100/(odds+1), 1)
Gui, Add, Text, gRemovePopUp xp+%pw2%+1 w%pw0% center, |
Gui, Add, Text, gRemovePopUp xp+3 w%pw3% center, %perc% `%
outs:=Round(46.5/(odds+1), 1)
Gui, Add, Text, gRemovePopUp xp+%pw3%+1 w%pw0% center, |
Gui, Add, Text, gRemovePopUp xp+3 w%pw4% center, %outs%
hh:=hudheight
if ( a_index = 6 )
break
}
Gui, Show, x%xPop% y%yPop% NoActivate, PopUp
}
LimitPopup(bet, pot, site, tabletitle, tableid, gametype, pw0, pw1, pw2, pw3, pw4, hh, xpop, ypop) {
global font, fsize, fcolor, bgcolor, hudwidth, hudheight, usdec
if ( site = "Ongame" ) {
BB:=GetBB_Ongame(tabletitle, gametype)
}
if ( site = "Party" ) {
BB:=GetBB_Party(tableid, tabletitle, gametype, usdec)
}
if ( site = "iPoker" ) {
BB:=GetBB_ipoker(tabletitle, gametype)
}
pw1:=hudwidth+4
Gui 99:Default
Gui, destroy
Gui, Color, %bgcolor%
Gui +AlwaysOnTop +ToolWindow +Lastfound -Caption
Gui, Margin, 1, 1
Gui, font, s%fsize% c%fcolor%, %font%
loop {
x:=round(a_index/2, 1)
odds:=round((pot+x*BB)/bet, 2)
if ( odds = 0.00 )
odds=Infi.
Gui, Add, Text, gRemovePopUp section xs yp+%hh% center, +%x% BB:
Gui, Add, Text, gRemovePopUp xp+%pw1% w%pw2% center, %odds%:1
perc:=Round(100/(odds+1), 1)
Gui, Add, Text, gRemovePopUp xp+%pw2%+1 w%pw0% center, |
Gui, Add, Text, gRemovePopUp xp+3 w%pw3% center, %perc% `%
outs:=Round(46.5/(odds+1), 1)
Gui, Add, Text, gRemovePopUp xp+%pw3%+1 w%pw0% center, |
Gui, Add, Text, gRemovePopUp xp+3 w%pw4% center, %outs%
hh:=hudheight
if ( a_index = 6 )
break
}
Gui, Show, x%xPop% y%yPop% NoActivate, PopUp
}
RemovePopUp() {
Gui,99:destroy
}
;;;;;;;;;;;;;;;;;;;;;;;;;; Lobby & Tables ;;;;;;;;;;;;;;;;;;;;;;;;;;
Lobby() {
global site
lobby:=lobby_Ongame()
if ! ( lobby = 0) {
site=Ongame
return lobby
}
lobby:=lobby_Party()
if ! ( lobby = 0) {
site=Party
Party_Settings()
Gui 1:Default
Gui +lastfound
WinGetPos, x, y
IniWrite, % x, % ini, Gui, x
IniWrite, % y, % ini, Gui, y
Gui, destroy
buildGUi()
return lobby
}
lobby:=lobby_iPoker()
if ! ( lobby = 0) {
site=iPoker
iPoker_Settings()
Gui 1:Default
Gui +lastfound
WinGetPos, x, y
IniWrite, % x, % ini, Gui, x
IniWrite, % y, % ini, Gui, y
Gui, destroy
buildGUi()
return lobby
}
return 0
}
tables(lobby, site) {
WinGet, pid, PID, % "ahk_id" lobby
if ( site = "Party" )
WinGet, list, list, Good Luck ahk_pid%pid%,,lobby
if ( site = "Ongame" )
WinGet, list, list, ID ahk_pid%pid%
if ( site = "iPoker" )
WinGet, list, list, ahk_pid%pid%
Loop % list
tables := list%a_index%!=lobby
? listAdd(tables, list%a_index%)
: tables
return tables
}
;;;;;;;;;;;;;;;;;;;;;;;;;; Ongame ;;;;;;;;;;;;;;;;;;;;;;;;;;
lobby_Ongame() {
ifWinExist, PokerRoom.com - Welcome
return WinExist()
ifWinExist, HollywoodPoker.com - Welcome
return WinExist()
ifWinExist, EurobetPoker - Welcome
return WinExist()
ifWinExist, Tower Gaming Poker Room - Welcome
return WinExist()
ifWinExist, Betsson - Welcome
return WinExist()
return 0
}
get$_Ongame(text, string) {
StringMid, amount, text, InStr(text, string)+5, 10
StringLeft, amount, amount, InStr(amount, "`r`n")-1
StringReplace, amount, amount, $,,, All
StringReplace, amount, amount, .,, All
StringReplace, amount, amount, `,, ., All
return amount
}
GameType_Ongame(title) {
If InStr(title, "Tournament") {
If InStr(title, "No Limit")
return "NL tourney"
If InStr(title, "Pot Limit")
return "PL tourney"
If InStr(title, "Limit")
return "Limit tourney"
}
else {
If InStr(title, "No Limit")
return "NL cash"
If InStr(title, "Pot Limit")
return "PL cash"
If InStr(title, "Limit")
return "Limit cash"
}
return 0
}
GetBB_Ongame(title, gametype) {
if ( gametype = "NL tourney" || gametype = "PL tourney" || gametype = "Limit tourney")
StringTrimLeft, title, title, InStr(title, "-")+1
if ( gametype = "NL cash" || gametype = "PL cash" || gametype = "Limit cash")
StringTrimLeft, title, title, InStr(title, "-$")+1
StringLeft, bb, title, InStr(title, a_space)-1
StringReplace, bb, bb, .,, All
StringReplace, bb, bb, `,, ., All
return bb
}
;;;;;;;;;;;;;;;;;;;;;;;;;; Party ;;;;;;;;;;;;;;;;;;;;;;;;;;
lobby_Party() {
ifWinExist, PartyPoker.com: Poker Lobby
return WinExist()
ifWinExist, EmpirePoker.com: Poker Lobby
return WinExist()
return 0
}
get$_Party(text, string, usdec) {
StringMid, amount, text, InStr(text, string)+6, 10
StringLeft, amount, amount, InStr(amount, "`r`n")-1
StringReplace, amount, amount, %a_space%,,, All
if ( usdec = 1) {
StringReplace, amount, amount, $,,, All
StringReplace, amount, amount, `,,, All
}
else {
StringReplace, amount, amount, $,,, All
StringReplace, amount, amount, .,, All
StringReplace, amount, amount, `,, ., All
}
if ( amount = "" )
amount:=0
return amount
}
getBet_Party(text, string, usdec) {
StringMid, amount, text, InStr(text, string)+6, 10
StringLeft, amount, amount, InStr(amount, ")")-1
StringReplace, amount, amount, %a_space%,,, All
if ( usdec = 1) {
StringReplace, amount, amount, $,,, All
StringReplace, amount, amount, `,,, All
}
else {
StringReplace, amount, amount, $,,, All
StringReplace, amount, amount, .,, All
StringReplace, amount, amount, `,, ., All
}
if ( amount = "" )
amount:=0
return amount
}
GameType_Party(title) {
If ( InStr(title, " Buy-in.") || InStr(title, "Table #") ) {
If InStr(title, "NL", 1)
return "NL tourney"
If InStr(title, "PL", 1)
return "PL tourney"
else
return "Limit tourney"
}
else {
If InStr(title, "NL", 1)
return "NL cash"
If InStr(title, "PL", 1)
return "PL cash"
else
return "Limit cash"
}
return 0
}
GetBB_Party(id, title, gametype, usdec) {
if ( gametype = "NL tourney" || gametype = "PL tourney" || gametype = "Limit tourney") {
ControlGetText, text, Static6, ahk_id%id%
If InStr(text, "Blinds-Antes") {
bb:=StrMid(text,"/", a_space)
}
else
bb:=StrMid(text,"/",")")
}
if ( gametype = "NL cash" || gametype = "PL cash" || gametype = "Limit cash") {
StringTrimLeft, title, title, InStr(title, "/")
StringLeft, bb, title, InStr(title, a_space)-2
}
if ( usdec = 0 ) {
StringReplace, bb, bb, .,, All
StringReplace, bb, bb, `,, ., All
}
else {
StringReplace, bb, bb, `,,, All
}
StringReplace, bb, bb, $,,, All
return bb
}
Party_settings() {
global
iniRead, USdec, %ini%, Prefs, USdec, 1
}
;;;;;;;;;;;;;;;;;;;;;;;;;; iPoker ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
lobby_iPoker() {
ifWinExist, Nickname:
return WinExist()
return 0
}
Pot_iPoker()
{
global
PotTextColor := GetPotTextColor()
PotLocationFound := GetPotLocation()
If (PotLocationFound)
pot:=GetPotSize()
ELSE
pot:=0
return pot
}
Bet_iPoker()
{
global
CallTextColor := GetCallTextColor()
CallLocationFound := GetCallLocation()
If (CallLocationFound)
bet:=GetCallSize()
Else
bet:=0
return bet
}
iPoker_Settings() {
global
iniRead, ButtonsOnLeft, %ini%, Prefs, ButtonsOnLeft, 0
iniRead, LimitTourney, %ini%, Prefs, LimitTourney, 0
SysGet, Sb, 7
SysGet, Sc, 4
TableSize:=0
PotTextColor:=0x0
CallTextColor:=0x0
ButtonOffset:=-18*ButtonsOnLeft
}
GameType_iPoker(title) {
If InStr(title, "No limit")
return "NL cash"
If InStr(title, "Pot limit")
return "PL cash"
If InStr(title, "Limit")
return "Limit cash"
else
return "Tourney"
return 0
}
GetBB_iPoker(title, gametype) {
StringTrimLeft, bb, title, InStr(title, "/")
if ( gametype = "NL tourney" || gametype = "PL tourney" || gametype = "Limit tourney" || gametype = "Tourney" )
StringLeft, bb, bb, InStr(bb, a_space)-1
StringReplace, bb, bb, $,,, All
StringReplace, bb, bb, `,,, All
return bb
}
;;;;;;;;;;;;;;;;;;;;;;;;;; from Roand's functions ;;;;;;;;;;;;;;;;;;;;;;
strMid(str, str1, str2) { ; by Roland
StringTrimLeft, s, str, InStr(str, str1)+StrLen(str1)-1
StringLeft, s, s, InStr(s, str2)-1
return s
}
web() { ; by Titan, modified by Roland
regRead, p, HKCR, HTTP\shell\open\command
return SubStr(p, 1, InStr(p, ".exe")+4)
}
listAdd( byRef list, item, del="," ) { ; by Roland
list:=( list!="" ? ( list . del . item ) : item )
return list
}
;;;;;;;;;;;;;;;;;;;;;;; from butcha's iPokerBetPot script ;;;;;;;;;;;;;;;
; --------------------
; Get Pot Size
; --------------------
; Self-explanatory.
GetPotSize()
{
global Px,Py,Pw,Ph,PotTextColor
If (Ph = 10)
{
GetTextMatrix("st",Px,Py,Pw,Ph,PotTextColor)
Return % ParseSmallTextMatrix()
}
Return 0
}
; --------------------
; Get Call Size
; --------------------
; Self-explanatory.
GetCallSize()
{
global Cx,Cy,Cw,Ch,CallTextColor
If (Ch = 11)
{
GetTextMatrix("lt",Cx,Cy,Cw,Ch,CallTextColor)
Return % ParseLargeTextMatrix()
} Else If (Ch = 10)
{
GetTextMatrix("st",Cx,Cy,Cw,Ch,CallTextColor)
Return % ParseSmallTextMatrix()
}
Return 0
}
; --------------------
; Get Table Size
; --------------------
GetTableSize(id)
{
global Vx,Vy,Sb,Sc
WinGetPos, Vx,Vy,Width,Height, ahk_id%id%
Vx += Sb
Vy += Sb+Sc
Width -= (2*Sb)
Height -= (2*Sb+Sc)
If Width Between 798 And 802
If Height Between 598 And 602
Return 1
If Width Between 510 And 514
If Height Between 322 And 326
Return 2
Return 0
}
; --------------------
; Get Pot Text Color
; --------------------
; Self-explanatory.
GetPotTextColor()
{
global
If (TableSize = 1)
{
Return % GetOddColor(Vx+359,Vy+131,40,8)
}
If (TableSize = 2)
{
Return % GetOddColor(Vx+51,Vy+28,24,12)
}
Return 0
}
; --------------------
; Get Call Text Color
; --------------------
; Self-explanatory.
GetCallTextColor()
{
global
If (TableSize = 1)
{
Return % GetOddColor(Vx+414+ButtonOffset,Vy+513,24,12)
}
If (TableSize = 2)
{
Return % GetOddColor(Vx+296,Vy+293,24,12)
}
Return 0
}
; --------------------
; Get Pot Location
; --------------------
GetPotLocation()
{
global TableSize,Vx,Vy,PotTextColor,Px,Py,Pw,Ph
If (TableSize = 1)
{
PotFound := GetColorBounds("P",Vx+403,Vy+127,90,16,PotTextColor)
If (NOT PotFound)
Return False
Pw++
If (Ph = 11)
Ph--
Else If (Ph = 10)
Py--
Else If (Ph = 9)
Ph++
Else If (Ph = 8)
{
Ph += 2
Py--
} Else
Return False
Return True
}
If (TableSize = 2)
{
PotFound := GetColorBounds("P",Vx+45,Vy+28,58,12,PotTextColor)
If (NOT PotFound)
Return False
Pw++
If (Ph = 11)
Ph--
Else If (Ph = 10)
Py--
Else If (Ph = 9)
Ph++
Else If (Ph = 8)
{
Ph += 2
Py--
} Else
{
Px := 0
Py := 0
Pw := 0
Ph := 0
Return False
}
Return True
}
Return False
}
; --------------------
; Get Call Location
; --------------------
GetCallLocation()
{
global TableSize,Vx,Vy,ButtonOffset,CallTextColor,Cx,Cy,Cw,Ch
If (TableSize = 1)
{
CallFound := GetColorBounds("C",Vx+386+ButtonOffset,Vy+510,80,18,CallTextColor)
If (NOT CallFound)
Return False
Cx--
Cw += 2
If (Ch = 13)
{
Cy++
Ch -= 2
} Else If (Ch = 12 OR Ch = 11)
{
Ch--
} Else If (Ch = 9 OR Ch = 8)
{
Cy--
Ch += 2
} Else
{
Cx := 0
Cy := 0
Cw := 0
Ch := 0
Return False
}
Return True
}
If (TableSize = 2)
{
CallFound := GetColorBounds("C",Vx+270,Vy+292,77,18,CallTextColor)
If (NOT CallFound)
Return False
Cx--
Cw += 2
If (Ch = 11)
Ch--
Else If (Ch = 10)
Cy--
Else If (Ch = 9)
Ch++
Else If (Ch = 8)
{
Ch += 2
Cy--
} Else
{
Cx := 0
Cy := 0
Cw := 0
Ch := 0
Return False
}
Return True
}
Return False
}
; ====================
; COLOR & PIXEL FUNCTIONS
; ====================
GetOddColor(X,Y,Width,Height)
{
odd_color := 0
colors := ""
reds := 0x0
greens := 0x0
blues := 0x0
count := 0
Loop, %Width%
{
sx := X+A_Index-1
Loop, %Height%
{
sy := Y+A_Index-1
PixelGetColor, px_color, sx,sy, RGB
If (NOT InStr(colors,px_color))
{
px_r := SubStr(px_color, 1, 4)
px_g := "0x" . SubStr(px_color, 5, 2)
px_b := "0x" . SubStr(px_color, 7, 2)
reds += px_r
greens += px_g
blues += px_b
colors := colors . "`n" . px_color
count++
}
c%px_color%++
}
}
red_avg := reds / count
green_avg := greens / count
blue_avg := blues / count
StringTrimLeft, colors, colors, 1
If (StrLen(colors) < 20)
{
min_px_count := 99999
Loop, Parse, colors, `n
{
If (A_LoopField != "")
{
If (c%A_LoopField% < min_px_count)
{
min_px_count := c%A_LoopField%
odd_color := A_LoopField
}
}
}
Return odd_color
}
max_variation := 0
Loop, Parse, colors, `n
{
If (A_LoopField != "")
{
px_r := SubStr(A_LoopField, 1, 4)
px_g := "0x" . SubStr(A_LoopField, 5, 2)
px_b := "0x" . SubStr(A_LoopField, 7, 2)
SetFormat, Integer, D
px_r += 0
px_g += 0
px_b += 0
red_var := Sqrt( (red_avg - px_r)**2 )
green_var := Sqrt( (green_avg - px_r)**2 )
blue_var := Sqrt( (blue_avg - px_r)**2 )
variation := (red_var + green_var + blue_var) / 3
If (variation > max_variation)
{
max_variation := variation
odd_color := A_LoopField
}
c%A_LoopField% := 0
}
}
Return odd_color
}
; --------------------
; Get Color Bounds
; --------------------
GetColorBounds(prefix,X,Y,Width,Height,Color)
{
global
local min_x,max_x,min_y,max_y,i
min_x := 9999
max_x := 0
min_y := 9999
max_y := 0
Loop, %Width%
{
i := A_Index - 1
PixelSearch, ,, X+i,Y,X+i,Y+Height-1, %Color%, 0, RGB
If (ErrorLevel = 0)
{
If (i < min_x)
min_x := i
If (i > max_x)
max_x := i
}
}
If (min_x >= max_x OR max_x = 9999)
{
%prefix%x := 0
%prefix%y := 0
%prefix%w := 0
%prefix%h := 0
Return False
}
%prefix%x := X + min_x
%prefix%w := max_x - min_x + 1
Loop, %Height%
{
i := A_Index - 1
PixelSearch, ,, %prefix%x,Y+i,%prefix%x+%prefix%w,Y+i, %Color%, 0, RGB
If (ErrorLevel = 0)
{
If (i < min_y)
min_y := i
If (i > max_y)
max_y := i
}
}
If (min_y >= max_y OR max_y = 9999)
{
%prefix%x := 0
%prefix%y := 0
%prefix%w := 0
%prefix%h := 0
Return False
}
%prefix%y := Y + min_y
%prefix%h := max_y - min_y + 1
Return True
}
; --------------------
; Get Text Matrix
; --------------------
GetTextMatrix(prefix,X,Y,Width,Height,Color)
{
global
local col,i,j,px_color
col := 0
%prefix%_sep := 0
Loop, %Width%
{
col++
%prefix%_col%col% := 0
i := A_Index - 1
Loop, %Height%
{
j := A_Index - 1
PixelGetColor, px_color, X+i,Y+j, RGB
If (px_color = Color)
{
%prefix%_col%col% := %prefix%_col%col% | 2**(Height-j-1)
}
}
If (%prefix%_col%col% = 0)
{
%prefix%_sep := %prefix%_sep . "`n" . col
}
}
%prefix%_col := col
}
; --------------------
; Parse Small Text Matrix
; --------------------
ParseSmallTextMatrix()
{
global
local number,this,next,a,b,c,d,e
number := ""
StringSplit, st_sep, st_sep, `n
If (st_sep0 > 1)
{
Loop, %st_sep0%
{
If (A_Index = %st_sep0%)
Break
this := st_sep%A_Index%
next := A_Index + 1
next := st_sep%next%
If (this = next)
Continue
If (this + 2 = next)
{
a := this + 1
a := st_col%a%
If (a = 6)
number := number . "."
}
If (this + 4 = next)
{
a := this + 1
a := st_col%a% >> 1
b := this + 2
b := st_col%b% >> 1
c := this + 3
c := st_col%c% >> 1
If (a = 65 AND b = 255 AND c = 1)
number := number . "1"
}
If (this + 6 = next)
{
a := this + 1
a := st_col%a% >> 1
b := this + 2
b := st_col%b% >> 1
c := this + 3
c := st_col%c% >> 1
d := this + 4
d := st_col%d% >> 1
e := this + 5
e := st_col%e% >> 1
If (a = 67 AND b = 133 AND c = 137 AND d = 145 AND e = 97)
number := number . "2"
If (a = 66 AND b = 129 AND c = 145 AND d = 145 AND e = 110)
number := number . "3"
If (a = 24 AND b = 40 AND c = 72 AND d = 255 AND e = 8)
number := number . "4"
If (a = 242 AND b = 145 AND c = 145 AND d = 145 AND e = 142)
number := number . "5"
If (a = 62 AND b = 81 AND c = 145 AND d = 145 AND e = 14)
number := number . "6"
If (a = 128 AND b = 131 AND c = 140 AND d = 176 AND e = 192)
number := number . "7"
If (a = 110 AND b = 145 AND c = 145 AND d = 145 AND e = 110)
number := number . "8"
If (a = 112 AND b = 137 AND c = 137 AND d = 138 AND e = 124)
number := number . "9"
If (a = 126 AND b = 129 AND c = 129 AND d = 129 AND e = 126)
number := number . "0"
}
}
}
Loop, %st_col%
{
st_col%A_Index% := 0
}
If number is Number
Return number
Return 0
}
; --------------------
; Parse Large Text Matrix
; --------------------
ParseLargeTextMatrix()
{
global
local number,this,next,a,b,c,d,e,f,g
number := ""
StringSplit, lt_sep, lt_sep, `n
If (lt_sep0 > 1)
{
Loop, %lt_sep0%
{
If (A_Index = %lt_sep0%)
Break
this := lt_sep%A_Index%
next := A_Index + 1
next := lt_sep%next%
If (this = next)
Continue
If (this + 3 = next)
{
a := this + 1
a := lt_col%a%
b := this + 2
b := lt_col%b%
If (a = 6 AND b = 6)
number := number . "."
}
If (this + 7 = next)
{
a := this + 1
a := lt_col%a% >> 1
b := this + 2
b := lt_col%b% >> 1
c := this + 3
c := lt_col%c% >> 1
d := this + 4
d := lt_col%d% >> 1
e := this + 5
e := lt_col%e% >> 1
f := this + 6
f := lt_col%f% >> 1
If (a = 129 AND b = 129 AND c = 511 AND d = 511 AND e = 1 AND f = 1)
number := number . "1"
}
If (this + 8 = next)
{
a := this + 1
a := lt_col%a% >> 1
b := this + 2
b := lt_col%b% >> 1
c := this + 3
c := lt_col%c% >> 1
d := this + 4
d := lt_col%d% >> 1
e := this + 5
e := lt_col%e% >> 1
f := this + 6
f := lt_col%f% >> 1
g := this + 7
g := lt_col%g% >> 1
If (a = 193 AND b = 259 AND c = 263 AND d = 269 AND e = 281 AND f = 497 AND g = 225)
number := number . "2"
If (a = 130 AND b = 257 AND c = 273 AND d = 273 AND e = 273 AND f = 511 AND g = 238)
number := number . "3"
If (a = 24 AND b = 40 AND c = 72 AND d = 136 AND e = 511 AND f = 511 AND g = 8)
number := number . "4"
If (a = 2 AND b = 481 AND c = 481 AND d = 289 AND e = 289 AND f = 319 AND g = 286)
number := number . "5"
If (a = 126 AND b = 255 AND c = 417 AND d = 289 AND e = 289 AND f = 319 AND g = 30)
number := number . "6"
If (a = 256 AND b = 256 AND c = 263 AND d = 287 AND e = 376 AND f = 480 AND g = 384)
number := number . "7"
If (a = 238 AND b = 511 AND c = 273 AND d = 273 AND e = 273 AND f = 511 AND g = 238)
number := number . "8"
If (a = 240 AND b = 505 AND c = 265 AND d = 265 AND e = 267 AND f = 510 AND g = 252)
number := number . "9"
If (a = 254 AND b = 511 AND c = 257 AND d = 257 AND e = 257 AND f = 511 AND g = 254)
number := number . "0"
}
}
}
Loop, %lt_col%
{
lt_col%A_Index% := 0
}
If number is Number
Return number
Return 0
}