(House)= # POH Handler The POH Handler is a handler responsible for making sense of a player's POH (Player Owned House) without knowing any info about it's setup in advance. :::{note} :class: dropdown The House handler is optional and has to be explicitly included. You can include it by either including all optional files which is not recommended: ```pascal {$I WaspLib/optional.simba} ``` Or include just the HouseHandler file which is the recommended way to include it: ```pascal {$I WaspLib/optional/handlers/house.simba} ``` ::: Several rooms in a POH are unique on the minimap, with windows and/or doors of several sizes and different places. By having this rooms saved in the following format: ```{figure} ../../../osr/walker/poh.png Most relevant rooms for a POH stripped of their floor colors ``` We can attempt to match what we have on the minimap to those rooms and slowly build a map of the POH. Some rooms share the same room layout or are very similar to others and for those we use some mainscreen information to make up what the room is, e.g., Nexus room, Combat Hall and Quest Hall are all identical. - - - (THouseHandler)= ## type THouseHandler ```pascal THouseHandler = record(TSRLBaseRecord) Loader: THouseLoader; Walker: TRSWalkerV2; Objects: array [EHouseObject] of TRSObjectV2; Downscale: Int32; Similarity: Double; Sample: TRSMapSample; Cache: TMatchTemplateRGBCache; Graph: TWebGraphV2; IsSetup: Boolean; end; ``` The core record used to handle navigating a POH. - - - ## POH.Setup() ```pascal procedure THouseHandler.Setup(); ``` Method you need to use at the start of your script after the user has already configured his house with `TScriptForm.CreateHouseBuilder()`. - - - ## House.ScaledSearch ```pascal function THouseHandler.ScaledSearch(bitmap: TMufasaBitmap; samples: Int32): TPointArray; ``` Internal THouseHandler method used to get an initial TPointArray of possible positions. This is performed in a downscaled map with a downscaled minimap. This is very innacurate by itself but by ruling down most of the map in a downscaled search before doing a full sized search speed has a dramatic boost. You probably won't ever need to call this directly. - - - ## House.FullSearch ```pascal function THouseHandler.FullSearch(template, world: TMufasaBitmap; position: TPoint; out match: Single): TPoint; ``` Internal THouseHandler method used to get the player position. This is used by THouseHandler.Position() to determine how likely is the **Position** passed in, our actual position. This likelyhood is returned with **Match** which ranges from 0 to 1. You probably won't ever need to call this directly. - - - ## House.Position ```pascal function THouseHandler.Position(): TPoint; ``` Returns the players current position on the loaded house map. Example: ```pascal WriteLn(House.Position()); WriteLn(House.Similarity); // Check to see the match percentage if needed ``` - - - ## House.DebugPosition ```pascal function THouseHandler.DebugPosition(): TPoint; ``` Debugs the player position in the currently loaded house map. Example: ```pascal //setup your house and house.loader while True do Map.DebugPosition(); ``` - - - ## var House ```pascal var House ``` Global variable to use the {ref}`THouseHandler`.