bustiiing / blazingstars

Automatically exported from code.google.com/p/blazingstars
0 stars 0 forks source link

Auto Time Bank #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Basically I'm curious as to how difficult this is to achieve with what we have 
so far? Would this 
require significant changes? I'm assuming this is something Steve has looked 
into a while back but 
know this is a popular feature in other poker hot key applications, so 
mentioning it as an issue might 
save some further questioning down the road. 

Still plugging away at objective C. Hopefully I'll be able to contribute soon. 

Original issue reported on code.google.com by amar...@gmail.com on 28 Dec 2009 at 3:15

GoogleCodeExporter commented 8 years ago
Wish I could edit....

This should be filed as enhancement rather than issue, obv..

Original comment by amar...@gmail.com on 28 Dec 2009 at 3:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I'm not sure how easy this will be to do.  I've never used a similar feature, 
but I
presume that it is meant to hit the "Time" button when it pops up, whether a 
table is
in the foreground or not?  If the feature is required only when the table is in 
the
foreground, then we might have to do screen scraping again (see issue 13);  if 
it's
for tables that are in the background, I don't know how it would be possible.  I
suppose we could scan the windows on a timer and search for the creation of the
button in the NSAccessibility hierarchy, but that's a pretty clumsy approach 
even if
it works, and it's an approach which will generate a drain on a user's system
resources.  I'll have to check, but it might also require cycling the window 
which is
requesting time to the foreground to either press the button through the API or
simulate a mouse click to push it. This would be a bit of a problem, UI-wise...

It would be interesting to know how this is done on Windows.  If they're 
reading the
log files to determine it, then we're basically screwed, because I haven't been 
able
to interpret the log files on OS X in such a way that I can match actions to 
tables.
 And how are they interacting with the client when they do press it?  If anyone has
experience with windows AHK scripts, this would be useful information.

Original comment by steven.h...@gmail.com on 28 Dec 2009 at 6:44

GoogleCodeExporter commented 8 years ago
I've been looking into this issue, and as far as I can see, there would be 
three ways
to implement this feature:

1).  The PokerStars.0 log in ~/Library/Logs/PokerStars/ will report a
MSG_TABLE_TIMEBANK message when the time bank is activated.  However, the 
window IDs
in this file are gibberish to me, and unless someone can decode them, we would 
have
to go through each window and screen scrape to look for the time bank button.  
Plus,
we would have to continually poll the log file looking for new messages.  This 
feels
wasteful of resources on both ends.

2).  Similar to 1), except we skip the log file and just flip through each 
window on
a timer looking for the time bank button.  CPU hog, and probably prone to 
fragility
and outright failure.

3).  Possibly the most likely solution is to hook into the messages field on 
each
window;  I think that if we could find the text fields and slap an 
Accessibility API
observer on them, we could be notified of changes and parse them for dealer 
messages
talking about time bank.  This has a couple of advantages, including the lack 
of need
for a timer, the ability to use notifications, and the fact that this could 
probably
form the basis for a more nuanced set of window overlays, including a "most 
urgent"
overlay, etc.  It also has a disadvantage, namely that the user would be 
required to
have dealer messages active, because if they're on silent the dealer doesn't 
warn
about the time bank.  This is probably not too much to ask of the user, though.

I like 3 the most, and I'm going to investigate if the technology will work for 
this.
I'll update here as I get more information.

Original comment by steven.h...@gmail.com on 10 Jan 2010 at 6:10

GoogleCodeExporter commented 8 years ago
Huh, that didn't turn out too badly, at least what I've got going so far.  I 
can read
the chat box and determine when the time bank has activated.  I'm going to wait 
on
Luca's changes for Fold To Any, and then I'll finish implementing this by 
adding in
the UI and back-end theme-specific code for the button press.  All in all, 
though,
this looks to be a lot more do-able than I thought!  It should be completed in 
a day
or two.

Original comment by steven.h...@gmail.com on 10 Jan 2010 at 8:55

GoogleCodeExporter commented 8 years ago

Original comment by steven.h...@gmail.com on 10 Jan 2010 at 8:56

GoogleCodeExporter commented 8 years ago
Hi Steven,

Sounds like solution 3 is working well. 

FYI: if you ever need to do something based on solution 1 (polling log file), 
there are 
a couple of ways to receive notifications when a file is changed, so you don't 
need to 
poll the file. 1) kthreads is a low level file change notification api. 2) 
FSEvents is a 
Carbon API, I think, higher level but less flexible.

Original comment by steve.mc...@gmail.com on 10 Jan 2010 at 9:54

GoogleCodeExporter commented 8 years ago
I've committed the first stage of this project, which is to hook into the 
window's
chat box and determine when the time bank is activated.  This is now complete, 
and
I'll work on pressing the time bank button when it's up.

Original comment by steven.h...@gmail.com on 11 Jan 2010 at 7:27

GoogleCodeExporter commented 8 years ago
Okay, so I've got a working version of the auto time bank feature.  It's 
working fine
in my initial testing, but it requires a lot more testing before I sign off on 
it. 
If people can give it a spin, I'd be grateful. :-)  I'll upload a debug build 
so that
people who aren't comfortable with building and running from SVN can try these 
things
out.

Original comment by steven.h...@gmail.com on 12 Jan 2010 at 3:59

GoogleCodeExporter commented 8 years ago
OK...ATB feature works great!!!!!!!  Great job!!!!!!!

Original comment by vyo...@gmail.com on 12 Jan 2010 at 11:53

GoogleCodeExporter commented 8 years ago
Thanks, Vaughn. :-) 

Original comment by steven.h...@gmail.com on 13 Jan 2010 at 4:32

GoogleCodeExporter commented 8 years ago
Closing this one off.

Original comment by steven.h...@gmail.com on 15 Jan 2010 at 8:58