Hey All,
I have been working on a Text Adventure lately. Everything is working so far, the coodinate system, item locations, etc. However, the parser needs some help.
Here's the code I used to test this.
DIM Object$(2)
DIM Object$(1)="BEAST"
DIM Object$(2)="TORCH"
DIM Verb$(2)
DIM Verb$(1)="FIGHT"
DIM Verb$(2)="LIGHT"
Do
Input C$
PsVerb$=Left$(C$,5)
PsObject$=Right$(C$,5)
For V = 1 To 2
If PsVerb$=Verb$(V)
VerbFound=1
V$=Verb$(V)
Endif
Next V
For O = 1 to 2
If PsObject$=Object$(O)
ObjectFound=1
O$=Object$(O)
Endif
Next O
IF VerbFound=1 and ObjectFound=1
Print "Command Matched"
Print V$ : Print O$
Else
Print "Command Failed"
Print PsVerb$ : Print PsObject$
Endif
Loop
Wait Key
End
It divides the words into the verb and object just fine, since it prints those on the bottom. The only problem might be that it cannot match them with the words in the array.
Thanks in advance,