Open Side Menu Go to the Top
Register
HEM1 Custom Stat Tutorial HEM1 Custom Stat Tutorial

12-30-2012 , 04:04 AM
****** Introduction ******
I am creating this post as it took me quite a long time to figure out how to add a custom stat to Holdem Manager 1 : google results were unhelpful, as were forum search results from the HEM1 forum. The required information was on the HEM1 forum but the forum search feature didn't find it.

This post describes how to add your own Stat to the list of available Stats for a Report or HUD. (This is a completely different topic to customizing a Report or a HUD).

I am using HEM 1.12.10b .

****** Model Entries ******
This link has the formulae for all the existing stats, as of Nov 12 2009. Of course this is out of date with the latest version, but there's enough content there for you to copy from and make your own stats.

You will need to sign up to the HEM Forums to be able to download this file, but that is a simple procedure.

****** Your custom stat file ******
Once you have created your stat entry (see below), put it in a text file named CustomStats.txt in the Reports directory under Holdem Manager. That directory should pre-exist and contain a bunch of .report files already.

The file format is a series of XML lines <Stat ................ /> , there is no containing XML element or anything.

****** Using your custom stat ******
When you click the green "+" on the Report window to add a new stat to the report, a dialog pops up with a bunch of stats in categories.

Your custom stat will show up in whatever category you assigned it to via the GroupName field (see below). You can use this like any other stat.

You must restart HEM after changing the CustomStats.txt file, to cause the change to propagate.

You could get started by picking one line out of the model entries file, pasting it to your new CustomStats.txt, and changing the name without changing the formula. Once you do this and restart HEM, the stat with the new name should appear in the Stat selection dialog.

****** Field Meanings ******
The XML fields have the following meaning:
KeyValue
GroupNameWhich panel the stat appears in in the Stat Selection dialog. Use "Custom" for the "Custom Stats" panel, otherwise copy one from the model entries file.
ColumnNameThe text to display in the Stat Selection dialog.
ColumnHeaderThe text to display in the Report, at the head of the column.
ColumnFormatDisplay format in the Report, e.g. $0.00 for dollar amounts, 0.0 for decimal values. Copy a format from the model entries.
ColumnWidth unknown , but probably minimum width in pixels of the column
Tooltipunknown - I don't seem to get tooltips anywhere in HEM1
ValueExpressionsshortcut names used within "Evaluate"
Evaluate the formula to calculate the value in the stat.

****** Rules for the formula ******
As mentioned above, the Evaluate field calculates the value to display. This field can only use variables defined in ValueExpressions and some builtin variables - it can't access database fields directly.

The ValueExpressions field is a semicolon-separated list of SQL SELECT queries that are run against the database, and its result stored in the specified variable name.

I can't go into any more detail here, other than to say that you should consult the model entries file, copy what they have done and make minor modifications to the existing entry that's closest to what you want.

****** Debugging ******
Stat doesn't appear in stat selection dialog - Check you have CustomStats.txt in the correct location, check its format is a series of lines <Stat ................... /> , and its GroupName is a group that exists. Restart HEM. If still fails, then go back to a bare bones CustomStat file just with a stat pasted from the sample file and renamed.

Stat value says "na" - the formula is wrong. Start with a known-good formula and make incremental changes untill you figure out which bit you did wrong.

****** Example ******
Here is my CustomStats.file entire contents, to add Rake bb/100:
Quote:
<Stat GroupName="Custom" ColumnName="Rake bb/100 (Kittens)" ValueExpressions="Sum(ph.RakeAmount/1.0/GT.BigBlind)/100.0 as RakeAmountInBB" Evaluate="RakeAmountInBB*10000.0/TotalHands" ColumnHeader="Rake bb/100" ColumnFormat="0.0" ColumnWidth="*" Tooltip="Rake bb/100 (by Kittens)" />
This is a slight modification to the existing entry "Rake". I added in the division by GT.BigBlind into the variable, and added in *100.0/TotalHands to Evaluate.

Note the "/1.0" in the ValueExpression. This is required to convert ph.RakeAmount (an integer) to floating point, so that a floating division is done by GT.BigBlind (otherwise its' an integer division). If in doubt, do this


**********************
Hope this helps someone somewhere !

Last edited by Kittens; 12-30-2012 at 04:18 AM. Reason: example was wrong
HEM1 Custom Stat Tutorial Quote

      
m