It's easier for text adventures to just have one item array rather than one for the rooms and one for the player. The items location can both be used to track what room number the item is (locations = 1 to 999) and if the item is actually being held by the player (location = 1000). A location of zero is an item that no longer exists.
Data structure:
-> Item Data ITEM.TXT
0 (object location) -objectnumber of container (if this object is in another object)
1 (Can be Moved?) 0=no 1=yes (0 Items are not shown on the floor)
2 (Object Weight)
3 (Wearable?) 0=No 1=Yes but not worn 2=Yes and worn
4 (Container?) 0=No 1=Yes and closed 2=Yes and opened
5 (Container Weight Limit)
6 (Current Weight of items inside)
7 (Can item produce light? 0=No 1=Yes but off 2=Yes and is on 3=Yes but spent
8 (Number of turns the item can produce light) -1 = Unlimited
(ITEM NAME... THE TEXT IT WILL RECOGNIZE)
(text for inventory viewing)
(text for item on floor in room)
(text for looking at the item) Up to 5 lines.
Data:
5 1 1 1 0 0 0 2 200
HARDHAT
a hardhat
A miners hardhat is on the ground.
This is a typical hardhat used by miners. It has a flashlight on the top of the hat. It seems like it's been used a lot so it might not have very much juice left in the battery.
When you check for inventory all you need is a FOR/NEXT loop to look at the item array and look at each item with a location of 1000 (or whatever number you choose for the players inventory).