Index: /trunk/src/defs/class_id.h
===================================================================
--- /trunk/src/defs/class_id.h	(revision 8710)
+++ /trunk/src/defs/class_id.h	(revision 8711)
@@ -222,6 +222,4 @@
   // Testing Entities
   CL_TEST_ENTITY                =    0x00000409,
-  CL_ACCOUNT                    =    0x00000410,
-  CL_TEST_OBJECT                =    0x00000411,
 
   // misc
Index: /trunk/src/lib/coord/p_node.h
===================================================================
--- /trunk/src/lib/coord/p_node.h	(revision 8710)
+++ /trunk/src/lib/coord/p_node.h	(revision 8711)
@@ -103,6 +103,14 @@
   /** @returns the absolute position */
   inline const Vector& getAbsCoor () const { return this->absCoordinate; };
+  /** @returns the absolute X coordinate. */
+  inline float getAbsCoorX() { return this->absCoordinate.x; };
+  /** @returns the absolute Y Coordinate */
+  inline float getAbsCoorY() { return this->absCoordinate.y; };
+  /** @returns the absolute Z Coordinate */
+  inline float getAbsCoorZ() { return this->absCoordinate.z; };
+
   /** @returns the absolute position */
   inline const Vector& getLastAbsCoor () const { return this->lastAbsCoordinate; };
+  
   void shiftCoor (const Vector& shift);
   void shiftCoor (float x, float y, float z) { this->shiftCoor(Vector(x, y, z)); };
Index: /trunk/src/lib/gui/gl/glgui_handler.cc
===================================================================
--- /trunk/src/lib/gui/gl/glgui_handler.cc	(revision 8710)
+++ /trunk/src/lib/gui/gl/glgui_handler.cc	(revision 8711)
@@ -23,4 +23,5 @@
 
 #include "class_list.h"
+#include <cassert>
 
 #include <cassert>
Index: /trunk/src/lib/script_engine/Makefile.am
===================================================================
--- /trunk/src/lib/script_engine/Makefile.am	(revision 8710)
+++ /trunk/src/lib/script_engine/Makefile.am	(revision 8711)
@@ -16,10 +16,6 @@
                 script_manager.cc \
 		script_class.cc \
-		script_method.cc \
-		\
-		account.cc \
-		object.cc
-
-
+		script_method.cc
+		
 AM_CPPFLAGS= @LUA_INCLUDES@
 
Index: unk/src/lib/script_engine/lunartest.lua
===================================================================
--- /trunk/src/lib/script_engine/lunartest.lua	(revision 8710)
+++ 	(revision )
@@ -1,35 +1,0 @@
- function printf(...) io.write(string.format(unpack(arg))) end
-
-function Account:show()
-  printf("Account balance = $%0.02f\n", self:balance())
-end
-
-
-o = Object()
-o:printName()
-
-Obj:printName() --external added object
-
-a = Account(100)
-b = Account:new(30)
-
-print('a =', a)
-print('b =', b)
-print('metatable =', getmetatable(a))
-print('Account =', Account)
-table.foreach(Account, print)
-
-a:show() a:deposit(50.30) a:show() a:withdraw(25.10) a:show()
-
-
-
-parent = {}
- function parent:rob(amount)
-  amount = amount or self:balance()
-  self:withdraw(amount)
-  return amount
-end
-
-getmetatable(Account).__index = parent
-
---debug.debug()
Index: /trunk/src/lib/script_engine/lunartest2.lua
===================================================================
--- /trunk/src/lib/script_engine/lunartest2.lua	(revision 8710)
+++ /trunk/src/lib/script_engine/lunartest2.lua	(revision 8711)
@@ -22,17 +22,16 @@
 
 function main(arg)
-  io.write("hello i am main!")
+  io.write("hello i am main!\n")
   -- use parameter
   io.write("main received ", arg)
   io.write(" as parameter\n")
 
- o = Object()
-  o:printName()
+ 
   --call member of an inserted object
   Obj:printName()
 
   --create object of a registered type
-  --o = Object()
-  --o:printName()
+  o = Object()
+  o:printName()
 
   --take returnvalue from c
Index: /trunk/src/lib/script_engine/script.cc
===================================================================
--- /trunk/src/lib/script_engine/script.cc	(revision 8710)
+++ /trunk/src/lib/script_engine/script.cc	(revision 8711)
@@ -1,6 +1,22 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Silvan Nellen
+   co-programmer: Benjamin Grauer
+*/
+
 #include "script.h"
 #include "script_class.h"
 #include "luaincl.h"
 
+#include "util/loading/resource_manager.h"
 
 #include "loading/load_param.h"
@@ -58,4 +74,7 @@
  {
 
+   std::string filedest(ResourceManager::getInstance()->getDataDir());
+   filedest += "scripts/" + filename;
+   
    if(currentFile.length() != 0)
    {
@@ -64,8 +83,9 @@
     }
 
-   int error = luaL_loadfile (luaState, filename.c_str());
+   int error = luaL_loadfile (luaState, filedest.c_str());
 
    if(error == 0)
    {
+     
      error = lua_pcall(luaState, 0, 0, 0);
 
@@ -192,9 +212,9 @@
  bool Script::pushParam(int param, std::string& toFunction)
  {
-   if(currentFunction.compare(toFunction) == 0)
+   if(currentFunction == toFunction)
    {
      lua_pushnumber(luaState, (lua_Number) param);
      argumentCount++;
-    return true;
+     return true;
    }
    else
@@ -267,4 +287,6 @@
        returnCount--;
      }
+     else
+       printf("ERROR: Form %s : trying to retreive non bolean value",this->currentFile.c_str());
    }
    return returnValue;
@@ -313,4 +335,33 @@
  }
 
+ bool Script::registerStandartClasses()
+ {
+   bool success = false;
+   
+   //success = this->registerClass(std::string("Vector"));
+   
+   return success;
+ }
+ 
+ 
+ bool Script::registerClass( const std::string& className)
+ {
+   BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
+   //printf("The script class for %s is at %p \n",className.c_str(),scriptClass);
+   WorldObject tmpObj;
+   if (scriptClass != NULL)
+   {
+     tmpObj.type = className;
+     if( !classIsRegistered(className) )
+     {
+       static_cast<ScriptClass*>(scriptClass)->registerClass(this);
+       tmpObj.name = "";
+       registeredObjects.push_back(tmpObj);
+       return true;
+     }
+   }
+   return false;
+ 
+ }
 
  bool Script::classIsRegistered(const std::string& type)
Index: /trunk/src/lib/script_engine/script.h
===================================================================
--- /trunk/src/lib/script_engine/script.h	(revision 8710)
+++ /trunk/src/lib/script_engine/script.h	(revision 8711)
@@ -1,2 +1,7 @@
+/*!
+ * @file scrip.h
+ *  wrapper for a lua_State
+ */
+
 #ifndef _SCRIPT_H
 #define _SCRIPT_H
@@ -58,4 +63,6 @@
 
     int  reportError(int error);                      //!< Get errormessage from the lua stack and print it.
+    bool registerStandartClasses();                   //!< Register all the classes that the script might need
+    bool registerClass(const std::string& className); //!< Register a class but dont add any instances 
     bool classIsRegistered(const std::string& type);  //!< Checks wheter the class "type" has already been registered with the script
     bool objectIsAdded(const std::string& name);      //!< Checks wheter the object "name" has already been added to the script
Index: /trunk/src/lib/script_engine/script_class.cc
===================================================================
--- /trunk/src/lib/script_engine/script_class.cc	(revision 8710)
+++ /trunk/src/lib/script_engine/script_class.cc	(revision 8711)
@@ -10,5 +10,5 @@
 
    ### File Specific:
-   main-programmer: ...
+   main-programmer: Benjamin Grauer
    co-programmer: ...
 */
Index: /trunk/src/lib/script_engine/script_manager.cc
===================================================================
--- /trunk/src/lib/script_engine/script_manager.cc	(revision 8710)
+++ /trunk/src/lib/script_engine/script_manager.cc	(revision 8711)
@@ -1,2 +1,18 @@
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Silvan Nellen
+   co-programmer: Benjamin Grauer
+*/
+
+
 #include <string>
 #include <list>
Index: /trunk/src/lib/script_engine/script_manager.h
===================================================================
--- /trunk/src/lib/script_engine/script_manager.h	(revision 8710)
+++ /trunk/src/lib/script_engine/script_manager.h	(revision 8711)
@@ -1,2 +1,7 @@
+/*!
+ * @file scrip_manager.h
+ *  manages the scripts
+ */
+
 #ifndef _SCRIPT_MANAGER_H
 #define _SCRIPT_MANAGER_H
Index: /trunk/src/lib/script_engine/script_method.cc
===================================================================
--- /trunk/src/lib/script_engine/script_method.cc	(revision 8710)
+++ /trunk/src/lib/script_engine/script_method.cc	(revision 8711)
@@ -10,5 +10,5 @@
 
    ### File Specific:
-   main-programmer: ...
+   main-programmer: Benjamin Grauer
    co-programmer: ...
 */
Index: /trunk/src/lib/script_engine/script_method.h
===================================================================
--- /trunk/src/lib/script_engine/script_method.h	(revision 8710)
+++ /trunk/src/lib/script_engine/script_method.h	(revision 8711)
@@ -1,4 +1,4 @@
 /*!
- * @file script_class.h
+ * @file script_method.h
  * @brief Definition of ...
 */
Index: /trunk/src/lib/util/executor/executor_lua.h
===================================================================
--- /trunk/src/lib/util/executor/executor_lua.h	(revision 8710)
+++ /trunk/src/lib/util/executor/executor_lua.h	(revision 8711)
@@ -182,4 +182,54 @@
 
 
+///////////
+//// 3 ////
+///////////
+//! Executes a Function with a lua_State* parameter.
+template<class T, typename type0, typename type1, typename type2> class ExecutorLua3 : public Executor
+{
+  public:
+    /**
+   * @brief Constructor of a ExecutorXML
+   * @param function a Function to call
+     */
+    ExecutorLua3(void(T::*function)(type0, type1, type2))
+  : Executor(ExecutorParamType<type0>(), ExecutorParamType<type1>(), ExecutorParamType<type2>())
+    {
+      this->functionPointer = function;
+      this->functorType = Executor_Objective | Executor_NoLoadString;
+    }
+
+    /**
+     * @brief executes the Command on BaseObject
+     * @param object the BaseObject to execute this Executor on
+     * @param loadString ignored in this case
+     */
+    virtual void operator()(BaseObject* object, const SubString& = SubString()) const
+    {
+      PRINTF(1)("no usefull executor\n");
+    }
+
+    virtual void operator()(BaseObject* object, int& count, void* values) const
+    {
+      lua_State* state = (lua_State*)values;
+      count = 0;
+
+      (dynamic_cast<T*>(object)->*(functionPointer))(
+          fromLua<type0>(state, 1),
+          fromLua<type1>(state, 2),
+          fromLua<type2>(state, 3) );
+    }
+
+    /**
+     * @returns a _new_ Copy of this Executor
+     */
+    virtual Executor* clone () const
+    {
+      return new ExecutorLua3<T, type0, type1, type2>(this->functionPointer);
+    }
+  private:
+    void          (T::*functionPointer)(type0, type1, type2);
+};
+
 
 
@@ -209,5 +259,5 @@
       this->functorType = Executor_Objective | Executor_NoLoadString;
     }
-
+    
     /**
      * @brief executes the Command on BaseObject
Index: /trunk/src/story_entities/game_world.cc
===================================================================
--- /trunk/src/story_entities/game_world.cc	(revision 8710)
+++ /trunk/src/story_entities/game_world.cc	(revision 8711)
@@ -142,6 +142,4 @@
 }
 
-#include "account.cc"
-#include "object.cc"
 /**
  *  loads the GameWorld by initializing all resources, and set their default values.
@@ -187,11 +185,10 @@
 
   //remove this after finished testing !!!!
-  Object* obj= new Object();
-  obj->setName("Obj");
-  Account* a = new Account();
-  a->setName("a");
-  Account *b = new Account(30);
-  b->setName("b");
-  
+  //Object* obj= new Object();
+  //obj->setName("Obj");
+  //Account* a = new Account();
+  //a->setName("a");
+  //Account *b = new Account(30);
+  //b->setName("b");
   
   LoadParamXML(root, "ScriptManager", &this->scriptManager, ScriptManager, loadParams);
Index: /trunk/src/world_entities/script_trigger.cc
===================================================================
--- /trunk/src/world_entities/script_trigger.cc	(revision 8710)
+++ /trunk/src/world_entities/script_trigger.cc	(revision 8711)
@@ -1,4 +1,17 @@
-//for testing
-#include "luaincl.h"
+/*
+   orxonox - the future of 3D-vertical-scrollers
+
+   Copyright (C) 2004 orx
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+### File Specific:
+   main-programmer: Silvan Nellen
+   co-programmer: ...
+*/
+
 
 #include "script_trigger.h"
@@ -20,7 +33,11 @@
   this->toList(OM_COMMON);
 
+  returnCount = 1;
+  actionFinished = false;
   doDebugDraw = false;
+  invert = false;
   scriptCalled = false;
   scriptIsOk = false;
+  triggerLasts = false;
   loadParams(root);
 
@@ -71,4 +88,10 @@
         .describe("True if the script shoul only be called once")
         .defaultValues("");
+    LoadParam(root, "invert", this, ScriptTrigger, setInvert)
+        .describe("")
+        .defaultValues("");
+    LoadParam(root, "triggerlasts", this, ScriptTrigger, setTriggerLasts)
+        .describe("")
+        .defaultValues("");
     LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw)
         .describe("True if the script should only be called once")
@@ -118,16 +141,38 @@
 void ScriptTrigger::tick(float timestep)
 {
-
-  if( this->distance(target) < radius)
+  if(actionFinished) return;
+
+  if(triggerLasts && scriptCalled)
+  {
+    executeAction(timestep);
+    return;
+  }
+  
+  if( !invert && this->distance(target) < radius)
  {
   if(!callOnce)
    {
-    executeAction();
+    executeAction(timestep);
+    scriptCalled = true;
    }
   else if(callOnce && !scriptCalled)
   {
-   executeAction();
+   executeAction(timestep);
    scriptCalled = true;
   }
+  
+ }
+ else if( invert && this->distance(target) > radius)
+ {
+   if(!callOnce)
+   {
+     executeAction(timestep);
+   }
+   else if(callOnce && !scriptCalled)
+   {
+     executeAction(timestep);
+     scriptCalled = true;
+   }
+   
  }
  //else
@@ -137,14 +182,21 @@
 
 
-void ScriptTrigger::executeAction()
+void ScriptTrigger::executeAction(float timestep)
 {
      if(scriptIsOk)
      {
-       testScriptingFramework();
-     /*if(!(script->selectFunction(this->functionName,0)) )
+       //testScriptingFramework();
+     if(!(script->selectFunction(this->functionName,returnCount)) )
        printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
+     
+     script->pushParam( timestep, this->functionName);
+     
      if( !(script->executeFunction()) )
-       printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());*/
+       printf("Error ScriptTrigger: Execution of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
+     
+     actionFinished = script->getReturnedBool();
      }
+     
+     
 }
 
@@ -165,5 +217,5 @@
 }
 
-
+/*
  void ScriptTrigger::testScriptingFramework()
  {
@@ -208,3 +260,3 @@
    printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState()));
 
- }
+}*/
Index: /trunk/src/world_entities/script_trigger.h
===================================================================
--- /trunk/src/world_entities/script_trigger.h	(revision 8710)
+++ /trunk/src/world_entities/script_trigger.h	(revision 8711)
@@ -1,2 +1,7 @@
+/*!
+ * @file scrip_trigger.h
+ *  triggeres a script
+ */
+
 #ifndef _SCRIPT_TRIGGER_H
 #define _SCRIPT_TRIGGER_H
@@ -22,5 +27,5 @@
     /// DO WORK
     virtual void tick(float timestep);
-    virtual void executeAction();
+    virtual void executeAction(float timestep);
     void testScriptingFramework();
 
@@ -30,8 +35,10 @@
     void setTriggerParent(const std::string& name);
     void setCallOnce(const bool call) { this->callOnce = call; }
+    void setTriggerLasts(const bool lasts) { this->triggerLasts = lasts; }
+    void setInvert(const bool inv) { this->invert = invert; }
     void setRadius(const float radius) { if(radius>0) this->radius = radius; }
     void setDelay(const float time){if(delay>0) this->delay = delay; }
     void setScript(const std::string& file);
-    void setFunction(const std::string& function){ this->functionName = function; }
+    void setFunction(const std::string& function){ this->functionName = function;}
     void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
 
@@ -43,4 +50,6 @@
     WorldEntity* target;
     bool         callOnce;
+    bool         triggerLasts;
+    bool         invert;
     float        radius;
     float        delay;
@@ -52,4 +61,6 @@
     bool         scriptCalled;
     bool         scriptIsOk;
+    bool         actionFinished;
+    int          returnCount;        //TODO: set return count correctly
 
 };
Index: /trunk/src/world_entities/space_ships/helicopter.h
===================================================================
--- /trunk/src/world_entities/space_ships/helicopter.h	(revision 8710)
+++ /trunk/src/world_entities/space_ships/helicopter.h	(revision 8711)
@@ -12,4 +12,6 @@
 #include "sound_buffer.h"
 #include "sound_source.h"
+
+#include "script_class.h"
 
 class Helicopter : public Playable
@@ -38,5 +40,6 @@
     virtual void process(const Event &event);
     
-    virtual void moveUp(bool move){bUp = move;};
+    virtual void moveUp(bool move){bAscend = move;};
+    virtual void moveDown(bool move){bDescend = move;};
 
 
@@ -80,7 +83,13 @@
 };
 
-//CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,
-                       // addMethod("moveUp", ExecutorLua1<Object,bool>(&Helicopter::moveUp))
-                       // );
+CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,
+                        addMethod("moveUp", ExecutorLua1<Helicopter,bool>(&Helicopter::moveUp))
+                        ->addMethod("moveDown", ExecutorLua1<Helicopter,bool>(&Helicopter::moveDown))
+                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
+                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
+                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
+                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
+                            
+                        );
 
 
