text based game
okay... I dont know how many of you have played a MUD but it a Text Based MMORPG (Massive Multiplayer Online Role Playing Game) there is tons of code for it... I dont want to code one right off I was jsut going to try and play with some different codes to learn how to do it but the reason I tell you this is because your character in a MUD is command driven like you type in "look" and a description of the room is displayed.. what would the code be to obtain a string from the keyboard then test it to see what to pull up?
thanx but I know that... was wondering if some one could give me the code to:
get char input
test if command in command lib (or something similar)
do what is needed
hey I'm trying to do the same thing. but it sounds like you're probably at the point in your knowledge of the c++ language as i was about a year ago. i'm making a text based game right now, and i'm maybe 1/4 of the way through it. i think you'd be much better off figuring out that code on your own because
1. That's pretty simple code to figure out, and if you understand string input and string comparison, you should have no problem at all.
2. If you can't figure out that part, which probably isn't the first thing you should be worrying about, then you certainly will not be able to figure out how to create the map/location system. or the item system. or pretty much any of the other main parts of a program like this.
so just to save you a lot of trouble, i'd really recommend learning how to program the stuff you're gonna need for the game before you actually start trying to make the game. otherwise you might end up like i did a while ago, having half a game that kinda worked, but the code was sloppy and it wasn't really possible to do much with it from there, and plus my game didn't do what i originally had intended. it's discouraging not being able to finish a game because you don't understand how to implement a feature, such as what you're asking, geting input and executing the proper code based on the input.
having said all that, you should be able to get to that point fairly soon, just study strings, study input (especially of strings) and input functions, study how to create and use functions, arrays are easy to learn (if you don't know them already), and then probably just learn some stuff about structures and classes, which are pretty similar. obviously the more you know the easier it would be to do what you want to do and make code. but i think that's pretty much all you'd need to know to do what you want to do. at least for right now. good luck..
and hey, try to write the code for what you're asking, even if you can't get it to work, and post it. then people would be much more willing to help you out and explain how to do things.
Since no one has linked to it yet, here is the tutorial on strings, in case you couldn't find it yourself.
Let me ask you this:
Given a number how would you determine if it was in a container of numbers?