Do you have objects/sprites to display your inventory?
if so, set them visible when displaying the inventory and set them invisible when not displaying the inventory..
create a global variable inventory
on key i pressed
> system set variable inventory : 1-inventory
variable = 1
> set all objects that create the visual display of your inventory visible
variable = 0
> set all objects that create the visual display of your inventory invisible
The visual display could be sprites/tiled-backgrounds/text-objects etcetera
Now all you have to do, if you want to display the amount is set the text-objects to the variable number and you are ready..