need some help with strings

cpulocksmith's Avatar, Join Date: Jul 2008
Skilled contributor
well ok, i need some help i am fairly sure this is a simple matter but i cannot figure it out. lets say i want to write a program that when i say look at the tree i will be givin a better discription of the tree. or what ever. i have some idea of what i would have to do for that. i have tried many things and they all seem to fail. if some one could please tell me how this can be done i would be vary happy. and the tree thing that is just an example...
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
Bit of a vague description but I guess you're thinking along the lines of adventure programs where you issue commands like "LOOK AT TREE" and the program prints a suitable description. Would that be correct?

If so all you need to do (!) is implement a command parser that takes user commands and works out what they mean, validates them against the current context (e.g. if there is no tree then it would print an error), then displays an appropriate description, which might be stored in static text somewhere, or might be kept in an indexed file.