Yes, you will have to search the inventory array. Of course, it's better if you represent your items with numbers instead, like scissors is 1, rock is 2, etc.
So, you would have something like:
MAXITEMS = 20
ID_NOITEM = 0
ID_SCISSORS = 1
ID_ROCK = 2
ID_PAPER = 3
dim items(MAXITEMS)
`Somewhere in the game loop...
if command$ = "get scissors"
for t = 1 to MAXITEMS
if items(t) = ID_NOITEM
`We found an empty slot where the item can be stored
items(t) = ID_SCISSORS
print "You have taken the scissors"
exit
endif
next t
`Optional, if you want to limit how much the person can carry
if t = MAXITEMS
print "You do not have space for that item"
endif
endif
if command$ = "use scissors"
itemfound = 0
for t = 1 to MAXITEMS
if items(t) = ID_SCISSORS
itemfound = 1
`Optional, if you want to delete the item from the slot
items(t) = ID_NOITEM
exit
endif
next t
if itemfound=1
print "You have successfully used the scissors"
print "Scissors are no longer useful and has been discarded"
else
print "You do not have that item"
endif
endif
That's how the framework might go, and with some fixing you can put them in functions to make it easier on yourself. Of course, there is another, more hard-coded way of doing it...
NUMITEMS = 3
dim items(NUMITEMS)
ID_SCISSORS = 1
ID_ROCK = 2
ID_PAPER = 3
if command$ = "get scissors"
items(ID_SCISSORS) = 1
endif
if command$ = "use scissors"
if items(ID_SCISSORS) = 1
print "You have used the scissors.
print "discarding..."
items(ID_SCISSORS) = 0
else
print "You don't have scissors"
endif
endif
Since text based games are usually scripted very strictly, the second one is more efficient. But the first one can be used if you want to print the items that the person has in the order which they were acquired. I typed this right here so I'm unsure about the code, but you get the idea.