I would like to create a variable whose value is always equal to the amount of a specific item that is in the player's inventory.
How would I be able to go about doing this?
$gameParty._items[X]
Create a control variable content, select the variable you want, and put the above in the script colume.
X being the item ID.
For the 'always' part in your request, the only way I can think of, with out using a plugin, is to set up an parallel common event to continues update the value.
Which I do not recommond.
A nonstop parallel common event may cause your project to lag.
I do recommond to update the value just right before the events need it.
Absolutely no need for a script, just use the default options of control variable.
If you go into "game data" (the one which defaults to map ID) you can select which item to check and get how many the player has in inventory.
That way you can also check for equipment which would need different scripts if done by script
This command has to be repeated whenever you actually need that info, there is no good way to link "always", but then it should be enough to just update whenever needed.