Yanfly Item Core - Obtain Remaining Space

This is the script I'm referring to:


yanfly.moe/2015/10/16/yep-11-item-core/

I simply would like to know if there is a script call to obtain the amount of remaining space for the item inventory.


Example:


I set the item limit to 5. I have a Potion, Feather and Rock. The remaining space should be 2.
I want a script call that can evaluate that value to be 2.

I am aware I can total my inventory space and deduct from the limit myself:


  ◆Control Variables:#0029 Inventory Count = var totalInven = 0; for (i=1; i<135;i++) {totalInven += $gameParty.numItems($dataItems);}



But my items actually stack (or are obtained in stacks). So the above example can be: a Potion (x5), a Feather (x3) and a Rock (x10) [All independent items].
I think the loop counting method I have above would count that up to 18 total items (instead of 3) ~ whereas Yanfly's counts it up as a total of 3. So I am hoping there may be a way to deduct that 3 from the limit of 5 and get 2 (under Yanfly's coding).
Well I have the start to a work around without involving Yanfly's script...
 


◆Script:var count = 0;
: :
: :for (i=1; i<135;i++) {
: :if ($gameParty.hasItem($dataItems)) {
: :count+=1;
: :}
: :}
: :
: :$gameVariables.setValue(50, count);


This way it ignores the stacked extras. I just have to figure out a way to visually show the limit and/or remaining space in the item menu.
Still open to script calls for yanfly's script though! 

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-item-core-obtain-remaining-space.74310/