Here's how I do it (there may be different/better ways). Reference the entire inventory, then update based on the index of the item in the inventory using the constant defined for the inventory item in game.sh.
To set the value:
((gInv at: INV_TEST_OBJECT) count: 3)
To get the value:
(FormatPrint "count = %d" ((gInv at: INV_TEST_OBJECT) count?))