How to get a special hand data?

For discussion of the Poker Mavens server module and other administration topics
developer

How to get a special hand data?

Post by developer »

Hello
I need to save each hand data seperately in db ,but when i request a hand history with the Name and Date the system brings me several hands with several dates in a long string.
How can i get just one hand data?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to get a special hand data?

Post by Kent Briggs »

developer wrote:I need to save each hand data seperately in db ,but when i request a hand history with the Name and Date the system brings me several hands with several dates in a long string.
How can i get just one hand data?
Using the Name and Date parameters retrieves the entire hand history file for the day and table named. In legacy mode, that string has CR/LF characters separating each line. In JSON mode, each line is returned as an array element. Either way, you just loop through it looking for the start of each hand. The server also holds in memory the last 100 hands played and you can retrieve a single hand from there using the Hand parameter. You can use the Callback Event system to get notified each time a hand completes.
developer

Re: How to get a special hand data?

Post by developer »

Well , you said
The server also holds in memory the last 100 hands played and you can retrieve a single hand from there using the Hand parameter
It means that in each log file is maximum 100 hands data . right?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to get a special hand data?

Post by Kent Briggs »

developer wrote:It means that in each log file is maximum 100 hands data . right?
No, the log file will have the entire day's hands, for each table. Could be thousands of hands. The last 100 hands played are cached in memory and can be retrieved individually by hand number.
developer

Re: How to get a special hand data?

Post by developer »

The last 100 hands played are cached in memory and can be retrieved individually by hand number
wooow Its what i`m looking for, how can i retrieve a hand by hand number from memory?
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to get a special hand data?

Post by Kent Briggs »

developer wrote:wooow Its what i`m looking for, how can i retrieve a hand by hand number from memory?
See the "Callback Events" group of settings at the bottom of the System tab. Set "Enable callbacks" to Yes, specify a script to run on a web site (typically pointing to a php file) as the "URL", and set "Hand event" to Yes. Your script will be called at the end of each hand. The parameters passed to your script are documented in the help bubble for that event, which include the hand number. Then use that to call LogsHandHistory to retrieve that hand.
developer

Re: How to get a special hand data?

Post by developer »

Thank you ,Worked fine. It was a useful feature that there was not in API reference.
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to get a special hand data?

Post by Kent Briggs »

developer wrote:It was a useful feature that there was not in API reference.
It's in there, see the last paragraph of LogsHandHistory in the API docs.
developer

Re: How to get a special hand data?

Post by developer »

Yes , you right . I saw right now.
There was a line containing active players , for example : ** Hole Cards ** [2 players]
How can i parser the log two get the names of these two player?
Regards
Kent Briggs
Site Admin
Posts: 5878
Joined: Wed Mar 19, 2008 8:47 pm

Re: How to get a special hand data?

Post by Kent Briggs »

developer wrote:There was a line containing active players , for example : ** Hole Cards ** [2 players]
How can i parser the log two get the names of these two player?
If rake is enabled (ring games) they will be listed in the Rake lines. Otherwise everyone that was dealt cards will have some kind of action associated with their name including the following:

player posts big blind
player posts small blind
player posts small & big blind
player checks
player calls
player bets
player raises to
player folds
player wins
player refunded

So look for those and extract the "player" part.
Post Reply