Checking the capacity of hold

Hi. I have problems with checking the current state of the hold (the amount of ore), I use this code:
var HoldInfo = Sanderling.MemoryMeasurement.Value.WindowInventory[0].SelectedRightInventoryCapacity.Text;
var HoldStatus = HoldInfo.Split(’/’)[0].Split(’,’)[0];

And I get this:

So, I can’t use String.Join() and Int32.Parse() to convert this value to Int type.

P.S. I think that most likely there is a way much easier, but I do not know it)

I resolved this it way: int cap = (int)Double.Parse(“2 567”);

But can it be made easier?

UPD.
I failed, this worked only if value haven’t this mysterious space symbol. So, how format have “Text” property?)

Yes, it can be made much easier.
Sanderling already contains a lot of parsing code, also for the ore hold capactiy. You can read the parsed version of the memory measurement from Sanderling.MemoryMeasurementParsed (https://github.com/Arcitectus/Sanderling/wiki/Bot-API).

You can find the state of the hold at this path: Sanderling.MemoryMeasurementParsed.Value.WindowInventory[0].SelectedRightInventoryCapacityMilli

It implements the following interface:

public interface IInventoryCapacityGauge
{
	long? Used { get; }
	long? Max { get; }
	long? Selected { get; }
}
```

As you can see in the API explorer, the parsing already takes care of seperating the different numbers you see in the gauge.

But in the API explorer I can’t see SelectedRightInventoryCapacityMilli property. And following code: Sanderling.MemoryMeasurementParsed.Value.WindowInventory[0].SelectedRightInventoryCapacityMilli.Used does work for me( get error SystemNullReferenceException)

To make it visible, expand the tree view for the following path: Sanderling.MemoryMeasurementParsed.Value.WindowInventory[0]

Yep, I found it, but it value = null oO

image uploader

Ok, in that case, we should take a look at the text your eve online client displays on the capacity gauge. This is used as a source for parsing. The eve online client reuses windows regionale settings to format numbers and maybe other stuff. You might have setup your system in a way which is not yet covered by the parsing code.
A question which arises from this:

  • What string do you get from Sanderling.MemoryMeasurement.Value.WindowInventory[0].SelectedRightInventoryCapacity.Text?

My regionale settings

image upload

Something like that: 4 289,0/5 000,0 m^3 (Look my firs post)

P.S. But changing the settings for the sake of the game is not the best solution

1 Like

Comparing the screenshot from your first post to this, it looks like the actual string did not make it through the forum software. Can you write it to a file in UTF-8 and post a link to that?

We already support many different formats for numbers, adapting the parsing code to add support for your formatting should be simple enough.

(Sanderling/Inventory.cs at a45bae2d067ebe05e5de285a860c39dd740fd7c3 · Arcitectus/Sanderling · GitHub)

Sure: capacity

I think, the line contains an extended space, like html &emsp

Ok this link worked for me to get the file. I assume having this file as an example will be sufficient to adapt the parsing code.

Here I am reposting the file I received for reference:
capacity.txt (25 Bytes)

I guess first step will be to add this example to the list of test cases which are automatically tested at Sanderling/Inventory.cs at 4d3c94f3c51ab6b714e76837fcc900090f00b454 · Arcitectus/Sanderling · GitHub

Done… I hope that soon the Sanderling will be able to adapt to any regional settings)

Thank you for the pull request, that was real quick.
However I am confused about your choice of version to base the change on. Why did you choose this particular commit as parent? Do you see a problem with the newer changes which have been added since then?

As far as the formatting goes, the process seems simple enough.

I’m new to git and I could have done something wrong if you mean it. Or I misunderstood you)[quote=“Viir, post:13, topic:264”]
As far as the formatting goes, the process seems simple enough.
[/quote]

By the way, I could easily parse the text file with an example, using the code that is shown in the 1 post, but can’t do here in the Sanderling.

I see. In this case, I will simply take the change you added and translate it to our main development branch (called “master” in the repository).
This translation will make the change end up in the product.

@Nisu, I adapted the code for parsing the inventory capacity gauge to also work with the sample you provided: Adapt the parsing of the inventory capacity gauge to work with the sa… · Arcitectus/Sanderling@67a692a · GitHub

Using that version, you should see the numbers in the API-Explorer.

1 Like

@Viir Mmm, I downloaded this version and found a couple of bugs

Anyway, have you changed only one line? I’m a bit discouraged… But it’s really worked.

I don’t understand. Why do you think there are bugs?
The screenshot looks like you are using some unsupported software to view this.
In case you are not familiar with the choice of tools, I recommend to use Visual Studio 2017 to open the solution file. (The free “Community” edition is sufficient)

Nope, I changed some more. See the commit history at https://github.com/Arcitectus/Sanderling/commits/master

I don’t understand, why discouraged, does it not work anymore?

Oh, I understand. I’m use VS 2015 now, and it does not want to compile this code. [quote=“Viir, post:18, topic:264”]
I don’t understand, why discouraged
[/quote]
Actually, I did this:

  1. I opened the version for 17.02.
  2. Changed one line “static readonly string CapacityGaugeUnitPattern =" (m | m) ³ ";
  3. Compiled the program.

But it’s work with some bugs, when I type a code in the Sanderling editor, I get exeptions like this. Although this exception should not relative to this.

1 Like

Yes, I saw the same problem with 2015, I solved it by switching to version 2017.

The file you linked shows this was an OutOfMemoryException. That happens when the program runs out of memory address space. I just checked here to see how much memory it actually neede.

Having the default mining script loaded in the IDE and typing (see the screenshot below), it used almost one GB. You should have at least as much free memory available when using the Sanderling IDE.