gZany Ok, @gZany, a little help here for function parsing, because your code is rather messy:
Create a dictionary, in which keywords lead to functions, for example:
{
"hello": function(args){
writeOnScreen("world"+args.join(" ")) //whatever your "write on screen" function is
}
}
Here, you are setting up a command, which can be accessed by typing "hello." It can be followed by a space and literally anything. The function that "hello" leads to will decide what to do.
In your enterInput (or whatever it is called) function is, that activates when the ENTER key is pressed, and sees what to do:
NOTE: currentInput is what the user is typing
inputArray = currentInput.split(" ");
try{
functionsDictionary[inputArray.pop()](inputArray)
}catch(o){
writeOnScreen("Error encountered. Error code: \n"+o)
}