Index: /trunk/src/lib/script_engine/script.cc
===================================================================
--- /trunk/src/lib/script_engine/script.cc	(revision 10380)
+++ /trunk/src/lib/script_engine/script.cc	(revision 10381)
@@ -111,5 +111,5 @@
    if(currentFile.length() != 0)
    {
-     printf("SCRIPT %s : ERROR: Could not load %s because an other file is already loaded: %s\n",currentFile.c_str(),filename.c_str(), currentFile.c_str());
+     printf("ERROR IN SCRIPT %s :   Could not load %s because an other file is already loaded: %s\n",currentFile.c_str(),filename.c_str(), currentFile.c_str());
      return false;
     }
@@ -119,5 +119,5 @@
    if(error == 0)
    {
-     currentFile = filename;
+     currentFile = file;
      error = lua_pcall(luaState, 0, 0, 0);
 
@@ -128,5 +128,4 @@
      else
      {
-       printf("SCRIPT %s : ERROR: while loading file %s: \n",currentFile.c_str(),filename.c_str());
        reportError(error);
      }
@@ -135,9 +134,8 @@
    else
    {
-     printf("SCRIPT %s : ERROR: while loading file %s: \n",currentFile.c_str(),filename.c_str());
      reportError(error);
    }
 
-   printf("SCRIPT : ERROR: while loading file %s \n",filename.c_str());
+   printf("ERROR IN SCRIPT:  Could not load file %s \n",filename.c_str());
    return false;
  }
@@ -166,8 +164,33 @@
         tmpObj.name = objectName;
         registeredObjects.push_back(tmpObj);
-     }
-   }
- }
-
+        return;
+     }
+   }
+   printf("ERROR IN SCRIPT %s: Could not add %s of class %s\n",this->currentFile.c_str(),objectName.c_str(),className.c_str());
+ }
+
+
+void Script::addObjectAsName( const std::string& className, const std::string& objectName, const std::string& nameInScript)
+ {
+   ScriptClass* scriptClass = ScriptClass::objectList().getObject(className);
+   WorldObject tmpObj;
+   if (scriptClass != NULL)
+   {
+     tmpObj.type = className;
+     if( !classIsRegistered(className) )
+     {
+       scriptClass->registerClass(this);
+     }
+     BaseObject* object = ObjectListBase::getBaseObject(className, objectName);
+     if (object != NULL && !objectIsAdded(objectName))
+     {
+        scriptClass->insertObject(this, object,nameInScript, false);
+        tmpObj.name = objectName;
+        registeredObjects.push_back(tmpObj);
+        return;
+     }
+   }
+   printf("ERROR IN SCRIPT %s: Could not add %s of class %s\n",this->currentFile.c_str(),objectName.c_str(),className.c_str());
+ }
 
 
@@ -208,5 +231,5 @@
    }
    else
-     printf("SCRIPT %s : ERROR: There is an other function active ( %s ) or there are unremoved return values on the stack. Please remove them first.\n",currentFile.c_str(),currentFunction.c_str());
+     printf("ERROR IN SCRIPT %s :   There is an other function active ( %s ) or there are unremoved return values on the stack. Please remove them first.\n",currentFile.c_str(),currentFunction.c_str());
    return false;
  }
@@ -235,5 +258,5 @@
    }
    else
-     PRINTF(1)("SCRIPT '%s' : no function selected.\n",currentFile.c_str());
+     PRINTF(1)("SCRIPT '%s' : No function selected.\n",currentFile.c_str());
 
    return false;
@@ -252,5 +275,5 @@
    else
    {
-     printf("SCRIPT %s : ERROR: Couldn't add parameter because the wrong function is selected: %s instead of %s\n",currentFile.c_str(), currentFunction.c_str(), toFunction.c_str());
+     printf("ERROR IN SCRIPT %s :   Couldn't add parameter because the wrong function is selected: %s instead of %s\n",currentFile.c_str(), currentFunction.c_str(), toFunction.c_str());
     return false;
    }
@@ -269,5 +292,5 @@
    else
    {
-     printf("SCRIPT %s : ERROR: Couldn't add parameter because the wrong function is selected: %s instead of %s\n",currentFile.c_str(), currentFunction.c_str(), toFunction.c_str());
+     printf("ERROR IN SCRIPT %s :   Couldn't add parameter because the wrong function is selected: %s instead of %s\n",currentFile.c_str(), currentFunction.c_str(), toFunction.c_str());
      return false;
    }
@@ -285,5 +308,5 @@
    else
    {
-     printf("SCRIPT %s : ERROR: Couldn't add parameter because the wrong function is selected: %s instead of %s\n",currentFile.c_str(), currentFunction.c_str(), toFunction.c_str());
+     printf("ERROR IN SCRIPT %s :  Couldn't add parameter because the wrong function is selected: %s instead of %s\n",currentFile.c_str(), currentFunction.c_str(), toFunction.c_str());
      return false;
    }
@@ -320,5 +343,5 @@
      }
      else
-       printf("SCRIPT %s : ERROR: Trying to retreive non bolean value\n",this->currentFile.c_str());
+       printf("ERROR IN SCRIPT %s :  Trying to retreive non bolean value\n",this->currentFile.c_str());
    }
    return returnValue;
@@ -373,5 +396,5 @@
   const char *msg = lua_tostring(luaState, -1);
   if (msg == NULL) msg = "(error with no message)\n";
-  printf("ERROR: %s\n", msg);
+  printf("ERROR IN SCRIPT %s : %s\n",currentFile.c_str(), msg);
   lua_pop(luaState, 1);
  }
Index: /trunk/src/lib/script_engine/script.h
===================================================================
--- /trunk/src/lib/script_engine/script.h	(revision 10380)
+++ /trunk/src/lib/script_engine/script.h	(revision 10381)
@@ -34,4 +34,5 @@
     bool loadFile(const std::string& filename);
     void addObject( const std::string& className,const std::string& objectName);
+    void addObjectAsName( const std::string& className,const std::string& objectName, const std::string& nameInScript);
     void registerClass(const std::string& className);                           //!< Register a class but dont add any instances
 
Index: /trunk/src/lib/script_engine/script_class.cc
===================================================================
--- /trunk/src/lib/script_engine/script_class.cc	(revision 10380)
+++ /trunk/src/lib/script_engine/script_class.cc	(revision 10381)
@@ -25,4 +25,5 @@
 CREATE_SCRIPTABLE_CLASS(Script,
                     addMethod("addObject", Executor2<Script, lua_State*,const std::string&, const std::string& >(&Script::addObject))
+ 		    ->addMethod("addObjectAsName", Executor3<Script, lua_State*,const std::string&, const std::string&, const std::string& >(&Script::addObjectAsName))
                     ->addMethod("registerClass", Executor1<Script, lua_State*,const std::string&>(&Script::registerClass))
                     ->addMethod("selectFunction", Executor2ret<Script, lua_State*, bool, const std::string&, int >(&Script::selectFunction))
Index: /trunk/src/world_entities/script_trigger.cc
===================================================================
--- /trunk/src/world_entities/script_trigger.cc	(revision 10380)
+++ /trunk/src/world_entities/script_trigger.cc	(revision 10381)
@@ -148,5 +148,5 @@
   else
   {
-    PRINTF(2)("Target %s for %s::%s does not Exist\n", target.c_str(), this->getClassCName(), this->getCName());
+    PRINTF(2)("ERROR SCRTIPTTRIGGER : Target %s for %s::%s does not Exist\n", target.c_str(), this->getClassCName(), this->getCName());
   }
 }
@@ -167,5 +167,5 @@
   else
   {
-    PRINTF(2)("Parent %s for %s::%s does not Exist\n", parent.c_str(), this->getClassCName(), this->getCName());
+    PRINTF(2)("ERROR SCRTIPTTRIGGER : Parent %s for %s::%s does not Exist\n", parent.c_str(), this->getClassCName(), this->getCName());
   }
 }
@@ -213,13 +213,15 @@
        //testScriptingFramework();
     if(!(script->selectFunction(this->functionName,returnCount)) )
-      PRINT(1)("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
+      PRINT(1)("ERROR SCRTIPTTRIGGER : Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
 
     script->pushParam( timestep, this->functionName);
 
     if( !(script->executeFunction()) )
-      PRINT(1)("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
+      PRINT(1)("ERROR SCRTIPTTRIGGER : Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
 
     scriptFinished = script->getReturnedBool();
   }
+  else
+  printf("ERROR SCRTIPTTRIGGER : Script could not be executed !\n");
 
 
@@ -238,4 +240,6 @@
       scriptIsOk = true;
     }
+    else
+    printf("ERROR SCRTIPTTRIGGER : Could not find the wrapperobject of %s , the script won't be executed ! \n", file.c_str());
   }
 }
