1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

need some help with strings

Discussion in 'C' started by cpulocksmith, Nov 21, 2008.

  1. cpulocksmith

    cpulocksmith New Member

    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...
     
  2. xpi0t0s

    xpi0t0s 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.
     

Share This Page