Guide to how processing logic of Open Holdem DLL works

Overview

  1. A scrape occurs every X ms (X is set in edit->preferences->Scraper->scrape delay)
  2. The formulas are evaluated once every scrape. ie bot asks DLL should I go all-in,raise,call…..

    From Winholdem Help

    1. if alli button is visible and alli formula is true then press alli else
    2. if swag button is visible and swag formula is >..0 then press rais else
    3. (note: the exact swag value will first be typed into the edit field)
    4. if rais button is visible and rais formula is true then press rais else
    5. if call button is visible and call formula is true then press call else
    6. if chec button is visible …………………… then press chec else
    7. if fold button is visible and call formula is fals then press fold
  3. In standard OH there is no shortcutting. EACH SCRAPE all formulas are evaluated. ie even if dll$rais returns true, dll$call,dll$swag is still evaluated.
  4. Every Y scrapes (Y is set in edit->preferences->autoplayer->Frame Delay), isFInalAnswer will be set=1 for the symbol calls shown above AND OH will take action

Threading Nonsense

Some people on forums seem confused. Seemed to say OH was all threaded and that if I took a long time in one call, the other stuff is still called. Well I tried a long Sleep() inside one dll$iswait function and it had no effect other than adding a delay. OH did not magically jump ahead. All calls are sequential.

Important Concepts

All Documentation here based on actual experiments

The following debug output was observed: Note the number beside “state” is the seconds. For this debug output, The scraper scraped avery 1.5 seconds, and frame delay was set to 2.

	<<<<<<<<<>>>>>>>>>

event
pfgws - 005049A0
phl1k
prw1326
p_send_chat_message

0 state - 01398FA0 - isMyTurn=7 isFinalAnswer=0
query - dll$iswait - isMyTurn=7 isFinalAnswer=0
query - dll$alli - isMyTurn=7 isFinalAnswer=0
query - dll$swag - isMyTurn=7 isFinalAnswer=0
query - dll$rais - isMyTurn=7 isFinalAnswer=0
query - dll$call - isMyTurn=7 isFinalAnswer=0

2 state - 013991C8 - isMyTurn=7 isFinalAnswer=0
query - dll$iswait - isMyTurn=7 isFinalAnswer=0
query - dll$alli - isMyTurn=7 isFinalAnswer=0
query - dll$swag - isMyTurn=7 isFinalAnswer=0
query - dll$rais - isMyTurn=7 isFinalAnswer=0
query - dll$call - isMyTurn=7 isFinalAnswer=0

3 state - 013993F0 - isMyTurn=7 isFinalAnswer=0
query - dll$iswait - isMyTurn=7 isFinalAnswer=0
query - dll$alli - isMyTurn=7 isFinalAnswer=0
query - dll$swag - isMyTurn=7 isFinalAnswer=0
query - dll$rais - isMyTurn=7 isFinalAnswer=0
query - dll$call - isMyTurn=7 isFinalAnswer=0

4 state - 01399618 - isMyTurn=7 isFinalAnswer=0
query - dll$iswait - isMyTurn=7 isFinalAnswer=0
query - dll$alli - isMyTurn=7 isFinalAnswer=1
query - dll$swag - isMyTurn=7 isFinalAnswer=1
query - dll$rais - isMyTurn=7 isFinalAnswer=1
query - dll$call - isMyTurn=7 isFinalAnswer=1

6 state - 01399840 - isMyTurn=0 isFinalAnswer=0
query - dll$alli - isMyTurn=0 isFinalAnswer=0
query - dll$swag - isMyTurn=0 isFinalAnswer=0
query - dll$rais - isMyTurn=0 isFinalAnswer=0
query - dll$call - isMyTurn=0 isFinalAnswer=0

9 state - 01399A68 - isMyTurn=7 isFinalAnswer=0
query - dll$iswait - isMyTurn=7 isFinalAnswer=0
query - dll$alli - isMyTurn=7 isFinalAnswer=0
query - dll$swag - isMyTurn=7 isFinalAnswer=0
query - dll$rais - isMyTurn=7 isFinalAnswer=0
query - dll$call - isMyTurn=7 isFinalAnswer=0

11 state - 01399C90 - isMyTurn=7 isFinalAnswer=0
query - dll$iswait - isMyTurn=7 isFinalAnswer=0
query - dll$alli - isMyTurn=7 isFinalAnswer=0
query - dll$swag - isMyTurn=7 isFinalAnswer=0
query - dll$rais - isMyTurn=7 isFinalAnswer=0
query - dll$call - isMyTurn=7 isFinalAnswer=0

12 state - 01399EB8 - isMyTurn=7 isFinalAnswer=0
query - dll$iswait - isMyTurn=7 isFinalAnswer=0
query - dll$alli - isMyTurn=7 isFinalAnswer=1
query - dll$swag - isMyTurn=7 isFinalAnswer=1
query - dll$rais - isMyTurn=7 isFinalAnswer=1
query - dll$call - isMyTurn=7 isFinalAnswer=1

13 state - 0139A0E0 - isMyTurn=5 isFinalAnswer=0
query - dll$iswait - isMyTurn=5 isFinalAnswer=0
query - dll$alli - isMyTurn=5 isFinalAnswer=0
query - dll$swag - isMyTurn=5 isFinalAnswer=0
query - dll$rais - isMyTurn=5 isFinalAnswer=0
query - dll$call - isMyTurn=5 isFinalAnswer=0

15 state - 0139A308 - isMyTurn=5 isFinalAnswer=0
query - dll$iswait - isMyTurn=5 isFinalAnswer=0
query - dll$alli - isMyTurn=5 isFinalAnswer=0
query - dll$swag - isMyTurn=5 isFinalAnswer=0
query - dll$rais - isMyTurn=5 isFinalAnswer=0
query - dll$call - isMyTurn=5 isFinalAnswer=0

16 state - 0139A530 - isMyTurn=5 isFinalAnswer=0
query - dll$iswait - isMyTurn=5 isFinalAnswer=0
query - dll$alli - isMyTurn=5 isFinalAnswer=1
query - dll$swag - isMyTurn=5 isFinalAnswer=1
query - dll$rais - isMyTurn=5 isFinalAnswer=1
query - dll$call - isMyTurn=5 isFinalAnswer=1
	

isFinalAnswer

DOCS say “true when autoplayer preparing to act; false any other time. “.

If Y scrapes in a row are identical (Y is set in edit->preferences->autoplayer->Frame Delay) THEN when dll$alli, dll$swag, dll$rais, dll$call are called isFinalAnswer is true. UNLESS dll$iswait returned 0, in that case isFinalAnswer=0.

UNCHECK but assuming it also relies on isMyTurn=1

ie When dll$iswait=0, the normal sequence of events is:

		state - 01399A68
		7 final answer = 0
		query - dll$iswait final answer = 0
		query - dll$alli final answer = 1
		query - dll$swag final answer = 1
		query - dll$rais final answer = 1
		query - dll$call final answer = 1
	

dll$iswait

If dll$iswait=1, OH will continue to scrape and call symbols but it will not take any action. While dll$iswait=1 isFinalAnswer will always be 0.

Matrix says

While dll$iwait is true don’t have to respond to formula requests. You do have to somehow make sure that by the time dll$iswait is true that OpenHoldem has been returned the correct result.

When you go down this route you may encounter the problem of OpenHoldem stop evaluating the formulas, because there has been no change in state and dll$iswait is false.
The best thing to do in this case is to disable all caching inside of OpenHoldem and always return a valid formula result and set dll$iswait to false on the very first valid frame
with buttons you see from OpenHoldem.

GWS calls

Of course you are also going to be using a lot of gws() calls to get values from OpenHoldem along with the holdem_state, and keep in mind that often they will be 1 frame out of sync. The gws() result is always the correct, current result. The holdem_state may be 1 frame behind because it is only sent once per scrape. For this reason I would advise using only gws calls in the DLL and ignoring that holdem_state entirely. Those DLL calls get to be quite expensive CPU wise (1ms per call) so if that becomes an issue I would recommend caching that data.

False=0

True is numbers other than 0, and false is 0.