Method - To call and measure if any rats are on current overview

Need help … want to write a method that will

Check to see if any reds are on active overview and return a value greater than 0 or bool of true …

int test

//somewhere call the method then ..

public int RatTest()
		if (Parse.IOverviewEntry[] ListRatOverviewEntry => WindowOverview?.ListView?.Entry?.Where(entry =>(entry?.MainIconIsRed ?? false));
				test = test + 1;
		return test;

Reminds me of what the older demo mining script integrated with Sanderling does (not the beginner script, the other one). It attacks rats and as far as I remember it uses red color to identify them.

Yes … I believe the statements involved were …

Sanderling.Parse.IWindowOverview WindowOverview => Measurement?.WindowOverview?.FirstOrDefault();

Parse.IOverviewEntry[] ListRatOverviewEntry => 
						Where(entry => (entry?.MainIconIsRed ?? false))?.

but i can’t seem to figure a way for a var or bool to equal the result of that check

you have var:
var SetRatName =
ListRatOverviewEntry?.Select(entry => Regex.Split(entry?.Name ?? “”, @"\s+")?.FirstOrDefault())
or you can count the list and use if list.count>0
do: …

Building on the code snippet you posted, I guess you can get the bool with the follwing code:

var anyRatsVisible = (ListRatOverviewEntry?.Any() ?? false);

Viir, how you post the code c# ?

Thanks … that works … i will update my scripting post with new code