Index: trunk/src/world_entities/script_trigger.cc
===================================================================
--- trunk/src/world_entities/script_trigger.cc	(revision 8362)
+++ trunk/src/world_entities/script_trigger.cc	(revision 8408)
@@ -1,4 +1,5 @@
 //for testing
 #include "luaincl.h"
+
 #include "script_trigger.h"
 #include "class_list.h"
@@ -6,16 +7,28 @@
 
 #include "state.h"
- 
- 
- 
+
+
+
+/**
+ * Constructs a new ScriptTrigger.
+ * @param root the xml element to load the parameters from.
+ *
+ */
 ScriptTrigger::ScriptTrigger(const TiXmlElement* root)
 {
+  this->setClassID(CL_SCRIPT_TRIGGER, "ScriptTrigger");
+  this->toList(OM_COMMON);
+
+  doDebugDraw = false;
   scriptCalled = false;
   scriptIsOk = false;
   loadParams(root);
 
-
-}
-
+}
+
+/**
+ * Deletes the ScriptTrigger.
+ * 
+ */
 ScriptTrigger::~ScriptTrigger()
 {
@@ -23,4 +36,9 @@
 }
 
+/**
+ * Reads the values from the tml element and sets them.
+ * @param root the xml element to load the parameters from.
+ *
+ */
 void ScriptTrigger::loadParams(const TiXmlElement* root)
 {
@@ -53,9 +71,16 @@
         .describe("True if the script shoul only be called once")
         .defaultValues("");
-  }
-
-}
-
-
+    LoadParam(root, "debugdraw", this, ScriptTrigger, setDebugDraw)
+        .describe("True if the script should only be called once")
+        .defaultValues("");
+  }
+
+}
+
+
+/**
+ * Sets the target(a world entity) of the ScriptTrigger. If the distance between the target and this trigger is smaller than the radius, the script gets triggered.
+ * @param target The worldentity that the script supervises.
+ */
 void ScriptTrigger::setTarget(const std::string& target)
 {
@@ -72,4 +97,8 @@
 }
 
+/**
+ * Sets the parent of the trigger.
+ * @param parent The parrent. 
+ */
 void ScriptTrigger::setTriggerParent(const std::string& parent)
 {
@@ -89,6 +118,6 @@
 void ScriptTrigger::tick(float timestep)
 {
-  printf("SCRIPTTRIGGER: tick called\n");
- if((this->getAbsDirV()-target->getAbsDirV()).len() < radius)
+
+  if( this->distance(target) < radius)
  {
   if(!callOnce)
@@ -102,4 +131,6 @@
   }
  }
+ //else
+   //printf("SCRIPTTRIGGER: target out of range\n");
 
 }
@@ -111,8 +142,8 @@
      {
        testScriptingFramework();
-     if(!(script->selectFunction(this->functionName,0)) )
+     /*if(!(script->selectFunction(this->functionName,0)) )
        printf("Error ScriptTrigger: Selection of %s in %s failed.\n",functionName.c_str(), script->getFileName().c_str());
      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());*/
      }
 }
@@ -121,10 +152,14 @@
 void ScriptTrigger::setScript(const std::string& file)
 {
+
   ScriptManager* scriptManager = State::getScriptManager();
   if (scriptManager != NULL)
   {
+
     script = scriptManager->getScriptByFile(file);
     if(script != NULL)
+    {
       scriptIsOk = true;
+    }
   }
 }
@@ -134,28 +169,7 @@
  {
    std::string file("lunartest2.lua");
-     // Script script;
+   //get script
    Script* script = State::getScriptManager()->getScriptByFile(file);
    printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState()));
-
-      // Register classes with the script
-      // Lunar<Account>::Register(&script);
-      //Lunar<Object>::Register(&script);
-
-      //Object* obj= new Object();
-      //Account a;
-      //Account *b = new Account(30);
-
-      // Add instances to the script
-      //Lunar<Object>::insertObject(&script,obj,"Obj",true);
-      //Lunar<Account>::insertObject(&script,&a,"a",false);
-      //Lunar<Account>::insertObject(&script,b,"b",true);
-       //printf("-------------------------- top of the stack:%i\n",lua_gettop(script.getLuaState()));
-
-      //Load a file
-      //std::string file("lunartest2.lua");
-
-      //if(script.loadFile(file))
-        //printf("File %s succefully loaded\n", file.c_str());
-      //printf("-------------------------- top of the stack:%i\n",lua_gettop(script.getLuaState()));
 
       //execute a function
@@ -166,9 +180,9 @@
 
    script->pushParam(3.14159,main);
+   printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState()));
    script->executeFunction();
 
-   float retf = script->getReturnedFloat();
-   printf("main returned %f\n",retf);
-
+   int ret = script->getReturnedInt();
+   printf("main returned %i\n",ret);
 
    if(script->getReturnedBool())
@@ -177,8 +191,9 @@
      printf("main returned false\n");
 
-   int ret = script->getReturnedInt();
-   printf("main returned %i\n",ret);
-
-      //printf("-------------------------- top of the stack:%i\n",lua_gettop(script.getLuaState()));
+   float retf = script->getReturnedFloat();
+   printf("main returned %f\n",retf);
+   
+
+   printf("-------------------------- top of the stack:%i\n",lua_gettop(script->getLuaState()));
       //execute a 2nd function
    printf("----------- test -----------\n");
Index: trunk/src/world_entities/script_trigger.h
===================================================================
--- trunk/src/world_entities/script_trigger.h	(revision 8362)
+++ trunk/src/world_entities/script_trigger.h	(revision 8408)
@@ -34,7 +34,8 @@
     void setScript(const std::string& file);
     void setFunction(const std::string& function){ this->functionName = function; }
-    
+    void setDebugDraw(const bool draw) { this->doDebugDraw = draw; }
+
     ///DRAWING
-    void draw()const{this->debugDraw();};
+    void draw()const{if(doDebugDraw)this->debugDraw();};
 
   private:
@@ -46,4 +47,5 @@
     Script*      script;
     std::string  functionName;
+    bool         doDebugDraw;
 
     //for internal use
Index: trunk/src/world_entities/space_ships/helicopter.cc
===================================================================
--- trunk/src/world_entities/space_ships/helicopter.cc	(revision 8362)
+++ trunk/src/world_entities/space_ships/helicopter.cc	(revision 8408)
@@ -35,4 +35,7 @@
 
 CREATE_FACTORY(Helicopter, CL_HELICOPTER);
+#include "script_class.h"
+//CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER, NULL);
+
 
 /**
Index: trunk/src/world_entities/space_ships/helicopter.h
===================================================================
--- trunk/src/world_entities/space_ships/helicopter.h	(revision 8362)
+++ trunk/src/world_entities/space_ships/helicopter.h	(revision 8408)
@@ -37,4 +37,6 @@
 
     virtual void process(const Event &event);
+    
+    virtual void moveUp(bool move){bUp = move;};
 
 
@@ -78,3 +80,8 @@
 };
 
+//CREATE_SCRIPTABLE_CLASS(Helicopter, CL_HELICOPTER,
+                       // addMethod("moveUp", ExecutorLua1<Object,bool>(&Helicopter::moveUp))
+                       // );
+
+
 #endif /* _HELICOPTERS_H */
