Index: trunk/src/lib/script_engine/script.cc
===================================================================
--- trunk/src/lib/script_engine/script.cc	(revision 9235)
+++ trunk/src/lib/script_engine/script.cc	(revision 9298)
@@ -17,5 +17,5 @@
 #include "script_class.h"
 #include "luaincl.h"
-
+#include "debug.h"
 #include "util/loading/resource_manager.h"
 
@@ -50,4 +50,23 @@
 
 
+Script::Script(const std::string& filename)
+{
+  this->setClassID(CL_SCRIPT, "Script");
+
+  returnCount = argumentCount = 0;
+
+  luaState = lua_open();
+
+  luaopen_base(luaState);
+  luaopen_table(luaState);
+  luaopen_io(luaState);
+  luaopen_string(luaState);
+  luaopen_math(luaState);
+  luaopen_debug(luaState);
+  
+  this->loadFile(filename);
+
+}
+
 Script::~Script()
 {
@@ -59,13 +78,13 @@
 void Script::loadParams(const TiXmlElement* root)
 {
-  //printf("Loading params for %p \n",this);
+  //printf(("Loading params for %p \n",this);
   BaseObject::loadParams(root);
 
-  LOAD_PARAM_START_CYCLE(root, object);
+ LOAD_PARAM_START_CYCLE(root, object);
   {
     LoadParam_CYCLE(object, "object", this, Script, addObject)
-        .describe("The name of an object that is needed by a script");
+       .describe("The name of an object that is needed by a script");
   }
-  LOAD_PARAM_END_CYCLE(object);
+ LOAD_PARAM_END_CYCLE(object);
 
 
@@ -87,5 +106,5 @@
    if(currentFile.length() != 0)
    {
-     printf("Could not load %s because an other file is already loaded: %s\n",filename.c_str(), currentFile.c_str());
+     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());
      return false;
     }
@@ -104,5 +123,5 @@
      else
      {
-       printf("ERROR while loading file %s: \n",filename.c_str());
+       printf("SCRIPT %s : ERROR: while loading file %s: \n",currentFile.c_str(),filename.c_str());
        reportError(error);
      }
@@ -111,5 +130,5 @@
    else
    {
-     printf("ERROR while loading file %s: \n",filename.c_str());
+     printf("SCRIPT %s : ERROR: while loading file %s: \n",currentFile.c_str(),filename.c_str());
      reportError(error);
    }
@@ -121,8 +140,8 @@
  void Script::addObject(const std::string& className, const std::string& objectName)
  {
-   //printf("Script %s: I am about to add %s of class %s\n",this->getName(),objectName.c_str(),className.c_str());
+   //printf(("Script %s: I am about to add %s of class %s\n",this->getName(),objectName.c_str(),className.c_str());
 
    BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
-  // printf("The script class for %s is at %p \n",className.c_str(),scriptClass);
+  // printf(("The script class for %s is at %p \n",className.c_str(),scriptClass);
    WorldObject tmpObj;
    if (scriptClass != NULL)
@@ -135,5 +154,5 @@
 
      BaseObject* object = ClassList::getObject(objectName, className);
-    // printf("%s is at %p \n",objectName.c_str(),object);
+    // printf(("%s is at %p \n",objectName.c_str(),object);
      if (object != NULL && !objectIsAdded(objectName))
      {
@@ -150,5 +169,5 @@
  bool Script::executeFile()
  {
-   printf("WARNING: script.executeFile is not implemented yet");
+   PRINT(2)("WARNING: script.executeFile is not implemented yet\n");
    /*if(currentFile.length() != 0)
    {
@@ -183,5 +202,5 @@
    }
    else
-     printf("There is an other function active ( %s ) or there are unremoved return values on the stack. Please remove them first.\n",currentFunction.c_str());
+     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());
    return false;
  }
@@ -195,5 +214,5 @@
     if(error != 0)
     {
-     printf("ERROR while executing function %s: \n",currentFunction.c_str());
+      printf("SCRIPT %s : ERROR: Failed to execute function %s: \n",currentFile.c_str(),currentFunction.c_str());
      reportError(error);
      //clean up
@@ -210,5 +229,5 @@
    }
    else
-     printf("Error: no function selected.\n");
+     printf("SCRIPT %s : ERROR: no function selected.\n",currentFile.c_str());
 
    return false;
@@ -227,5 +246,5 @@
    else
    {
-    printf("Couldn't add parameter because the wrong function is selected: %s instead of %s\n", currentFunction.c_str(), toFunction.c_str());
+     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());
     return false;
    }
@@ -244,5 +263,5 @@
    else
    {
-     printf("Couldn't add parameter because the wrong function is selected: %s instead of %s\n", currentFunction.c_str(), toFunction.c_str());
+     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());
      return false;
    }
@@ -260,5 +279,5 @@
    else
    {
-     printf("Couldn't add parameter because the wrong function is selected: %s instead of %s\n", currentFunction.c_str(), toFunction.c_str());
+     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());
      return false;
    }
@@ -295,5 +314,5 @@
      }
      else
-       printf("ERROR: Form %s : trying to retreive non bolean value",this->currentFile.c_str());
+       printf("SCRIPT %s : ERROR: Trying to retreive non bolean value\n",this->currentFile.c_str());
    }
    return returnValue;
@@ -346,6 +365,6 @@
  {
   const char *msg = lua_tostring(luaState, -1);
-  if (msg == NULL) msg = "(error with no message)";
-  fprintf(stderr, "ERROR: %s\n", msg);
+  if (msg == NULL) msg = "(error with no message)\n";
+  printf("ERROR: %s\n", msg);
   lua_pop(luaState, 1);
  }
@@ -368,5 +387,5 @@
  {
    BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
-   //printf("The script class for %s is at %p \n",className.c_str(),scriptClass);
+   //printf(("The script class for %s is at %p \n",className.c_str(),scriptClass);
    WorldObject tmpObj;
    if (scriptClass != NULL)
Index: trunk/src/lib/script_engine/script.h
===================================================================
--- trunk/src/lib/script_engine/script.h	(revision 9235)
+++ trunk/src/lib/script_engine/script.h	(revision 9298)
@@ -24,4 +24,5 @@
   public:
     Script(const TiXmlElement* root = NULL);
+    Script(const std::string& filename);
     ~Script();
 
