Page 1 of 2

How to get a special hand data?

Posted: Fri Feb 06, 2015 12:53 am
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?

Re: How to get a special hand data?

Posted: Fri Feb 06, 2015 1:38 am
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.

Re: How to get a special hand data?

Posted: Fri Feb 06, 2015 4:21 am
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?

Re: How to get a special hand data?

Posted: Fri Feb 06, 2015 10:33 am
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.

Re: How to get a special hand data?

Posted: Sat Feb 07, 2015 1:38 am
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?

Re: How to get a special hand data?

Posted: Sat Feb 07, 2015 10:22 am
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.

Re: How to get a special hand data?

Posted: Sun Feb 08, 2015 2:47 am
by developer
Thank you ,Worked fine. It was a useful feature that there was not in API reference.

Re: How to get a special hand data?

Posted: Sun Feb 08, 2015 10:16 am
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.

Re: How to get a special hand data?

Posted: Sun Feb 08, 2015 1:07 pm
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

Re: How to get a special hand data?

Posted: Sun Feb 08, 2015 2:24 pm
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.