In any case it would be easier to use an if-then *loop*. Instead of putting similar lines of code in your program for every individual command you could use the same single line of code for all commands. Here's an example in which first, the commands are read from data statements into objects. Then, the program reads your input and tests it against all commands in memory. It is a match when it matches as a whole, or when it matches the beginning of a command (and the first hit wins if more than one command has the same beginning; the directional commands are before the others in the data statement, so "e" will be read as "east" and not as "examine"). A special command is "quit" which ends the program. I would imagine that in a full game, the COMMAND object is extended to contain more information on the command, like the number of arguments it can handle ("get hammer", "put hammer in bag" (that's more complicated though with "in" inbetween arguments) etc.), or some internal representation of the command, like "move north" in the case of "north".
Const END_OF_DATA$ = "<end>"
; command type definition
Type COMMAND
Field f_word$
End Type
; function for checking if input matches command
Function COMMAND_matchInput(p_command.COMMAND,p_input$)
; get length of command
length = Len(p_command\f_word)
; check for smaller and smaller lengths if prefix of command matches input
For i = length To 1 Step -1
If (p_input = Left(p_command\f_word,i)) Then
Return(True)
End If
Next
Return(False)
End Function
; function for searching all commands for match with input
Function COMMAND_find.COMMAND(p_input$)
For command.COMMAND = Each COMMAND
If (COMMAND_matchInput(command,p_input)) Then
Return(command)
End If
Next
Return(Null)
End Function
; reset data reading to start of command data
Restore commandData
; read words and create corresponding command objects
Repeat
Read word$
If (word = END_OF_DATA) Then Exit
newCommand.COMMAND = New COMMAND
newCommand\f_word = word
Forever
; run game
Repeat
order$ = Input("> ")
If (order = "quit") Then Exit
command.COMMAND = COMMAND_find(order)
If (command = Null) Then
Print("I didn't understand the order ["+order+"]")
Else
Print("The command you used was ["+command\f_word+"]")
End If
Forever
; at end of game, delete command objects
Delete Each COMMAND
End
.commandData
Data "north","south","east","west","examine","talk","get","put","<end>"