Index: code/branches/console/src/core/ArgumentCompletionFunctions.cc
===================================================================
--- code/branches/console/src/core/ArgumentCompletionFunctions.cc	(revision 1430)
+++ code/branches/console/src/core/ArgumentCompletionFunctions.cc	(revision 1434)
@@ -28,6 +28,12 @@
 
 #include <iostream>
+#include <map>
 
 #include "ArgumentCompletionFunctions.h"
+#include "CoreIncludes.h"
+#include "Identifier.h"
+#include "ConfigValueContainer.h"
+#include "TclThreadManager.h"
+#include "util/String.h"
 
 namespace orxonox
@@ -39,4 +45,50 @@
             return std::list<std::pair<std::string, std::string> >();
         }
+
+        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(configvalueclasses)()
+        {
+            std::list<std::pair<std::string, std::string> > classlist;
+
+            for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getIdentifierMapBegin(); it != Identifier::getIdentifierMapEnd(); ++it)
+                if ((*it).second->hasConfigValues())
+                    classlist.push_back(std::pair<std::string, std::string>(getLowercase((*it).first), (*it).second->getName()));
+
+            return classlist;
+        }
+
+        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(configvalues)(const std::string& classname)
+        {
+            std::list<std::pair<std::string, std::string> > configvalues;
+            std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getIdentifierMap().find(classname);
+
+            if (identifier != Identifier::getIdentifierMapEnd() && (*identifier).second->hasConfigValues())
+            {
+                for (std::map<std::string, ConfigValueContainer*>::const_iterator it = (*identifier).second->getConfigValueMapBegin(); it != (*identifier).second->getConfigValueMapEnd(); ++it)
+                    configvalues.push_back(std::pair<std::string, std::string>(getLowercase((*it).first), (*it).second->getName()));
+            }
+
+            return configvalues;
+        }
+
+        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(configvalue)(const std::string& varname, const std::string& classname)
+        {
+            std::list<std::pair<std::string, std::string> > oldvalue;
+            std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseIdentifierMap().find(getLowercase(classname));
+            if (identifier != Identifier::getLowercaseIdentifierMapEnd())
+            {
+                std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
+                if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
+                {
+                    std::string valuestring = (*variable).second->toString();
+                    oldvalue.push_back(std::pair<std::string, std::string>(valuestring, valuestring));
+                }
+            }
+            return oldvalue;
+        }
+
+        ARGUMENT_COMPLETION_FUNCTION_IMPLEMENTATION(tclthreads)()
+        {
+            return TclThreadManager::getInstance().getThreadList();
+        }
     }
 }
Index: code/branches/console/src/core/ArgumentCompletionFunctions.h
===================================================================
--- code/branches/console/src/core/ArgumentCompletionFunctions.h	(revision 1430)
+++ code/branches/console/src/core/ArgumentCompletionFunctions.h	(revision 1434)
@@ -50,4 +50,5 @@
     std::list<std::pair<std::string, std::string> > acf_##functionname
 
+
 namespace orxonox
 {
@@ -55,4 +56,8 @@
     {
         ARGUMENT_COMPLETION_FUNCTION_DECLARATION(fallback)();
+        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(configvalueclasses)();
+        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(configvalues)(const std::string& classname);
+        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(configvalue)(const std::string& varname, const std::string& classname);
+        ARGUMENT_COMPLETION_FUNCTION_DECLARATION(tclthreads)();
     }
 }
Index: code/branches/console/src/core/CommandEvaluation.cc
===================================================================
--- code/branches/console/src/core/CommandEvaluation.cc	(revision 1430)
+++ code/branches/console/src/core/CommandEvaluation.cc	(revision 1434)
@@ -30,4 +30,5 @@
 #include "ConsoleCommand.h"
 #include "Debug.h"
+#include "util/String.h"
 
 namespace orxonox
@@ -81,5 +82,5 @@
         }
 
-        if (!this->bCommandChanged_)
+        if (!this->bCommandChanged_ || removeTrailingWhitespaces(this->command_) == removeTrailingWhitespaces(this->originalCommand_))
         {
             COUT(4) << "CE_execute: " << this->command_ << "\n";
@@ -136,11 +137,10 @@
                         maxIndex -= 1;
                     std::string whitespace = "";
-                    if (this->function_->getParamCount() > (maxIndex + 1 - this->getStartindex()))
-                        whitespace = " ";
 
                     if (this->possibleArgument_ != "")
                     {
-                        maxIndex -= 1;
                         this->argument_ = this->possibleArgument_;
+                        if (this->function_->getParamCount() > (maxIndex + 1 - this->getStartindex()))
+                            whitespace = " ";
                     }
 
@@ -163,7 +163,10 @@
         {
             case CS_Uninitialized:
+std::cout << "hint: CS_Uninitialized" << std::endl;
                 break;
             case CS_Empty:
+std::cout << "hint: CS_Empty" << std::endl;
             case CS_ShortcutOrIdentifier:
+std::cout << "hint: CS_ShortcutOrIdentifier" << std::endl;
                 if (this->listOfPossibleFunctions_.size() == 0)
                     return CommandEvaluation::dump(this->listOfPossibleIdentifiers_);
@@ -174,8 +177,11 @@
                 break;
             case CS_Function:
+std::cout << "hint: CS_Function" << std::endl;
                 return CommandEvaluation::dump(this->listOfPossibleFunctions_);
                 break;
             case CS_ParamPreparation:
+std::cout << "hint: CS_ParamPreparation" << std::endl;
             case CS_Params:
+std::cout << "hint: CS_Params" << std::endl;
                 if (this->listOfPossibleArguments_.size() > 0)
                     return CommandEvaluation::dump(this->listOfPossibleArguments_);
@@ -183,8 +189,10 @@
                     return CommandEvaluation::dump(this->function_);
             case CS_Finished:
+std::cout << "hint: CS_Finished" << std::endl;
                 if (this->function_)
                     return CommandEvaluation::dump(this->function_);
                 break;
             case CS_Error:
+std::cout << "hint: CS_Error" << std::endl;
                 return this->errorMessage_;
                 break;
@@ -272,4 +280,17 @@
     }
 
+    std::string CommandEvaluation::dump(const std::list<std::pair<std::string, std::string> >& list)
+    {
+        std::string output = "";
+        for (std::list<std::pair<std::string, std::string> >::const_iterator it = list.begin(); it != list.end(); ++it)
+        {
+            if (it != list.begin())
+                output += " ";
+
+            output += (*it).second;
+        }
+        return output;
+    }
+
     std::string CommandEvaluation::dump(const ConsoleCommand* command)
     {
Index: code/branches/console/src/core/CommandEvaluation.h
===================================================================
--- code/branches/console/src/core/CommandEvaluation.h	(revision 1430)
+++ code/branches/console/src/core/CommandEvaluation.h	(revision 1434)
@@ -82,4 +82,5 @@
             unsigned int getStartindex() const;
             static std::string dump(const std::list<std::pair<const std::string*, const std::string*> >& list);
+            static std::string dump(const std::list<std::pair<std::string, std::string> >& list);
             static std::string dump(const ConsoleCommand* command);
 
@@ -95,5 +96,5 @@
             std::list<std::pair<const std::string*, const std::string*> > listOfPossibleIdentifiers_;
             std::list<std::pair<const std::string*, const std::string*> > listOfPossibleFunctions_;
-            std::list<std::pair<const std::string*, const std::string*> > listOfPossibleArguments_;
+            std::list<std::pair<std::string, std::string> > listOfPossibleArguments_;
 
             Identifier* functionclass_;
Index: code/branches/console/src/core/CommandExecutor.cc
===================================================================
--- code/branches/console/src/core/CommandExecutor.cc	(revision 1430)
+++ code/branches/console/src/core/CommandExecutor.cc	(revision 1434)
@@ -126,12 +126,17 @@
     void CommandExecutor::parseIfNeeded(const std::string& command)
     {
+std::cout << "parse if needed: command:      >" << command << "<" << std::endl;
+std::cout << "                 old original: >" << CommandExecutor::getEvaluation().originalCommand_ << "<" << std::endl;
+std::cout << "                 old modified: >" << CommandExecutor::getEvaluation().command_ << "<" << std::endl;
         if (CommandExecutor::getEvaluation().state_ == CS_Uninitialized)
         {
+std::cout << "parse if needed: parse!" << std::endl;
             CommandExecutor::parse(command);
         }
-        else if (CommandExecutor::getEvaluation().originalCommand_ != command)
+        else if (/*removeTrailingWhitespaces*/(CommandExecutor::getEvaluation().originalCommand_) != /*removeTrailingWhitespaces*/(command))
         {
             if (CommandExecutor::getEvaluation().command_ == command)
             {
+std::cout << "parse if needed: parse and set bNewCommand_ to false" << std::endl;
                 CommandExecutor::parse(command);
                 CommandExecutor::getEvaluation().bNewCommand_ = false;
@@ -139,7 +144,9 @@
             else
             {
+std::cout << "parse if needed: parse!" << std::endl;
                 CommandExecutor::parse(command);
             }
         }
+std::cout << "parse if needed: don't parse" << std::endl;
     }
 
@@ -156,4 +163,5 @@
         {
             case CS_Uninitialized:
+std::cout << "0: Uninitialized\n";
             {
                 // Impossible
@@ -161,4 +169,5 @@
             }
             case CS_Empty:
+std::cout << "0: Empty\n";
             {
                 if (CommandExecutor::argumentsGiven() == 0)
@@ -175,4 +184,5 @@
             }
             case CS_ShortcutOrIdentifier:
+std::cout << "0: ShortcutOrIdentifier\n";
             {
                 if (CommandExecutor::argumentsGiven() > 1)
@@ -191,4 +201,5 @@
                     else if (CommandExecutor::getEvaluation().functionclass_)
                     {
+std::cout << "MEP" << std::endl;
                         // It's a functionname
                         CommandExecutor::getEvaluation().state_ = CS_Function;
@@ -272,4 +283,5 @@
             }
             case CS_Function:
+std::cout << "0: Function\n";
             {
                 if (CommandExecutor::getEvaluation().functionclass_)
@@ -283,4 +295,5 @@
                         if (CommandExecutor::getEvaluation().function_)
                         {
+std::cout << "MEP2" << std::endl;
                             // It's a function
                             CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
@@ -377,5 +390,6 @@
 std::cout << "3_1\n";
                     // There is exactly one possible argument
-                    CommandExecutor::getEvaluation().argument_ = *(*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).second;
+                    CommandExecutor::getEvaluation().argument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).second;
+                    CommandExecutor::getEvaluation().possibleArgument_ = (*CommandExecutor::getEvaluation().listOfPossibleArguments_.begin()).second;
                     CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
                     return;
@@ -393,11 +407,18 @@
 std::cout << "3_3\n";
                     // There are several possibilities
-                    unsigned int argumentNumber = CommandExecutor::argumentsGiven() - 1;
-                    if (CommandExecutor::getEvaluation().functionclass_)
-                        argumentNumber -= 1;
-
+                    unsigned int argumentNumber = CommandExecutor::argumentsGiven();
+                    if (argumentNumber > 0)
+                        --argumentNumber;
+std::cout << "3_3_1\n";
+                    if (CommandExecutor::getEvaluation().functionclass_ && argumentNumber > 0)
+                        --argumentNumber;
+
+std::cout << "3_3_2\n";
                     CommandExecutor::getEvaluation().argument_ = CommandExecutor::getCommonBegin(CommandExecutor::getEvaluation().listOfPossibleArguments_);
+std::cout << "3_3_3\n";
                     CommandExecutor::getEvaluation().possibleArgument_ = CommandExecutor::getPossibleArgument(CommandExecutor::getLastArgument(), CommandExecutor::getEvaluation().function_, argumentNumber);
+std::cout << "3_3_4\n";
                     CommandExecutor::getEvaluation().state_ = CS_ParamPreparation;
+std::cout << "3_3_5\n";
                     return;
                 }
@@ -495,7 +516,7 @@
         for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it)
             if ((*it).first.find(lowercase) == 0 || fragment == "")
-                CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(std::pair<const std::string*, const std::string*>(&(*it).first, &(*it).second));
-
-        CommandExecutor::getEvaluation().listOfPossibleArguments_.sort(CommandExecutor::compareStringsInList);
+                CommandExecutor::getEvaluation().listOfPossibleArguments_.push_back(std::pair<std::string, std::string>((*it).first, (*it).second));
+
+        CommandExecutor::getEvaluation().listOfPossibleArguments_.sort(CommandExecutor::compareStringsInList2);
     }
 
@@ -530,12 +551,19 @@
     std::string CommandExecutor::getPossibleArgument(const std::string& name, ConsoleCommand* command, unsigned int param)
     {
+std::cout << "4_1\n";
         CommandExecutor::createArgumentCompletionList(command, param);
 
+std::cout << "4_2\n";
         std::string lowercase = getLowercase(name);
+std::cout << "4_3\n";
         for (std::list<std::pair<std::string, std::string> >::const_iterator it = command->getArgumentCompletionListBegin(); it != command->getArgumentCompletionListEnd(); ++it)
+        {
+std::cout << "4_4\n";
             if ((*it).first == lowercase)
                 return (*it).second;
-
-        return 0;
+        }
+
+std::cout << "4_5\n";
+        return "";
     }
 
@@ -599,7 +627,53 @@
     }
 
+    std::string CommandExecutor::getCommonBegin(const std::list<std::pair<std::string, std::string> >& list)
+    {
+        if (list.size() == 0)
+        {
+            return "";
+        }
+        else if (list.size() == 1)
+        {
+            return ((*list.begin()).first + " ");
+        }
+        else
+        {
+            std::string output = "";
+            for (unsigned int i = 0; true; i++)
+            {
+                char temp = 0;
+                for (std::list<std::pair<std::string, std::string> >::const_iterator it = list.begin(); it != list.end(); ++it)
+                {
+                    if ((*it).first.size() > i)
+                    {
+                        if (it == list.begin())
+                        {
+                            temp = (*it).first[i];
+                        }
+                        else
+                        {
+                            if (temp != (*it).first[i])
+                                return output;
+                        }
+                    }
+                    else
+                    {
+                        return output;
+                    }
+                }
+                output += temp;
+            }
+            return output;
+        }
+    }
+
     bool CommandExecutor::compareStringsInList(const std::pair<const std::string*, const std::string*>& first, const std::pair<const std::string*, const std::string*>& second)
     {
         return ((*first.first) < (*second.first));
     }
+
+    bool CommandExecutor::compareStringsInList2(const std::pair<std::string, std::string>& first, const std::pair<std::string, std::string>& second)
+    {
+        return (first.first < second.first);
+    }
 }
Index: code/branches/console/src/core/CommandExecutor.h
===================================================================
--- code/branches/console/src/core/CommandExecutor.h	(revision 1430)
+++ code/branches/console/src/core/CommandExecutor.h	(revision 1434)
@@ -95,5 +95,7 @@
             static void createArgumentCompletionList(ConsoleCommand* command, unsigned int param);
             static std::string getCommonBegin(const std::list<std::pair<const std::string*, const std::string*> >& list);
+            static std::string getCommonBegin(const std::list<std::pair<std::string, std::string> >& list);
             static bool compareStringsInList(const std::pair<const std::string*, const std::string*>& first, const std::pair<const std::string*, const std::string*>& second);
+            static bool compareStringsInList2(const std::pair<std::string, std::string>& first, const std::pair<std::string, std::string>& second);
 
 
Index: code/branches/console/src/core/ConfigFileManager.cc
===================================================================
--- code/branches/console/src/core/ConfigFileManager.cc	(revision 1430)
+++ code/branches/console/src/core/ConfigFileManager.cc	(revision 1434)
@@ -38,8 +38,44 @@
 namespace orxonox
 {
+    SetConsoleCommandShortcutExtern(config).setArgumentCompleter(0, autocompletion::configvalueclasses()).setArgumentCompleter(1, autocompletion::configvalues()).setArgumentCompleter(2, autocompletion::configvalue());
+    SetConsoleCommandShortcutExtern(tconfig);
     SetConsoleCommandShortcutExtern(reloadConfig);
     SetConsoleCommandShortcutExtern(cleanConfig);
     SetConsoleCommandShortcutExtern(loadSettings);
     SetConsoleCommandShortcutExtern(loadKeybindings);
+
+    bool config(const std::string& classname, const std::string& varname, const std::string& value)
+    {
+std::cout << "10a_1\n";
+        std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseIdentifierMap().find(getLowercase(classname));
+        if (identifier != Identifier::getLowercaseIdentifierMapEnd())
+        {
+std::cout << "10a_2\n";
+            std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
+            if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
+            {
+std::cout << "10a_3\n";
+                return (*variable).second->tset(value);
+            }
+        }
+        return false;
+    }
+
+    bool tconfig(const std::string& classname, const std::string& varname, const std::string& value)
+    {
+std::cout << "10b_1\n";
+        std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseIdentifierMap().find(getLowercase(classname));
+        if (identifier != Identifier::getLowercaseIdentifierMapEnd())
+        {
+std::cout << "10b_2\n";
+            std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname));
+            if (variable != (*identifier).second->getLowercaseConfigValueMapEnd())
+            {
+std::cout << "10b_3\n";
+                return (*variable).second->tset(value);
+            }
+        }
+        return false;
+    }
 
     void reloadConfig()
Index: code/branches/console/src/core/ConfigFileManager.h
===================================================================
--- code/branches/console/src/core/ConfigFileManager.h	(revision 1430)
+++ code/branches/console/src/core/ConfigFileManager.h	(revision 1434)
@@ -50,4 +50,6 @@
 
 
+    bool config(const std::string& classname, const std::string& varname, const std::string& value);
+    bool tconfig(const std::string& classname, const std::string& varname, const std::string& value);
     void reloadConfig();
     void saveConfig();
Index: code/branches/console/src/core/ConsoleCommand.cc
===================================================================
--- code/branches/console/src/core/ConsoleCommand.cc	(revision 1430)
+++ code/branches/console/src/core/ConsoleCommand.cc	(revision 1434)
@@ -41,5 +41,5 @@
     }
 
-    ConsoleCommand& ConsoleCommand::setArgumentCompletionList(unsigned int param, ArgumentCompleter* completer)
+    ConsoleCommand& ConsoleCommand::setArgumentCompleter(unsigned int param, ArgumentCompleter* completer)
     {
         if (param < 5)
@@ -52,4 +52,12 @@
     }
 
+    ArgumentCompleter* ConsoleCommand::getArgumentCompleter(unsigned int param) const
+    {
+        if (param < 5)
+            return this->argumentCompleter_[param];
+        else
+            return 0;
+    }
+
     void ConsoleCommand::createArgumentCompletionList(unsigned int param, const std::string& param1, const std::string& param2, const std::string& param3, const std::string& param4, const std::string& param5)
     {
Index: code/branches/console/src/core/ConsoleCommand.h
===================================================================
--- code/branches/console/src/core/ConsoleCommand.h	(revision 1430)
+++ code/branches/console/src/core/ConsoleCommand.h	(revision 1434)
@@ -100,5 +100,7 @@
                 { return this->accessLevel_; }
 
-            ConsoleCommand& setArgumentCompletionList(unsigned int param, ArgumentCompleter* completer);
+            ConsoleCommand& setArgumentCompleter(unsigned int param, ArgumentCompleter* completer);
+            ArgumentCompleter* getArgumentCompleter(unsigned int param) const;
+
             void createArgumentCompletionList(unsigned int param, const std::string& param1 = "", const std::string& param2 = "", const std::string& param3 = "", const std::string& param4 = "", const std::string& param5 = "");
             const std::list<std::pair<std::string, std::string> >& getArgumentCompletionList() const
Index: code/branches/console/src/core/TclThreadManager.cc
===================================================================
--- code/branches/console/src/core/TclThreadManager.cc	(revision 1430)
+++ code/branches/console/src/core/TclThreadManager.cc	(revision 1434)
@@ -48,13 +48,13 @@
 namespace orxonox
 {
-    SetConsoleCommandShortcutGeneric(tclexecute, createConsoleCommand(createFunctor(&TclThreadManager::execute), "tclexecute"));
-    SetConsoleCommandShortcutGeneric(tclquery,   createConsoleCommand(createFunctor(&TclThreadManager::query),   "tclquery"  ));
+    SetConsoleCommandShortcutGeneric(tclexecute, createConsoleCommand(createFunctor(&TclThreadManager::execute), "tclexecute")).setArgumentCompleter(0, autocompletion::tclthreads());
+    SetConsoleCommandShortcutGeneric(tclquery,   createConsoleCommand(createFunctor(&TclThreadManager::query),   "tclquery"  )).setArgumentCompleter(0, autocompletion::tclthreads());
     SetConsoleCommand(TclThreadManager, create,  false);
-    SetConsoleCommand(TclThreadManager, destroy, false);
-    SetConsoleCommand(TclThreadManager, execute, false);
-    SetConsoleCommand(TclThreadManager, query,   false);
+    SetConsoleCommand(TclThreadManager, destroy, false).setArgumentCompleter(0, autocompletion::tclthreads());
+    SetConsoleCommand(TclThreadManager, execute, false).setArgumentCompleter(0, autocompletion::tclthreads());
+    SetConsoleCommand(TclThreadManager, query,   false).setArgumentCompleter(0, autocompletion::tclthreads());
     SetConsoleCommand(TclThreadManager, status,  false);
-    SetConsoleCommand(TclThreadManager, dump,    false);
-    SetConsoleCommand(TclThreadManager, flush,   false);
+    SetConsoleCommand(TclThreadManager, dump,    false).setArgumentCompleter(0, autocompletion::tclthreads());
+    SetConsoleCommand(TclThreadManager, flush,   false).setArgumentCompleter(0, autocompletion::tclthreads());
 
     TclThreadManager* instance_tclthreadmanager = &TclThreadManager::getInstance();
@@ -632,4 +632,16 @@
     }
 
+    std::list<std::pair<std::string, std::string> > TclThreadManager::getThreadList() const
+    {
+        boost::mutex::scoped_lock bundles_lock(TclThreadManager::getInstance().bundlesMutex_);
+        std::list<std::pair<std::string, std::string> > threads;
+        for (std::map<unsigned int, TclInterpreterBundle*>::const_iterator it = this->interpreterBundles_.begin(); it != this->interpreterBundles_.end(); ++it)
+        {
+            std::string number = getConvertedValue<unsigned int, std::string>((*it).first);
+            threads.push_back(std::pair<std::string, std::string>(number, number));
+        }
+        return threads;
+    }
+
     void tclThread(TclInterpreterBundle* interpreterBundle, std::string command)
     {
Index: code/branches/console/src/core/TclThreadManager.h
===================================================================
--- code/branches/console/src/core/TclThreadManager.h	(revision 1430)
+++ code/branches/console/src/core/TclThreadManager.h	(revision 1434)
@@ -109,4 +109,6 @@
             virtual void tick(float dt);
 
+            std::list<std::pair<std::string, std::string> > getThreadList() const;
+
         private:
             TclThreadManager();
