Issues With Reading Local (moved to the good category by kaboonus)

Hi all. I’m working on improving my coding skills, so I’m trying out some custom code. At the moment, I’m trying to get the bot to read the local playerlist and note the count of players in local (including myself, alliance/corp/fleet members, and neuts/hostiles - so player standing identification is unnecessary). At the moment I’m trying to make use of the following code, but to no success:

var NumLocal = Sanderling?.MemoryMeasurementParsed?.Value?.WindowChatChannel?.FirstOrDefault(windowChat => windowChat?.Caption?.RegexMatchSuccessIgnoreCase(“local”) ?? false)?.ParticipantView?.Entry?.Count()

However this results in NumLocal == null.
Could someone point me in the right direction? Thanks!

you have to make a list

var ListLocal = Sanderling?.MemoryMeasurementParsed?.Value?.WindowChatChannel?.FirstOrDefault(windowChat => windowChat?.Caption?.RegexMatchSuccessIgnoreCase(“local”) ?? false)?.ParticipantView?.Entry.ToList();
var NumberLocal = ListLocal.Count();
 Host.Log("  total in local: " +NumberLocal + "  !" );

** edited /moved the category

look , how I have proceed on ratting script:
I counted them whithout a list, if you want them all
the host.log is here

choat local is here

another example is with rats defined like an array :slight_smile:

In the end if you want just their count is better with a list or like I proceed on participant from local channel.
but if you want to work with any object from inside is better to create an array ( you can sort, arrangsubtract or add new objects)
this link explain better than me about differences between list and array

more info you find at
and some good video at

What about the intermediate results? Which one of the subexpressions is the first you get null for?
For example, when you evaluate up to the WindowChatChannel and log this value too, what do you get there?

The API Explorer in the Sanderling App helps you see what is there in the memory measurement. For example the API Explorer allows you to see following scenarios which could lead to the end result you are reporting:

  • There is no memory measurement.
  • There is a memory measurement, but there is no chat window.

You could also do this inspection by adding log statements to your script, but in the API Explorer you only need to expand the tree view to get the answers.

1 Like