Scripting help (sending messages?)

ok so i want to make an inventory for my game.

i want it to open when i press the mouse on the inventory picture so i added the script

function onMouseDown ()

i need the function to open the other picture of the bag grid

how would i be able to make this happen.

and if some one could tell me how to set up a grid that i can place clickable abjects too and how to make the clicked button to send a message to a receiver ex.

press robe - robe icon goes into the armor window - and gives the empty the message to add new object robe and destroy other object that was on there before (replace them)- and that send a message to stats saying to add more mana+ health +armor+spell power.

thank you

Try not to ask more than one question in a single post, and try not to ask such a broad question in the future. Regardless, I'll do my best to point you in the right direction.

First, you can create a grid of buttons using this function:

You can make it appear and disappear using a script like this (but not exactly this, don't copy and paste it):

bool inventoryVisible = false;

void OnMouseDown()
     inventoryVisible = !inventoryVisible;

void OnGUI()
          // GUI Selection Grid Code Here

I can't help you with sending messages to other scripts, simply because you have provided little to no detail about your specific setup, and since there are many different ways of calling functions of other objects, I can't be specific. I can, however, link you to this page, which describes in detail how to access other scripts on other game objects: