MV show variable value on inventory

Hello everyone.

I would like if someone can please make a small plugin that shows the value of a variable in the inventory (items tab). (MV)

View this picture:

variable on inventory.png



I want to display the value of a particular variable because that variable stores the number of slots available in the inventory, which expands as you progress through the game.

I hope you can help me, thanks in advance.
And how are you planning on that working if you have enough items in inventory that the items overlap the text?
And how are you planning on that working if you have enough items in inventory that the items overlap the text?

oh, yes, I made a mistake in the position of the text.

It is better that this variable be seen at the top, before the description of the object, (or after), in the same way I will make sure that it is seen in a place that does not get in the way by moving the positions.
Can anyone really help me? how difficult is this plugin?
Can anyone really help me? how difficult is this plugin?
The problem is your solution hasn't really solved the problem. If you put it in the help window it's still going to end up overlapping with the help text. The default UI doesn't really provide a space you could safely put this, so if you want it you're going to have to think of a redesign.
The problem is your solution hasn't really solved the problem. If you put it in the help window it's still going to end up overlapping with the help text. The default UI doesn't really provide a space you could safely put this, so if you want it you're going to have to think of a redesign.

In this plugin the author shows the inventory capacity below it, without covering the items info.

inventory limit.png


the difference is that I only want to display one variable, not two.
In this plugin the author shows the inventory capacity below it, without covering the items info.

View attachment 247934

the difference is that I only want to display one variable, not two.
Yeah, because that plugin reduces the height of the item list to make room, which your request didn't do. If that's what you want it shouldn't be difficult.
Yeah, because that plugin reduces the height of the item list to make room, which your request didn't do. If that's what you want it shouldn't be difficult.

oh, if you can help me with that I would really appreciate it.
it could be modified, but the amount of slots of items as fixed number
is one way, but 2 is to see how many slots are left (usefull if you have
a max limit of 30) so you dont need to count the items.

than is the item stackable for not counting each item of the same,
or does that count too?

as this should be taken into account.
it could be modified, but the amount of slots of items as fixed number
is one way, but 2 is to see how many slots are left (usefull if you have
a max limit of 30) so you dont need to count the items.

than is the item stackable for not counting each item of the same,
or does that count too?

as this should be taken into account.

don't worry about it, I just want to show the maximum capacity of the inventory.

is a variable (variable 19) and stores the maximum capacity. During the game, that maximum capacity can be expanded by obtaining some backpacks. But I only want to display that variable, nothing else. It is very simple.
so far I get what you want:

you want variable 19 = different item count (so if 10) not more than
10 different items can be carried?

if so, it should be easy to make or modify the plugin you linked to
remove the first number out of it. which is maybe the easiest way.

but I dont know if you want the notetag as well to control that setting.
so far I get what you want:

you want variable 19 = different item count (so if 10) not more than
10 different items can be carried?

if so, it should be easy to make or modify the plugin you linked to
remove the first number out of it. which is maybe the easiest way.

but I dont know if you want the notetag as well to control that setting.

I think you are not understanding me.

There are two pieces of information that are handled in all inventory games:

1. free space (available slots)
2. maximum inventory capacity.

I don't want to show the free space, just the maximum capacity of the inventory.

Example: In my game you start with a maximum capacity of 10 items.

Don't worry about doing the operations of slots, items, all that is already done by a plugin that I have.

The plugin that I am asking for is not operational, it is visual.

I am only interested in showing below the inventory:


Maximum Capacity: \V[19]

Nothing more. ☺️
Don't worry about doing the operations of slots, items, all that is already done by a plugin that I have
what plugin is that?
because it might easier to impliment it there or a small patch for compatible with it.
so we can do exactly what you want it to be.

adding a variable with that is easy to add, but if we know the name, we can
alter/patching it for you for adding it. (by parameter or by hardcoding).
what plugin is that?
because it might easier to impliment it there or a small patch for compatible with it.
so we can do exactly what you want it to be.

adding a variable with that is easy to add, but if we know the name, we can
alter/patching it for you for adding it. (by parameter or by hardcoding).
I don't know why you want to complicate the life.

The inventory plugin I'm using is this: link.

It is the pro version, it is very complex and also I am not using its visual part, only its operational part. The visual part is the inventory that is predetermined by rpg maker.

I use the operational part of this plugin to control the number of slots available in the inventory (for example: 4 identical items occupy 1 slot).

But I repeat, don't complicate the life. The operational part is already done by that plugin. All I need is for you to show a particular variable below the inventory, just that. Don't worry about the operational part, just give me please a plugin that shows a box and the variable 19 to show its value and that's it, nothing more.
I dont complicate the life, as if it's working differently or not on the plugin
you use, but KageDesu plugin is very high quality plugin, and I dont get his
plugin though.

it's more the setup to make it compitable with each other, as one can alias it,
other make it from scratch, and function could be the same, or very different
to work with their own plugins.
This seems to work for me with no other plugins active (save as inventoryVar.js):
Spoiler: plugin code
JavaScript:
// =============== //
// inventoryVar.js //
// =============== //

/*:
 * @target MV
 * @plugindesc Adds a variable display window to the bottom of the item scene.
 * @author Caethyril
 * @help Free to use and/or modify for any project, no credit required.
 * 
 * @param Variable ID
 * @type variable
 * @desc The value of this variable will be displayed.
 * @default 0
 * 
 * @param Display Format
 * @type text
 * @desc Determines how the variable is displayed. Use %1 for the variable value. Text codes permitted.
 * @default Variable: %1
 */

;void (function() {
'use strict';
    var PLUGIN_NAME = 'inventoryVar';
    var PARAMS = PluginManager.parameters(PLUGIN_NAME)
    if (!PARAMS)
        throw new ReferenceError(
            PLUGIN_NAME + '.js cannot find its parameters!' +
            '\nMake sure the plugin file is named correctly and try again.'
        );
    var V = Math.max(parseInt(PARAMS['Variable ID'], 10) || 0, 0);
    var F = PARAMS['Display Format'];

// New window //

    var W = window.Window_InventoryVarDisplay = function() {
        this.initialize.apply(this, arguments);
    };
    var S = Window_Base.prototype;
    var P = W.prototype = Object.create(S);
    P.constructor = W;

    P.windowWidth = function() {
        return Graphics.boxWidth;
    };

    P.windowHeight = function() {
        return this.fittingHeight(1);
    };

    P.initialize = function(x, y) {
        S.initialize.call(this, x, y, this.windowWidth(), this.windowHeight());
    };

    P.value = function() {
        return $gameVariables.value(V);
    };

    P.displayText = function() {
        return F.format(this.value());
    };

    P.refresh = function() {
        this.contents.clear();
        this.drawTextEx(this.displayText(), this.textPadding(), 0);
        this._cachedValue = this.value();
    };

    P.update = function() {
        if (this.value() !== this._cachedValue)
            this.refresh();
    };

// Patch scene //

    void (function(alias) {
        Scene_Item.prototype.create = function() {
            alias.apply(this, arguments);
            var wv = this._inventoryVarDisplayWindow = new W(0, 0);
            wv.y = Graphics.boxHeight - wv.height;
            this._itemWindow.height -= wv.height;
            this._itemWindow.createContents();
            this._itemWindow.refresh();
            this.addWindow(wv);
        };
    })(Scene_Item.prototype.create);

})();
If that doesn't work for you, then like ShadowDragon has been saying, you may well need something compatible with the plugins that you are using. In that case, people will need to know what those plugins are.
This seems to work for me with no other plugins active (save as inventoryVar.js):
Spoiler: plugin code
JavaScript:
// =============== //
// inventoryVar.js //
// =============== //

/*:
 * @target MV
 * @plugindesc Adds a variable display window to the bottom of the item scene.
 * @author Caethyril
 * @help Free to use and/or modify for any project, no credit required.
 *
 * @param Variable ID
 * @type variable
 * @desc The value of this variable will be displayed.
 * @default 0
 *
 * @param Display Format
 * @type text
 * @desc Determines how the variable is displayed. Use %1 for the variable value. Text codes permitted.
 * @default Variable: %1
 */

;void (function() {
'use strict';
    var PLUGIN_NAME = 'inventoryVar';
    var PARAMS = PluginManager.parameters(PLUGIN_NAME)
    if (!PARAMS)
        throw new ReferenceError(
            PLUGIN_NAME + '.js cannot find its parameters!' +
            '\nMake sure the plugin file is named correctly and try again.'
        );
    var V = Math.max(parseInt(PARAMS['Variable ID'], 10) || 0, 0);
    var F = PARAMS['Display Format'];

// New window //

    var W = window.Window_InventoryVarDisplay = function() {
        this.initialize.apply(this, arguments);
    };
    var S = Window_Base.prototype;
    var P = W.prototype = Object.create(S);
    P.constructor = W;

    P.windowWidth = function() {
        return Graphics.boxWidth;
    };

    P.windowHeight = function() {
        return this.fittingHeight(1);
    };

    P.initialize = function(x, y) {
        S.initialize.call(this, x, y, this.windowWidth(), this.windowHeight());
    };

    P.value = function() {
        return $gameVariables.value(V);
    };

    P.displayText = function() {
        return F.format(this.value());
    };

    P.refresh = function() {
        this.contents.clear();
        this.drawTextEx(this.displayText(), this.textPadding(), 0);
        this._cachedValue = this.value();
    };

    P.update = function() {
        if (this.value() !== this._cachedValue)
            this.refresh();
    };

// Patch scene //

    void (function(alias) {
        Scene_Item.prototype.create = function() {
            alias.apply(this, arguments);
            var wv = this._inventoryVarDisplayWindow = new W(0, 0);
            wv.y = Graphics.boxHeight - wv.height;
            this._itemWindow.height -= wv.height;
            this._itemWindow.createContents();
            this._itemWindow.refresh();
            this.addWindow(wv);
        };
    })(Scene_Item.prototype.create);

})();
If that doesn't work for you, then like ShadowDragon has been saying, you may well need something compatible with the plugins that you are using. In that case, people will need to know what those plugins are.
works great thank you. But I want to modify the width of the box and the name of the variable, so that it says: "Inventory:", do you know how I can do it?

Thank you
works great thank you. But I want to modify the width of the box and the name of the variable, so that it says: "Inventory:", do you know how I can do it?
Didn't caethyril provide that as a plugin parameter for you? Where it says "Display Format, default Variable: %1" you'd change the word Variable to Inventory?
Didn't caethyril provide that as a plugin parameter for you? Where it says "Display Format, default Variable: %1" you'd change the word Variable to Inventory?

Oh yes I saw it, sorry, I just need to change the width.
To change its width you can edit this part of the plugin code:
JavaScript:
    P.windowWidth = function() {
        return Graphics.boxWidth;
    };
It's currently Graphics.boxWidth, i.e. the width of the game screen.

[Edit: e.g. Graphics.boxWidth / 2 would be half the screen width.]

Original thread: https://forums.rpgmakerweb.com/threads/show-variable-value-on-inventory.153275/