Basic input would be interesting, I was wondering how I should catalog and reference commands...
Should I do a string of if statements, or store them in an array, list or dictionary?
My basic command structure should end up being something simple, such as '[action] [target]' like Attack Goblin, or Open Inventory, or Open Door. This seems simple enough. We can just take the input string and split it by a delimiter, such as a space or '>', so the input could look like 'attack>goblin', and then reference it with the list of commands and functions to call..
Typically this is done by parsing the input string and looking for keywords, such as "attack" which will perhaps fire an attack() method, and the second parameter says "goblin" so the method looks for a goblin near you and throws the dice to get the total damage done. You can get away with splitting the string and feeding the substrings into arrays and methods for simple commands, but once you get to more complicated syntax it gets messy quickly. Perhaps using a scripting language would be worthwhile when you reach that point.
My question is, what method to go about call the functions once the game realizes what command you have given...[/quote]
Scripting languages would solve this, but another method could be a huge switch case associating each main command with its function (or you could create a lookup table mapping command strings to the correct function pointers). There are many ways.
Oof, why does C++ make everything so complicated? Even something as simple as splitting a string is drawn out to an unreasonable extent... It makes me miss Java.[/quote]
Well, how do you think Java does it under the hood? It just hides all that stuff from you, but it doesn't mean it isn't there And if you are going to be working with strings alot, you may want to download a C++ string utility library (if the standard libraries are not sufficient), or you could write it yourself, so you'd have a little utility library with functions such as splitString(), parseDelimited(), etc...