Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > Internet Gambling > Software
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-03-2006, 01:47 PM
jba jba is offline
Senior Member
 
Join Date: Feb 2005
Posts: 9,596
Default AutoHotKey on PokerStars

Hi all, I'm using an AHK script that is loosely based on the "mouseless poker" scripts found here.

I just started playing on stars, and there are serious problems related to tables stealing focus. Basically what happens is that I switch to the table at the top-left corner using this section

; WindowNW
joy5::
CoordMode, Mouse, Screen
MouseMove,176,100
MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
; I added this MouseClick below at some point, not really sure why:
MouseClick
return


then consider my decision, then click on the check/fold/raise button that looks like this:

;Fold
joy1::
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%
if title contains Good Luck
{
xvar := 240
yvar := 474
}
else if title contains Logged In as XXXX
{
xvar := 470
yvar := 530
}
else
{
xvar := 210
yvar := 495
}
MouseClick, left, xvar, yvar
Sleep, 100
return



(the if/else blocks are something that I added to allow me to play multiple sites at the same time.)


The problem is at some point, I'm assuming inside the if/else blocks, the focus changes to some other table, and my mouse clicks end up going to the wrong table (BAD!).

So i'm thinking I either need to do something ghetto like this:

MouseGetPos, curPosX, curPosY, curWin
WinGetTitle, title, ahk_id %curWin%
WinActivate, %title%


again, right before doing the fold/call/raise mouseclick. This is ghetto because there still seems to be a race condition (though seemlingly much smaller) before the click, or switch to absolute mouse coords (which I'm not sure I know how to do). I'm assuming I can just set a base x/y coord (0/0 for NW, 800/0 for NE, etc) then add that to the button offset coords. how to do absolute coordinates though, anyone know off hand?

any better options for getting this done?
Reply With Quote
  #2  
Old 01-03-2006, 04:55 PM
waffle waffle is offline
Senior Member
 
Join Date: Jul 2004
Posts: 2,231
Default Re: AutoHotKey on PokerStars

right now i use your ghetto solution with the 3 lines ending in WinActivate right before the button click. it's much better than no solution, but it's still prone to occasional error, i think. i'm also looking for a more elegant solution.
Reply With Quote
  #3  
Old 01-04-2006, 06:35 AM
MrMoo MrMoo is offline
Senior Member
 
Join Date: Sep 2004
Location: Las Vegas
Posts: 750
Default Re: AutoHotKey on PokerStars

Try this:


Xcall = 405 ; The x coordinate of the call button in a PartyPoker window
Ycall = 475 ; The y coordinate of the call button in a PartyPoker window

MouseGetPos, , , WinID,
WinGetPos, x, y, w, h, ahk_id %winID%
newX := x + Xcall
newY := y + Ycall
WinActivate, ahk_id %winID%
BlockInput
OnMouseClick, left, newX, newY
BlockInput Off
return

There's still a race condition albeit very small. I personally can't think of a way around it. There is always going to be a miniscule chance that the window focus will change between the time you grab the window id and the time you activate the click. You could possibly try assigning two clicks which may have a faster execution than grabbing window id's. But, you might run into issues with misclicks.
Reply With Quote
  #4  
Old 01-04-2006, 10:24 AM
OrcaDK OrcaDK is offline
Senior Member
 
Join Date: Nov 2004
Location: MTH
Posts: 1,496
Default Re: AutoHotKey on PokerStars

I'm hoping to have a functional beta with Stars support within a week [img]/images/graemlins/smile.gif[/img]
Reply With Quote
  #5  
Old 01-04-2006, 12:28 PM
jba jba is offline
Senior Member
 
Join Date: Feb 2005
Posts: 9,596
Default Re: AutoHotKey on PokerStars

[ QUOTE ]
I'm hoping to have a functional beta with Stars support within a week [img]/images/graemlins/smile.gif[/img]

[/ QUOTE ]

pretty cool, I'll have to download your freeware version and give it a shot -- it works on empire right?

(I [img]/images/graemlins/mad.gif[/img] party)
Reply With Quote
  #6  
Old 01-04-2006, 12:42 PM
OrcaDK OrcaDK is offline
Senior Member
 
Join Date: Nov 2004
Location: MTH
Posts: 1,496
Default Re: AutoHotKey on PokerStars

Yep, it works at Empire also (should) [img]/images/graemlins/smile.gif[/img]
Reply With Quote
  #7  
Old 05-06-2006, 04:58 PM
photojake photojake is offline
Member
 
Join Date: May 2006
Posts: 33
Default Re: AutoHotKey on PokerStars

Hey Jba,

Did you ever get this worked out? I am trying to do the same thing, but the If statement does not seem to be working correctly. Please let me know.

Jacob
Reply With Quote
  #8  
Old 05-06-2006, 06:03 PM
jukofyork jukofyork is offline
Senior Member
 
Join Date: Sep 2004
Location: Leeds, UK.
Posts: 2,551
Default Much safer way to send mouse-clicks...

If you check out the TableNavigator script then I just implemented a fucntion which will stop this problem 100%:

[/i]
PostLeftClick(x, y, table_id)
{ ; ### 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!!!).
Postmessage 0x201, 0x0001, ((y*65536)+x), , ahk_id%table_id%
Postmessage 0x202, 0, ((y*65536)+x), , ahk_id%table_id%
}
[/i]

About this function (see here):

[ QUOTE ]
Have now finished the Pacific support and updated the Wiki code.

To make it easier to use the PostMessage code to send mouseclicks, then I added an extra function: PostLeftClick(x, y, table_id)

It would be better in general to use this function whenever you want to send a mouse click (rather than using MouseClick AHK function) for three main reasons:

1. Like I mentioned before, it will send the click to a window which is obscured by another (ie: no problems if a window pops up infront of another at just the wrong moment) and the click will always goto the window you specified.

2. The click is sent relative to the "client rectangle" which has it's origin in the top left of the visible area of a window, but does NOT include the title bar nor left border of a window. The reason this is good, is because different Window-Management setups for windows XP use slightly different widths for their titlebars...

3. By using Postmessage, the mouse is not actually moved and the mouse click is just sent to the window's message queue (this is very like a ControlClick; where you don't see the mouse move to the control and click it, like you see happen with a MouseClick call).

The PokerStars stuff would benefit from this, but I didn't want to start changing the PokerStars MouseClick calls, as I'm not 100% sure how much needs subtracting from the coords to account for the lack of the titlebar (same goes for pretty much every other call to MouseClick in the code...).

[/ QUOTE ]

I will also try to update PartyPopupBuster application for Stars over the next few days (it should be able to block focus-stealing completely).

Juk [img]/images/graemlins/smile.gif[/img]

EDIT: If any Stars players are feeling generous/bored, then it would be appreciated if they updated the Stars-TableNavigator code to use PostLeftClick() rather than MouseClick, as I only fixed my Pacific stuff (I don't play on Stars and you need to subtract "about" 20 from the Y coords to use this function - needs a Stars player to implement/test...).
Reply With Quote
Reply


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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:08 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.