New measurements every 4 seconds?

Hello,

Thank you for making this wonderful framework.

It seems the measurement is only refreshed every 3-4 seconds. Is there a way to speed up grabbing a new measurement when needed? It processes in about 250ms on my computer.

I’ve seen the Sanderling.InvalidateMeasurement() and Sanderling.WaitForMeasurement() functions, but I don’t understand their use.

I’m hoping to get faster measurements so I can see when a rat is dead and my fighters don’t sit still after killing a rat and get hit by battleship rats.

Thank you in advance!

Yes, you can do this with Sanderling.InvalidateMeasurement().

If you write a loop which just calls this function and then reads from Sanderling.MemoryMeasurement, then you will see several new measurements per second in the API Explorer.
The code would look like this:

while(true)
{
	Sanderling.InvalidateMeasurement();
	Host.Log(Sanderling.MemoryMeasurement.Value?.EnumerateReferencedUIElementTransitive());
}

I found a post with some more background on InvalidateMeasurement: