Using the inventory


To be able to use an item we need to see it in an Inventory . If you downloaded and use a taskbar you should see your item already. If you chose the mouseicon style we have to create an inventory first.

Create a room called "anywhere" ,go to the Project setup and enter this name to the field anywhere-room. Into this room we need to add an object which will open our inventory, for example a chest icon. Place this object near a border of the anywhere room. You should be able to see this object in your game no matter what room is currently loaded.

Write into the script of the object:

on (mouse)
 showinfo (Open Inventory ; true)

on (click)
 subroom (inventory)

Subroom is a room that will be rendered above the normal room. So create yet another room called "Inventory". Activate the  Inventoryfield Mode and draw an inventory field into the room. This field does not need any images but if you want you can use a transparent backgroundimage.

For scrolling up and down in our inventory we need to add additional buttons... Arrows for example. Add this to their scripts :

on (click)
 invup (number)     or   invdown (number)

The number should be the number of inventoryslots per row. To close a subroom use the command return() which you can put into another objects script (exit button).