Beat-em-up RPG, I like the sound of that

Ever played River City Ransom?
About the slot 18 error, it's because slot 18 is actually inventory[17], because the array was initialized from 0-17, so 'Slot 18' in the game is actually inventory[17]. This can get tricky with data in RPGs, but just try to stick with it...
So, I avoided this in my first post just to see how you received that info I gave you.... But basically you NEED to get rid of the global.item18 = true structure to really get the flexibility and power... And for the other issues you had, you need another array, an array of ITEMS to go in your INVENTORY.
So, you have inventory array:
inventory[0] = -1;
inventory[1] = -1;
inventory[2] = -1;
...
inventory[17] = -1;
(I changed it from 0 to -1 to mean an empty slot... it will make sense eventually...)
Now you make a 2-dimensional 'item' array:
// ITEM 1 IS A SMALL HEALTH PACK
item[0,0] = "Small Health Pack" // string for the name
item[0,1] = "A small health pack that heals a small amount of health." // string for description
item[0,2] = 10; // amount of Health the health pack heals
item[0,3] = obj_small_healthPack; this is the object that the item is in the game
// ITEM 2 IS A LARGE HEALTH PACK
item[1,0] = "Large Health Pack";
item[1,1] = "A large health pack that heals a large amount of health."
item[1,2] = 25;
item[1,3] = obj_small_healthPack;
// AS MANY ITEMS AS YOU WANT, ETC...
Still with me? Ok, now hopefully you'll see how it comes together:
So to store a Large health pack in inventory slot 15, you go like this:
inventory[14] = 1;
Inventory slot (15-1) gets you the right spot in the inventory array, and the value 1 is the index for the large health pack in the item array.
So, as you're moving around your inventory screen, you have the selectedSlot variable that stores which slot you're on, which then can get the index for what item is in which slot:
inventory[selectedSlot] = the item index for what is in that slot... So it can either be empty (-1), or contain a small health pack (0) or a large health pack (1). So, for the displaying text part, you go:
var itemID;
itemID = inventory[selectedSlot];
draw_text(x, y, item[itemID, 0]); // Writes the string for the name
draw_text(x, y, item[itemID, 1]); // Writes the string for the description
For the item array, you can store all sorts of item info in there... For example the sprite to use to draw it, the price of it, how much it weighs, whatever information you want your items to have. You can then access that information whenever you need it with the item[x,y].
Phew! A lot longer than I thought... But hopefully that shows you roughly how an inventory/item system might work...